github.com/agiledragon/gomonkey/v2@v2.11.1-0.20240427155748-d56c6823ec17/dsl/constraint.go (about)

     1  package dsl
     2  
     3  import "reflect"
     4  
     5  type Constraint interface {
     6      Eval(x interface{}) bool
     7  }
     8  
     9  type AnyConstraint struct {
    10  }
    11  
    12  func (this *AnyConstraint) Eval(x interface{}) bool {
    13      return true
    14  }
    15  
    16  type EqConstraint struct {
    17      x interface{}
    18  }
    19  
    20  func (this *EqConstraint) Eval(x interface{}) bool {
    21      return reflect.DeepEqual(this.x, x)
    22  }