Documentation ¶
Index ¶
- Variables
- func CallValidatorIfExists(candidate interface{}) error
- func FieldError(fieldName string, err error) error
- func IsFieldError(err error) bool
- type FieldValidator
- func (*FieldValidator) Descriptor() ([]byte, []int)
- func (m *FieldValidator) GetFloatEpsilon() float64
- func (m *FieldValidator) GetFloatGt() float64
- func (m *FieldValidator) GetFloatGte() float64
- func (m *FieldValidator) GetFloatLt() float64
- func (m *FieldValidator) GetFloatLte() float64
- func (m *FieldValidator) GetHumanError() string
- func (m *FieldValidator) GetIntGt() int64
- func (m *FieldValidator) GetIntLt() int64
- func (m *FieldValidator) GetIsInEnum() bool
- func (m *FieldValidator) GetLengthEq() int64
- func (m *FieldValidator) GetLengthGt() int64
- func (m *FieldValidator) GetLengthLt() int64
- func (m *FieldValidator) GetMsgExists() bool
- func (m *FieldValidator) GetRegex() string
- func (m *FieldValidator) GetRepeatedCountMax() int64
- func (m *FieldValidator) GetRepeatedCountMin() int64
- func (m *FieldValidator) GetRequired() bool
- func (m *FieldValidator) GetStringLengthEq() int64
- func (m *FieldValidator) GetStringLengthGt() int64
- func (m *FieldValidator) GetStringLengthLt() int64
- func (m *FieldValidator) GetStringNotEmpty() bool
- func (m *FieldValidator) GetUuidVer() int32
- func (m *FieldValidator) IsNil() bool
- func (*FieldValidator) ProtoMessage()
- func (m *FieldValidator) Reset()
- func (m *FieldValidator) SetFloatEpsilon_(val float64)
- func (m *FieldValidator) SetFloatGt_(val float64)
- func (m *FieldValidator) SetFloatGte_(val float64)
- func (m *FieldValidator) SetFloatLt_(val float64)
- func (m *FieldValidator) SetFloatLte_(val float64)
- func (m *FieldValidator) SetHumanError_(val string)
- func (m *FieldValidator) SetIntGt_(val int64)
- func (m *FieldValidator) SetIntLt_(val int64)
- func (m *FieldValidator) SetIsInEnum_(val bool)
- func (m *FieldValidator) SetLengthEq_(val int64)
- func (m *FieldValidator) SetLengthGt_(val int64)
- func (m *FieldValidator) SetLengthLt_(val int64)
- func (m *FieldValidator) SetMsgExists_(val bool)
- func (m *FieldValidator) SetRegex_(val string)
- func (m *FieldValidator) SetRepeatedCountMax_(val int64)
- func (m *FieldValidator) SetRepeatedCountMin_(val int64)
- func (m *FieldValidator) SetRequired_(val bool)
- func (m *FieldValidator) SetStringLengthEq_(val int64)
- func (m *FieldValidator) SetStringLengthGt_(val int64)
- func (m *FieldValidator) SetStringLengthLt_(val int64)
- func (m *FieldValidator) SetStringNotEmpty_(val bool)
- func (m *FieldValidator) SetUuidVer_(val int32)
- func (m *FieldValidator) String() string
- func (m *FieldValidator) XXX_DiscardUnknown()
- func (m *FieldValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FieldValidator) XXX_Merge(src proto.Message)
- func (m *FieldValidator) XXX_Size() int
- func (m *FieldValidator) XXX_Unmarshal(b []byte) error
- type OneofValidator
- func (*OneofValidator) Descriptor() ([]byte, []int)
- func (m *OneofValidator) GetRequired() bool
- func (m *OneofValidator) IsNil() bool
- func (*OneofValidator) ProtoMessage()
- func (m *OneofValidator) Reset()
- func (m *OneofValidator) SetRequired_(val bool)
- func (m *OneofValidator) String() string
- func (m *OneofValidator) XXX_DiscardUnknown()
- func (m *OneofValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *OneofValidator) XXX_Merge(src proto.Message)
- func (m *OneofValidator) XXX_Size() int
- func (m *OneofValidator) XXX_Unmarshal(b []byte) error
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var E_Field = &proto.ExtensionDesc{ ExtendedType: (*descriptor.FieldOptions)(nil), ExtensionType: (*FieldValidator)(nil), Field: 65020, Name: "validator.field", Tag: "bytes,65020,opt,name=field", Filename: "validator.proto", }
View Source
var E_Oneof = &proto.ExtensionDesc{ ExtendedType: (*descriptor.OneofOptions)(nil), ExtensionType: (*OneofValidator)(nil), Field: 65021, Name: "validator.oneof", Tag: "bytes,65021,opt,name=oneof", Filename: "validator.proto", }
Functions ¶
func CallValidatorIfExists ¶
func CallValidatorIfExists(candidate interface{}) error
func FieldError ¶
FieldError wraps a given Validator error providing a message call stack.
func IsFieldError ¶
Types ¶
type FieldValidator ¶
type FieldValidator struct { // Uses a Golang RE2-syntax regex to match the field contents. Regex *string `protobuf:"bytes,1,opt,name=regex" json:"regex,omitempty"` // Field value of integer strictly greater than this value. IntGt *int64 `protobuf:"varint,2,opt,name=int_gt,json=intGt" json:"int_gt,omitempty"` // Field value of integer strictly smaller than this value. IntLt *int64 `protobuf:"varint,3,opt,name=int_lt,json=intLt" json:"int_lt,omitempty"` // Used for nested message types, requires that the message type exists. MsgExists *bool `protobuf:"varint,4,opt,name=msg_exists,json=msgExists" json:"msg_exists,omitempty"` // 必填参数,参数非零值 Required *bool `protobuf:"varint,19,opt,name=required" json:"required,omitempty"` // Human error specifies a user-customizable error that is visible to the user. HumanError *string `protobuf:"bytes,5,opt,name=human_error,json=humanError" json:"human_error,omitempty"` // Field value of double strictly greater than this value. // Note that this value can only take on a valid floating point // value. Use together with float_epsilon if you need something more specific. FloatGt *float64 `protobuf:"fixed64,6,opt,name=float_gt,json=floatGt" json:"float_gt,omitempty"` // Field value of double strictly smaller than this value. // Note that this value can only take on a valid floating point // value. Use together with float_epsilon if you need something more specific. FloatLt *float64 `protobuf:"fixed64,7,opt,name=float_lt,json=floatLt" json:"float_lt,omitempty"` // Field value of double describing the epsilon within which // any comparison should be considered to be true. For example, // when using float_gt = 0.35, using a float_epsilon of 0.05 // would mean that any value above 0.30 is acceptable. It can be // thought of as a {float_value_condition} +- {float_epsilon}. // If unset, no correction for floating point inaccuracies in // comparisons will be attempted. FloatEpsilon *float64 `protobuf:"fixed64,8,opt,name=float_epsilon,json=floatEpsilon" json:"float_epsilon,omitempty"` // Floating-point value compared to which the field content should be greater or equal. FloatGte *float64 `protobuf:"fixed64,9,opt,name=float_gte,json=floatGte" json:"float_gte,omitempty"` // Floating-point value compared to which the field content should be smaller or equal. FloatLte *float64 `protobuf:"fixed64,10,opt,name=float_lte,json=floatLte" json:"float_lte,omitempty"` // Used for string fields, requires the string to be not empty (i.e different from ""). StringNotEmpty *bool `protobuf:"varint,11,opt,name=string_not_empty,json=stringNotEmpty" json:"string_not_empty,omitempty"` // Repeated field with at least this number of elements. RepeatedCountMin *int64 `protobuf:"varint,12,opt,name=repeated_count_min,json=repeatedCountMin" json:"repeated_count_min,omitempty"` // Repeated field with at most this number of elements. RepeatedCountMax *int64 `protobuf:"varint,13,opt,name=repeated_count_max,json=repeatedCountMax" json:"repeated_count_max,omitempty"` // Field value of length greater than this value. LengthGt *int64 `protobuf:"varint,14,opt,name=length_gt,json=lengthGt" json:"length_gt,omitempty"` // Field value of length smaller than this value. LengthLt *int64 `protobuf:"varint,15,opt,name=length_lt,json=lengthLt" json:"length_lt,omitempty"` // Field value of length strictly equal to this value. LengthEq *int64 `protobuf:"varint,16,opt,name=length_eq,json=lengthEq" json:"length_eq,omitempty"` // Requires that the value is in the enum. IsInEnum *bool `protobuf:"varint,17,opt,name=is_in_enum,json=isInEnum" json:"is_in_enum,omitempty"` // Ensures that a string value is in UUID format. // uuid_ver specifies the valid UUID versions. Valid values are: 0-5. // If uuid_ver is 0 all UUID versions are accepted. UuidVer *int32 `protobuf:"varint,18,opt,name=uuid_ver,json=uuidVer" json:"uuid_ver,omitempty"` // 字符串长度大于,属于字符串文字长度 StringLengthGt *int64 `protobuf:"varint,20,opt,name=string_length_gt,json=stringLengthGt" json:"string_length_gt,omitempty"` StringLengthLt *int64 `protobuf:"varint,21,opt,name=string_length_lt,json=stringLengthLt" json:"string_length_lt,omitempty"` StringLengthEq *int64 `protobuf:"varint,22,opt,name=string_length_eq,json=stringLengthEq" json:"string_length_eq,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
goTypeName:FieldValidator
func (*FieldValidator) Descriptor ¶
func (*FieldValidator) Descriptor() ([]byte, []int)
func (*FieldValidator) GetFloatEpsilon ¶
func (m *FieldValidator) GetFloatEpsilon() float64
func (*FieldValidator) GetFloatGt ¶
func (m *FieldValidator) GetFloatGt() float64
func (*FieldValidator) GetFloatGte ¶
func (m *FieldValidator) GetFloatGte() float64
func (*FieldValidator) GetFloatLt ¶
func (m *FieldValidator) GetFloatLt() float64
func (*FieldValidator) GetFloatLte ¶
func (m *FieldValidator) GetFloatLte() float64
func (*FieldValidator) GetHumanError ¶
func (m *FieldValidator) GetHumanError() string
func (*FieldValidator) GetIntGt ¶
func (m *FieldValidator) GetIntGt() int64
func (*FieldValidator) GetIntLt ¶
func (m *FieldValidator) GetIntLt() int64
func (*FieldValidator) GetIsInEnum ¶
func (m *FieldValidator) GetIsInEnum() bool
func (*FieldValidator) GetLengthEq ¶
func (m *FieldValidator) GetLengthEq() int64
func (*FieldValidator) GetLengthGt ¶
func (m *FieldValidator) GetLengthGt() int64
func (*FieldValidator) GetLengthLt ¶
func (m *FieldValidator) GetLengthLt() int64
func (*FieldValidator) GetMsgExists ¶
func (m *FieldValidator) GetMsgExists() bool
func (*FieldValidator) GetRegex ¶
func (m *FieldValidator) GetRegex() string
func (*FieldValidator) GetRepeatedCountMax ¶
func (m *FieldValidator) GetRepeatedCountMax() int64
func (*FieldValidator) GetRepeatedCountMin ¶
func (m *FieldValidator) GetRepeatedCountMin() int64
func (*FieldValidator) GetRequired ¶
func (m *FieldValidator) GetRequired() bool
func (*FieldValidator) GetStringLengthEq ¶
func (m *FieldValidator) GetStringLengthEq() int64
func (*FieldValidator) GetStringLengthGt ¶
func (m *FieldValidator) GetStringLengthGt() int64
func (*FieldValidator) GetStringLengthLt ¶
func (m *FieldValidator) GetStringLengthLt() int64
func (*FieldValidator) GetStringNotEmpty ¶
func (m *FieldValidator) GetStringNotEmpty() bool
func (*FieldValidator) GetUuidVer ¶
func (m *FieldValidator) GetUuidVer() int32
func (*FieldValidator) IsNil ¶
func (m *FieldValidator) IsNil() bool
func (*FieldValidator) ProtoMessage ¶
func (*FieldValidator) ProtoMessage()
func (*FieldValidator) Reset ¶
func (m *FieldValidator) Reset()
func (*FieldValidator) SetFloatEpsilon_ ¶
func (m *FieldValidator) SetFloatEpsilon_(val float64)
func (*FieldValidator) SetFloatGt_ ¶
func (m *FieldValidator) SetFloatGt_(val float64)
func (*FieldValidator) SetFloatGte_ ¶
func (m *FieldValidator) SetFloatGte_(val float64)
func (*FieldValidator) SetFloatLt_ ¶
func (m *FieldValidator) SetFloatLt_(val float64)
func (*FieldValidator) SetFloatLte_ ¶
func (m *FieldValidator) SetFloatLte_(val float64)
func (*FieldValidator) SetHumanError_ ¶
func (m *FieldValidator) SetHumanError_(val string)
func (*FieldValidator) SetIntGt_ ¶
func (m *FieldValidator) SetIntGt_(val int64)
func (*FieldValidator) SetIntLt_ ¶
func (m *FieldValidator) SetIntLt_(val int64)
func (*FieldValidator) SetIsInEnum_ ¶
func (m *FieldValidator) SetIsInEnum_(val bool)
func (*FieldValidator) SetLengthEq_ ¶
func (m *FieldValidator) SetLengthEq_(val int64)
func (*FieldValidator) SetLengthGt_ ¶
func (m *FieldValidator) SetLengthGt_(val int64)
func (*FieldValidator) SetLengthLt_ ¶
func (m *FieldValidator) SetLengthLt_(val int64)
func (*FieldValidator) SetMsgExists_ ¶
func (m *FieldValidator) SetMsgExists_(val bool)
func (*FieldValidator) SetRegex_ ¶
func (m *FieldValidator) SetRegex_(val string)
func (*FieldValidator) SetRepeatedCountMax_ ¶
func (m *FieldValidator) SetRepeatedCountMax_(val int64)
func (*FieldValidator) SetRepeatedCountMin_ ¶
func (m *FieldValidator) SetRepeatedCountMin_(val int64)
func (*FieldValidator) SetRequired_ ¶
func (m *FieldValidator) SetRequired_(val bool)
func (*FieldValidator) SetStringLengthEq_ ¶
func (m *FieldValidator) SetStringLengthEq_(val int64)
func (*FieldValidator) SetStringLengthGt_ ¶
func (m *FieldValidator) SetStringLengthGt_(val int64)
func (*FieldValidator) SetStringLengthLt_ ¶
func (m *FieldValidator) SetStringLengthLt_(val int64)
func (*FieldValidator) SetStringNotEmpty_ ¶
func (m *FieldValidator) SetStringNotEmpty_(val bool)
func (*FieldValidator) SetUuidVer_ ¶
func (m *FieldValidator) SetUuidVer_(val int32)
func (*FieldValidator) String ¶
func (m *FieldValidator) String() string
func (*FieldValidator) XXX_DiscardUnknown ¶
func (m *FieldValidator) XXX_DiscardUnknown()
func (*FieldValidator) XXX_Marshal ¶
func (m *FieldValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FieldValidator) XXX_Merge ¶
func (m *FieldValidator) XXX_Merge(src proto.Message)
func (*FieldValidator) XXX_Size ¶
func (m *FieldValidator) XXX_Size() int
func (*FieldValidator) XXX_Unmarshal ¶
func (m *FieldValidator) XXX_Unmarshal(b []byte) error
type OneofValidator ¶
type OneofValidator struct { // Require that one of the oneof fields is set. Required *bool `protobuf:"varint,1,opt,name=required" json:"required,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
goTypeName:OneofValidator
func (*OneofValidator) Descriptor ¶
func (*OneofValidator) Descriptor() ([]byte, []int)
func (*OneofValidator) GetRequired ¶
func (m *OneofValidator) GetRequired() bool
func (*OneofValidator) IsNil ¶
func (m *OneofValidator) IsNil() bool
func (*OneofValidator) ProtoMessage ¶
func (*OneofValidator) ProtoMessage()
func (*OneofValidator) Reset ¶
func (m *OneofValidator) Reset()
func (*OneofValidator) SetRequired_ ¶
func (m *OneofValidator) SetRequired_(val bool)
func (*OneofValidator) String ¶
func (m *OneofValidator) String() string
func (*OneofValidator) XXX_DiscardUnknown ¶
func (m *OneofValidator) XXX_DiscardUnknown()
func (*OneofValidator) XXX_Marshal ¶
func (m *OneofValidator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*OneofValidator) XXX_Merge ¶
func (m *OneofValidator) XXX_Merge(src proto.Message)
func (*OneofValidator) XXX_Size ¶
func (m *OneofValidator) XXX_Size() int
func (*OneofValidator) XXX_Unmarshal ¶
func (m *OneofValidator) XXX_Unmarshal(b []byte) error
Directories ¶
Path | Synopsis |
---|---|
The validator plugin generates a Validate method for each message.
|
The validator plugin generates a Validate method for each message. |
Click to show internal directories.
Click to hide internal directories.