simon0-o commented on PR #2469:
URL: https://github.com/apache/thrift/pull/2469#issuecomment-1203541335

   Generated Code Examples:
   ValidateTest.thrift
   ```thrift
   namespace go validatetest
   
   enum EnumFoo {
     e1
     e2
   }
   
   struct Foo {
           1: bool Bool
   }
   
   struct BasicTest {
           1: bool Bool0 (vt.const = "true")
           2: optional bool Bool1 (vt.const = "true")
           3: i8 Byte0 = 1 (vt.lt = "2", vt.le = "2", vt.gt = "0", vt.ge = "0", 
vt.in = "[0, 1, 2]", vt.not_in = "[3, 4, 5]")
           4: optional i8 Byte1 (vt.lt = "1", vt.le = "1", vt.gt = "-1", vt.ge 
= "-1", vt.in = "[-1, 0, 1]", vt.not_in = "[1, 2, 3]")
           5: double Double0 = 1.0 (vt.lt = "2.0", vt.le = "2.0", vt.gt = "0", 
vt.ge = "0", vt.in = "[0, 1.0, 2.0]", vt.not_in = "[3.0, 4.0, 5.0]")
           6: optional double Double1 (vt.lt = "2.0", vt.le = "2.0", vt.gt = 
"0", vt.ge = "0", vt.in = "[0, 1.0, 2.0]", vt.not_in = "[3.0, 4.0, 5.0]")
           7: string String0 = "my const string" (vt.const = "my const string", 
vt.min_size = "0", vt.max_size = "100", vt.pattern = ".*", vt.prefix = "my", 
vt.suffix = "string", vt.contains = "const", vt.not_contains = "oh")
           8: optional string String1 (vt.const = "my const string", 
vt.min_size = "0", vt.max_size = "100", vt.pattern = ".*", vt.prefix = "my", 
vt.suffix = "string", vt.contains = "const", vt.not_contains = "oh")
           9: binary Binary0 = "my const string" (vt.const = "my const string", 
vt.min_size = "0", vt.max_size = "100", vt.pattern = ".*", vt.prefix = "my", 
vt.suffix = "string", vt.contains = "const", vt.not_contains = "oh")
           10: optional binary Binary1 = "my const string" (vt.const = "my 
const string", vt.min_size = "0", vt.max_size = "100", vt.pattern = ".*", 
vt.prefix = "my", vt.suffix = "string", vt.contains = "const", vt.not_contains 
= "oh")
           11: map<string, string> Map0 (vt.min_size = "0", vt.max_size = "10", 
vt.key.min_size = "0", vt.key.max_size = "10", vt.value.min_size = "0", 
vt.value.max_size = "10")
           12: optional map<string, string> Map1 (vt.min_size = "0", 
vt.max_size = "10", vt.key.min_size = "0", vt.key.max_size = "10", 
vt.value.min_size = "0", vt.value.max_size = "10")
           13: set<string> Set0 (vt.min_size = "0", vt.max_size = "10", 
vt.elem.min_size = "0")
           14: optional set<string> Set1 (vt.min_size = "0", vt.max_size = 
"10", vt.elem.min_size = "0")
           15: EnumFoo Enum0 (vt.const = "EnumFoo.e1", vt.defined_only = "true")
           16: optional EnumFoo Enum1 (vt.const = "EnumFoo.e1", vt.defined_only 
= "true")
           17: map<string, Foo> Map2 (vt.no_sparse = "true")
           18: optional map<string, Foo> Map3 (vt.no_sparse = "true")
           19: Foo Struct0 (vt.skip = "true")
           20: optional Foo Struct1 (vt.skip = "true")
   }
   
   struct FieldReferenceTest {
           1: bool Bool0 (vt.const = "$Bool2")
           2: optional bool Bool1 (vt.const = "$Bool2")
           3: i8 Byte0 = 10 (vt.lt = "$Byte4", vt.le = "$Byte4", vt.gt = 
"$Byte2", vt.ge = "$Byte2", vt.in = "[$Byte2, $Byte3, $Byte4]", vt.not_in = 
"[$Byte2, $Byte4]")
           4: optional i8 Byte1 (vt.lt = "$Byte4", vt.le = "$Byte4", vt.gt = 
"$Byte2", vt.ge = "$Byte2", vt.in = "[$Byte2, $Byte3, $Byte4]", vt.not_in = 
"[$Byte2, $Byte4]")
           5: double Double0 = 10.0 (vt.lt = "$Double4", vt.le = "$Double4", 
vt.gt = "$Double2", vt.ge = "$Double2", vt.in = "[$Double2, $Double3, 
$Double4]", vt.not_in = "[$Double2, $Double4]")
           6: optional double Double1 (vt.lt = "$Double4", vt.le = "$Double4", 
vt.gt = "$Double2", vt.ge = "$Double2", vt.in = "[$Double2, $Double3, 
$Double4]", vt.not_in = "[$Double2, $Double4]")
           7: string String0 = "my string" (vt.const = "$String2", vt.min_size 
= "$Byte2", vt.max_size = "$Byte3", vt.pattern = "$String4", vt.prefix = 
"$String2", vt.suffix = "$String2", vt.contains = "$String2", vt.not_contains = 
"$String3")
           8: optional string String1 (vt.const = "$String2", vt.min_size = 
"$Byte2", vt.max_size = "$Byte3", vt.pattern = "$String4", vt.prefix = 
"$String2", vt.suffix = "$String2", vt.contains = "$String2", vt.not_contains = 
"$String3")
           9: binary Binary0 = "my binary" (vt.const = "$Binary2", vt.min_size 
= "$Byte2", vt.max_size = "$Byte3", vt.pattern = "$Binary4", vt.prefix = 
"$Binary2", vt.suffix = "$Binary2", vt.contains = "$Binary2", vt.not_contains = 
"$Binary3")
           10: optional binary Binary1 = "my binary" (vt.const = "$Binary2", 
vt.min_size = "$Byte2", vt.max_size = "$Byte3", vt.pattern = "$Binary4", 
vt.prefix = "$Binary2", vt.suffix = "$Binary2", vt.contains = "$Binary2", 
vt.not_contains = "$Binary3")
           11: map<string, string> Map0 (vt.min_size = "$Byte2", vt.max_size = 
"$Byte3", vt.key.min_size = "$Byte2", vt.key.max_size = "$Byte3", 
vt.value.min_size = "$Byte2", vt.value.max_size = "$Byte3")
           12: optional map<string, string> Map1 (vt.min_size = "$Byte2", 
vt.max_size = "$Byte3", vt.key.min_size = "$Byte2", vt.key.max_size = "$Byte3", 
vt.value.min_size = "$Byte2", vt.value.max_size = "$Byte3")
           13: list<string> List0 (vt.min_size = "$Byte2", vt.max_size = 
"$Byte3", vt.elem.min_size = "$Byte2", vt.elem.max_size = "$Byte3")
           14: optional list<string> List1 (vt.min_size = "$Byte2", vt.max_size 
= "$Byte3", vt.elem.min_size = "$Byte2", vt.elem.max_size = "$Byte3")
           15: set<string> Set0 (vt.min_size = "$Byte2", vt.max_size = 
"$Byte3", vt.elem.min_size = "$Byte2", vt.elem.max_size = "$Byte3")
           16: optional set<string> Set1 (vt.min_size = "$Byte2", vt.max_size = 
"$Byte3", vt.elem.min_size = "$Byte2", vt.elem.max_size = "$Byte3")
           17: bool Bool2 = false
           18: i8 Byte2 = 0
           19: i8 Byte3 = 10
           20: i8 Byte4 = 20
           21: double Double2 = 0
           22: double Double3 = 10.0
           23: double Double4 = 20.0
           24: string String2 = "my string"
           25: string String3 = "other string"
           26: string String4 = ".*"
           27: binary Binary2 = "my binary"
           28: binary Binary3 = "other binary"
           29: binary Binary4 = ".*"
   }
   
   struct ValidationFunctionTest {
           1: string StringFoo
           2: i64 StringLength (vt.in = "[@len($StringFoo)]")
   }
   ```
   Related Generated Code:
   ```go
   func (p *Foo) IsValid() error {
        return nil
   }
   
   func (p *BasicTest) IsValid() error {
        if p.Bool0 != false {
                return errors.New("p.Bool0 not valid, rule vt.const check 
failed")
        }
        if p.Bool1 != nil {
                if *p.Bool1 != false {
                        return errors.New("*p.Bool1 not valid, rule vt.const 
check failed")
                }
        }
        if p.Byte0 >= 2 {
                return errors.New("p.Byte0 not valid, rule vt.lt check failed")
        }
        if p.Byte0 > 2 {
                return errors.New("p.Byte0 not valid, rule vt.le check failed")
        }
        if p.Byte0 <= 0 {
                return errors.New("p.Byte0 not valid, rule vt.gt check failed")
        }
        if p.Byte0 < 0 {
                return errors.New("p.Byte0 not valid, rule vt.ge check failed")
        }
        var _exist0 bool
        _src0 := []int8{0, 1, 2}
        for _, src := range _src0 {
                if p.Byte0 == src {
                        _exist0 = true
                }
        }
        if _exist0 == false {
                return errors.New("p.Byte0 not valid, rule vt.in check failed")
        }
        _src1 := []int8{3, 4, 5}
        for _, src := range _src1 {
                if p.Byte0 == src {
                        {
                                return errors.New("p.Byte0 not valid, rule 
vt.not_in check failed")
                        }
                }
        }
        if p.Byte1 != nil {
                if *p.Byte1 >= 1 {
                        return errors.New("*p.Byte1 not valid, rule vt.lt check 
failed")
                }
                if *p.Byte1 > 1 {
                        return errors.New("*p.Byte1 not valid, rule vt.le check 
failed")
                }
                if *p.Byte1 <= -1 {
                        return errors.New("*p.Byte1 not valid, rule vt.gt check 
failed")
                }
                if *p.Byte1 < -1 {
                        return errors.New("*p.Byte1 not valid, rule vt.ge check 
failed")
                }
                var _exist1 bool
                _src2 := []int8{-1, 0, 1}
                for _, src := range _src2 {
                        if *p.Byte1 == src {
                                _exist1 = true
                        }
                }
                if _exist1 == false {
                        return errors.New("*p.Byte1 not valid, rule vt.in check 
failed")
                }
                _src3 := []int8{1, 2, 3}
                for _, src := range _src3 {
                        if *p.Byte1 == src {
                                {
                                        return errors.New("*p.Byte1 not valid, 
rule vt.not_in check failed")
                                }
                        }
                }
        }
        if p.Double0 >= 2 {
                return errors.New("p.Double0 not valid, rule vt.const check 
failed")
        }
        if p.Double0 > 2 {
                return errors.New("p.Double0 not valid, rule vt.const check 
failed")
        }
        if p.Double0 <= 0 {
                return errors.New("p.Double0 not valid, rule vt.const check 
failed")
        }
        if p.Double0 < 0 {
                return errors.New("p.Double0 not valid, rule vt.const check 
failed")
        }
        var _exist2 bool
        _src4 := []float64{0, 1, 2}
        for _, src := range _src4 {
                if p.Double0 == src {
                        _exist2 = true
                }
        }
        if _exist2 == false {
                return errors.New("p.Double0 not valid, rule vt.in check 
failed")
        }
        _src5 := []float64{3, 4, 5}
        for _, src := range _src5 {
                if p.Double0 == src {
                        return errors.New("p.Double0 not valid, rule vt.not_in 
check failed")
                }
        }
        if p.Double1 != nil {
                if *p.Double1 >= 2 {
                        return errors.New("*p.Double1 not valid, rule vt.const 
check failed")
                }
                if *p.Double1 > 2 {
                        return errors.New("*p.Double1 not valid, rule vt.const 
check failed")
                }
                if *p.Double1 <= 0 {
                        return errors.New("*p.Double1 not valid, rule vt.const 
check failed")
                }
                if *p.Double1 < 0 {
                        return errors.New("*p.Double1 not valid, rule vt.const 
check failed")
                }
                var _exist3 bool
                _src6 := []float64{0, 1, 2}
                for _, src := range _src6 {
                        if *p.Double1 == src {
                                _exist3 = true
                        }
                }
                if _exist3 == false {
                        return errors.New("*p.Double1 not valid, rule vt.in 
check failed")
                }
                _src7 := []float64{3, 4, 5}
                for _, src := range _src7 {
                        if *p.Double1 == src {
                                return errors.New("*p.Double1 not valid, rule 
vt.not_in check failed")
                        }
                }
        }
        if p.String0 != "my const string" {
                return errors.New("p.String0 not valid, rule vt.const check 
failed")
        }
        if len(p.String0) < int(0) {
                return errors.New("p.String0 not valid, rule vt.min_size check 
failed")
        }
        if len(p.String0) > int(100) {
                return errors.New("p.String0 not valid, rule vt.max_size check 
failed")
        }
        if ok, _ := regexp.MatchString(p.String0, ".*"); ok {
                return errors.New("p.String0 not valid, rule vt.pattern check 
failed")
        }
        if !strings.HasPrefix(p.String0, "my") {
                return errors.New("p.String0 not valid, rule vt.prefix check 
failed")
        }
        if !strings.HasSuffix(p.String0, "string") {
                return errors.New("p.String0 not valid, rule vt.suffix check 
failed")
        }
        if !strings.Contains(p.String0, "const") {
                return errors.New("p.String0 not valid, rule vt.contains check 
failed")
        }
        if strings.Contains(p.String0, "oh") {
                return errors.New("p.String0 not valid, rule vt.not_contains 
check failed")
        }
        if p.String1 != nil {
                if *p.String1 != "my const string" {
                        return errors.New("*p.String1 not valid, rule vt.const 
check failed")
                }
                if len(*p.String1) < int(0) {
                        return errors.New("*p.String1 not valid, rule 
vt.min_size check failed")
                }
                if len(*p.String1) > int(100) {
                        return errors.New("*p.String1 not valid, rule 
vt.max_size check failed")
                }
                if ok, _ := regexp.MatchString(*p.String1, ".*"); ok {
                        return errors.New("*p.String1 not valid, rule 
vt.pattern check failed")
                }
                if !strings.HasPrefix(*p.String1, "my") {
                        return errors.New("*p.String1 not valid, rule vt.prefix 
check failed")
                }
                if !strings.HasSuffix(*p.String1, "string") {
                        return errors.New("*p.String1 not valid, rule vt.suffix 
check failed")
                }
                if !strings.Contains(*p.String1, "const") {
                        return errors.New("*p.String1 not valid, rule 
vt.contains check failed")
                }
                if strings.Contains(*p.String1, "oh") {
                        return errors.New("*p.String1 not valid, rule 
vt.not_contains check failed")
                }
        }
        _tgt0 := string(p.Binary0)
        if _tgt0 != "my const string" {
                return errors.New("p.Binary0 not valid, rule vt.const check 
failed")
        }
        if len(_tgt0) < int(0) {
                return errors.New("p.Binary0 not valid, rule vt.min_size check 
failed")
        }
        if len(_tgt0) > int(100) {
                return errors.New("p.Binary0 not valid, rule vt.max_size check 
failed")
        }
        if ok, _ := regexp.MatchString(_tgt0, ".*"); ok {
                return errors.New("p.Binary0 not valid, rule vt.pattern check 
failed")
        }
        if !strings.HasPrefix(_tgt0, "my") {
                return errors.New("p.Binary0 not valid, rule vt.prefix check 
failed")
        }
        if !strings.HasSuffix(_tgt0, "string") {
                return errors.New("p.Binary0 not valid, rule vt.suffix check 
failed")
        }
        if !strings.Contains(_tgt0, "const") {
                return errors.New("p.Binary0 not valid, rule vt.contains check 
failed")
        }
        if strings.Contains(_tgt0, "oh") {
                return errors.New("p.Binary0 not valid, rule vt.not_contains 
check failed")
        }
        _tgt1 := string(p.Binary1)
        if _tgt1 != "my const string" {
                return errors.New("p.Binary1 not valid, rule vt.const check 
failed")
        }
        if len(_tgt1) < int(0) {
                return errors.New("p.Binary1 not valid, rule vt.min_size check 
failed")
        }
        if len(_tgt1) > int(100) {
                return errors.New("p.Binary1 not valid, rule vt.max_size check 
failed")
        }
        if ok, _ := regexp.MatchString(_tgt1, ".*"); ok {
                return errors.New("p.Binary1 not valid, rule vt.pattern check 
failed")
        }
        if !strings.HasPrefix(_tgt1, "my") {
                return errors.New("p.Binary1 not valid, rule vt.prefix check 
failed")
        }
        if !strings.HasSuffix(_tgt1, "string") {
                return errors.New("p.Binary1 not valid, rule vt.suffix check 
failed")
        }
        if !strings.Contains(_tgt1, "const") {
                return errors.New("p.Binary1 not valid, rule vt.contains check 
failed")
        }
        if strings.Contains(_tgt1, "oh") {
                return errors.New("p.Binary1 not valid, rule vt.not_contains 
check failed")
        }
        if len(p.Map0) < 0 {
                return errors.New("p.Map0 not valid, rule vt.min_size check 
failed")
        }
        if len(p.Map0) > 10 {
                return errors.New("p.Map0 not valid, rule vt.max_size check 
failed")
        }
        if len(p.Map1) < 0 {
                return errors.New("p.Map1 not valid, rule vt.min_size check 
failed")
        }
        if len(p.Map1) > 10 {
                return errors.New("p.Map1 not valid, rule vt.max_size check 
failed")
        }
        if len(p.Set0) < 0 {
                return errors.New("p.Set0 not valid, rule vt.min_size check 
failed")
        }
        if len(p.Set0) > 10 {
                return errors.New("p.Set0 not valid, rule vt.max_size check 
failed")
        }
        if len(p.Set1) < 0 {
                return errors.New("p.Set1 not valid, rule vt.min_size check 
failed")
        }
        if len(p.Set1) > 10 {
                return errors.New("p.Set1 not valid, rule vt.max_size check 
failed")
        }
        if p.Enum0 != 0 {
                return errors.New("p.Enum0 not valid, rule vt.const check 
failed")
        }
        if p.Enum1 != nil {
                if *p.Enum1 != *EnumFooPtr(0) {
                        return errors.New("*p.Enum1 not valid, rule vt.const 
check failed")
                }
        }
        if err := p.Struct0.IsValid(); err != nil {
                return err
        }
        if err := p.Struct1.IsValid(); err != nil {
                return err
        }
        return nil
   }
   
   func (p *FieldReferenceTest) IsValid() error {
        if p.Bool0 != p.Bool2 {
                return errors.New("p.Bool0 not valid, rule vt.const check 
failed")
        }
        if p.Bool1 != nil {
                if *p.Bool1 != p.Bool2 {
                        return errors.New("*p.Bool1 not valid, rule vt.const 
check failed")
                }
        }
        if p.Byte0 >= p.Byte4 {
                return errors.New("p.Byte0 not valid, rule vt.lt check failed")
        }
        if p.Byte0 > p.Byte4 {
                return errors.New("p.Byte0 not valid, rule vt.le check failed")
        }
        if p.Byte0 <= p.Byte2 {
                return errors.New("p.Byte0 not valid, rule vt.gt check failed")
        }
        if p.Byte0 < p.Byte2 {
                return errors.New("p.Byte0 not valid, rule vt.ge check failed")
        }
        var _exist0 bool
        _src0 := []int8{p.Byte2, p.Byte3, p.Byte4}
        for _, src := range _src0 {
                if p.Byte0 == src {
                        _exist0 = true
                }
        }
        if _exist0 == false {
                return errors.New("p.Byte0 not valid, rule vt.in check failed")
        }
        _src1 := []int8{p.Byte2, p.Byte4}
        for _, src := range _src1 {
                if p.Byte0 == src {
                        {
                                return errors.New("p.Byte0 not valid, rule 
vt.not_in check failed")
                        }
                }
        }
        if p.Byte1 != nil {
                if *p.Byte1 >= p.Byte4 {
                        return errors.New("*p.Byte1 not valid, rule vt.lt check 
failed")
                }
                if *p.Byte1 > p.Byte4 {
                        return errors.New("*p.Byte1 not valid, rule vt.le check 
failed")
                }
                if *p.Byte1 <= p.Byte2 {
                        return errors.New("*p.Byte1 not valid, rule vt.gt check 
failed")
                }
                if *p.Byte1 < p.Byte2 {
                        return errors.New("*p.Byte1 not valid, rule vt.ge check 
failed")
                }
                var _exist1 bool
                _src2 := []int8{p.Byte2, p.Byte3, p.Byte4}
                for _, src := range _src2 {
                        if *p.Byte1 == src {
                                _exist1 = true
                        }
                }
                if _exist1 == false {
                        return errors.New("*p.Byte1 not valid, rule vt.in check 
failed")
                }
                _src3 := []int8{p.Byte2, p.Byte4}
                for _, src := range _src3 {
                        if *p.Byte1 == src {
                                {
                                        return errors.New("*p.Byte1 not valid, 
rule vt.not_in check failed")
                                }
                        }
                }
        }
        if p.Double0 >= p.Double4 {
                return errors.New("p.Double0 not valid, rule vt.const check 
failed")
        }
        if p.Double0 > p.Double4 {
                return errors.New("p.Double0 not valid, rule vt.const check 
failed")
        }
        if p.Double0 <= p.Double2 {
                return errors.New("p.Double0 not valid, rule vt.const check 
failed")
        }
        if p.Double0 < p.Double2 {
                return errors.New("p.Double0 not valid, rule vt.const check 
failed")
        }
        var _exist2 bool
        _src4 := []float64{p.Double2, p.Double3, p.Double4}
        for _, src := range _src4 {
                if p.Double0 == src {
                        _exist2 = true
                }
        }
        if _exist2 == false {
                return errors.New("p.Double0 not valid, rule vt.in check 
failed")
        }
        _src5 := []float64{p.Double2, p.Double4}
        for _, src := range _src5 {
                if p.Double0 == src {
                        return errors.New("p.Double0 not valid, rule vt.not_in 
check failed")
                }
        }
        if p.Double1 != nil {
                if *p.Double1 >= p.Double4 {
                        return errors.New("*p.Double1 not valid, rule vt.const 
check failed")
                }
                if *p.Double1 > p.Double4 {
                        return errors.New("*p.Double1 not valid, rule vt.const 
check failed")
                }
                if *p.Double1 <= p.Double2 {
                        return errors.New("*p.Double1 not valid, rule vt.const 
check failed")
                }
                if *p.Double1 < p.Double2 {
                        return errors.New("*p.Double1 not valid, rule vt.const 
check failed")
                }
                var _exist3 bool
                _src6 := []float64{p.Double2, p.Double3, p.Double4}
                for _, src := range _src6 {
                        if *p.Double1 == src {
                                _exist3 = true
                        }
                }
                if _exist3 == false {
                        return errors.New("*p.Double1 not valid, rule vt.in 
check failed")
                }
                _src7 := []float64{p.Double2, p.Double4}
                for _, src := range _src7 {
                        if *p.Double1 == src {
                                return errors.New("*p.Double1 not valid, rule 
vt.not_in check failed")
                        }
                }
        }
        if p.String0 != string(p.String2) {
                return errors.New("p.String0 not valid, rule vt.const check 
failed")
        }
        if len(p.String0) < int(p.Byte2) {
                return errors.New("p.String0 not valid, rule vt.min_size check 
failed")
        }
        if len(p.String0) > int(p.Byte3) {
                return errors.New("p.String0 not valid, rule vt.max_size check 
failed")
        }
        if ok, _ := regexp.MatchString(p.String0, string(p.String4)); ok {
                return errors.New("p.String0 not valid, rule vt.pattern check 
failed")
        }
        if !strings.HasPrefix(p.String0, string(p.String2)) {
                return errors.New("p.String0 not valid, rule vt.prefix check 
failed")
        }
        if !strings.HasSuffix(p.String0, string(p.String2)) {
                return errors.New("p.String0 not valid, rule vt.suffix check 
failed")
        }
        if !strings.Contains(p.String0, string(p.String2)) {
                return errors.New("p.String0 not valid, rule vt.contains check 
failed")
        }
        if strings.Contains(p.String0, string(p.String3)) {
                return errors.New("p.String0 not valid, rule vt.not_contains 
check failed")
        }
        if p.String1 != nil {
                if *p.String1 != string(p.String2) {
                        return errors.New("*p.String1 not valid, rule vt.const 
check failed")
                }
                if len(*p.String1) < int(p.Byte2) {
                        return errors.New("*p.String1 not valid, rule 
vt.min_size check failed")
                }
                if len(*p.String1) > int(p.Byte3) {
                        return errors.New("*p.String1 not valid, rule 
vt.max_size check failed")
                }
                if ok, _ := regexp.MatchString(*p.String1, string(p.String4)); 
ok {
                        return errors.New("*p.String1 not valid, rule 
vt.pattern check failed")
                }
                if !strings.HasPrefix(*p.String1, string(p.String2)) {
                        return errors.New("*p.String1 not valid, rule vt.prefix 
check failed")
                }
                if !strings.HasSuffix(*p.String1, string(p.String2)) {
                        return errors.New("*p.String1 not valid, rule vt.suffix 
check failed")
                }
                if !strings.Contains(*p.String1, string(p.String2)) {
                        return errors.New("*p.String1 not valid, rule 
vt.contains check failed")
                }
                if strings.Contains(*p.String1, string(p.String3)) {
                        return errors.New("*p.String1 not valid, rule 
vt.not_contains check failed")
                }
        }
        _tgt0 := string(p.Binary0)
        if _tgt0 != string(p.Binary2) {
                return errors.New("p.Binary0 not valid, rule vt.const check 
failed")
        }
        if len(_tgt0) < int(p.Byte2) {
                return errors.New("p.Binary0 not valid, rule vt.min_size check 
failed")
        }
        if len(_tgt0) > int(p.Byte3) {
                return errors.New("p.Binary0 not valid, rule vt.max_size check 
failed")
        }
        if ok, _ := regexp.MatchString(_tgt0, string(p.Binary4)); ok {
                return errors.New("p.Binary0 not valid, rule vt.pattern check 
failed")
        }
        if !strings.HasPrefix(_tgt0, string(p.Binary2)) {
                return errors.New("p.Binary0 not valid, rule vt.prefix check 
failed")
        }
        if !strings.HasSuffix(_tgt0, string(p.Binary2)) {
                return errors.New("p.Binary0 not valid, rule vt.suffix check 
failed")
        }
        if !strings.Contains(_tgt0, string(p.Binary2)) {
                return errors.New("p.Binary0 not valid, rule vt.contains check 
failed")
        }
        if strings.Contains(_tgt0, string(p.Binary3)) {
                return errors.New("p.Binary0 not valid, rule vt.not_contains 
check failed")
        }
        _tgt1 := string(p.Binary1)
        if _tgt1 != string(p.Binary2) {
                return errors.New("p.Binary1 not valid, rule vt.const check 
failed")
        }
        if len(_tgt1) < int(p.Byte2) {
                return errors.New("p.Binary1 not valid, rule vt.min_size check 
failed")
        }
        if len(_tgt1) > int(p.Byte3) {
                return errors.New("p.Binary1 not valid, rule vt.max_size check 
failed")
        }
        if ok, _ := regexp.MatchString(_tgt1, string(p.Binary4)); ok {
                return errors.New("p.Binary1 not valid, rule vt.pattern check 
failed")
        }
        if !strings.HasPrefix(_tgt1, string(p.Binary2)) {
                return errors.New("p.Binary1 not valid, rule vt.prefix check 
failed")
        }
        if !strings.HasSuffix(_tgt1, string(p.Binary2)) {
                return errors.New("p.Binary1 not valid, rule vt.suffix check 
failed")
        }
        if !strings.Contains(_tgt1, string(p.Binary2)) {
                return errors.New("p.Binary1 not valid, rule vt.contains check 
failed")
        }
        if strings.Contains(_tgt1, string(p.Binary3)) {
                return errors.New("p.Binary1 not valid, rule vt.not_contains 
check failed")
        }
        if len(p.Map0) < int(p.Byte2) {
                return errors.New("p.Map0 not valid, rule vt.min_size check 
failed")
        }
        if len(p.Map0) > int(p.Byte3) {
                return errors.New("p.Map0 not valid, rule vt.max_size check 
failed")
        }
        if len(p.Map1) < int(p.Byte2) {
                return errors.New("p.Map1 not valid, rule vt.min_size check 
failed")
        }
        if len(p.Map1) > int(p.Byte3) {
                return errors.New("p.Map1 not valid, rule vt.max_size check 
failed")
        }
        if len(p.List0) < int(p.Byte2) {
                return errors.New("p.List0 not valid, rule vt.min_size check 
failed")
        }
        if len(p.List0) > int(p.Byte3) {
                return errors.New("p.List0 not valid, rule vt.max_size check 
failed")
        }
        if len(p.List1) < int(p.Byte2) {
                return errors.New("p.List1 not valid, rule vt.min_size check 
failed")
        }
        if len(p.List1) > int(p.Byte3) {
                return errors.New("p.List1 not valid, rule vt.max_size check 
failed")
        }
        if len(p.Set0) < int(p.Byte2) {
                return errors.New("p.Set0 not valid, rule vt.min_size check 
failed")
        }
        if len(p.Set0) > int(p.Byte3) {
                return errors.New("p.Set0 not valid, rule vt.max_size check 
failed")
        }
        if len(p.Set1) < int(p.Byte2) {
                return errors.New("p.Set1 not valid, rule vt.min_size check 
failed")
        }
        if len(p.Set1) > int(p.Byte3) {
                return errors.New("p.Set1 not valid, rule vt.max_size check 
failed")
        }
        return nil
   }
   
   func (p *ValidationFunctionTest) IsValid() error {
        var _exist0 bool
        _src0 := []int64{int64(len(p.StringFoo))}
        for _, src := range _src0 {
                if p.StringLength == src {
                        _exist0 = true
                }
        }
        if _exist0 == false {
                return errors.New("p.StringLength not valid, rule vt.in check 
failed")
        }
        return nil
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to