github.com/wfusion/gofusion@v1.1.14/common/utils/gomonkey/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  }