github.com/gogf/gf/v2@v2.7.4/util/gvalid/internal/builtin/builtin_eq.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/gogf/gf.
     6  
     7  package builtin
     8  
     9  // RuleEq implements `eq` rule:
    10  // Value should be the same as value of field.
    11  //
    12  // This rule performs the same as rule `same`.
    13  //
    14  // Format: eq:field
    15  type RuleEq struct{}
    16  
    17  func init() {
    18  	Register(RuleEq{})
    19  }
    20  
    21  func (r RuleEq) Name() string {
    22  	return "eq"
    23  }
    24  
    25  func (r RuleEq) Message() string {
    26  	return "The {field} value `{value}` must be equal to field {field1} value `{value1}`"
    27  }
    28  
    29  func (r RuleEq) Run(in RunInput) error {
    30  	return RuleSame{}.Run(in)
    31  }