Documentation ¶
Index ¶
- Variables
- func FieldError(fieldName string, err error) error
- type FieldValidators
- func (*FieldValidators) Descriptor() ([]byte, []int)
- func (m *FieldValidators) GetFloatEpsilon() float64
- func (m *FieldValidators) GetFloatGt() float64
- func (m *FieldValidators) GetFloatGte() float64
- func (m *FieldValidators) GetFloatLt() float64
- func (m *FieldValidators) GetFloatLte() float64
- func (m *FieldValidators) GetHumanError() string
- func (m *FieldValidators) GetIntGt() int64
- func (m *FieldValidators) GetIntLt() int64
- func (m *FieldValidators) GetIsInEnum() bool
- func (m *FieldValidators) GetIsPassword() bool
- func (m *FieldValidators) GetLengthEq() int64
- func (m *FieldValidators) GetLengthGt() int64
- func (m *FieldValidators) GetLengthLt() int64
- func (m *FieldValidators) GetMsgExists() bool
- func (m *FieldValidators) GetRegex() string
- func (m *FieldValidators) GetRepeatedCountMax() int64
- func (m *FieldValidators) GetRepeatedCountMin() int64
- func (m *FieldValidators) GetStringNotEmpty() bool
- func (m *FieldValidators) GetUuidVer() int32
- func (*FieldValidators) ProtoMessage()
- func (m *FieldValidators) Reset()
- func (m *FieldValidators) String() string
- func (m *FieldValidators) XXX_DiscardUnknown()
- func (m *FieldValidators) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *FieldValidators) XXX_Merge(src proto.Message)
- func (m *FieldValidators) XXX_Size() int
- func (m *FieldValidators) XXX_Unmarshal(b []byte) error
- type MultiError
- type OneofValidators
- func (*OneofValidators) Descriptor() ([]byte, []int)
- func (m *OneofValidators) GetRequired() bool
- func (*OneofValidators) ProtoMessage()
- func (m *OneofValidators) Reset()
- func (m *OneofValidators) String() string
- func (m *OneofValidators) XXX_DiscardUnknown()
- func (m *OneofValidators) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *OneofValidators) XXX_Merge(src proto.Message)
- func (m *OneofValidators) XXX_Size() int
- func (m *OneofValidators) XXX_Unmarshal(b []byte) error
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var E_Fields = &proto.ExtensionDesc{ ExtendedType: (*descriptor.FieldOptions)(nil), ExtensionType: (*FieldValidators)(nil), Field: 65030, Name: "validator.fields", Tag: "bytes,65030,opt,name=fields", Filename: "validator.proto", }
View Source
var E_Oneofs = &proto.ExtensionDesc{ ExtendedType: (*descriptor.OneofOptions)(nil), ExtensionType: (*OneofValidators)(nil), Field: 65031, Name: "validator.oneofs", Tag: "bytes,65031,opt,name=oneofs", Filename: "validator.proto", }
Functions ¶
func FieldError ¶
FieldError wraps a given Validator error providing a message call stack.
Types ¶
type FieldValidators ¶
type FieldValidators 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"` // 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"` //Ensure that a string value is follow password rules. IsPassword *bool `protobuf:"varint,19,opt,name=is_password,json=isPassword" json:"is_password,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*FieldValidators) Descriptor ¶
func (*FieldValidators) Descriptor() ([]byte, []int)
func (*FieldValidators) GetFloatEpsilon ¶
func (m *FieldValidators) GetFloatEpsilon() float64
func (*FieldValidators) GetFloatGt ¶
func (m *FieldValidators) GetFloatGt() float64
func (*FieldValidators) GetFloatGte ¶
func (m *FieldValidators) GetFloatGte() float64
func (*FieldValidators) GetFloatLt ¶
func (m *FieldValidators) GetFloatLt() float64
func (*FieldValidators) GetFloatLte ¶
func (m *FieldValidators) GetFloatLte() float64
func (*FieldValidators) GetHumanError ¶
func (m *FieldValidators) GetHumanError() string
func (*FieldValidators) GetIntGt ¶
func (m *FieldValidators) GetIntGt() int64
func (*FieldValidators) GetIntLt ¶
func (m *FieldValidators) GetIntLt() int64
func (*FieldValidators) GetIsInEnum ¶
func (m *FieldValidators) GetIsInEnum() bool
func (*FieldValidators) GetIsPassword ¶ added in v0.3.4
func (m *FieldValidators) GetIsPassword() bool
func (*FieldValidators) GetLengthEq ¶
func (m *FieldValidators) GetLengthEq() int64
func (*FieldValidators) GetLengthGt ¶
func (m *FieldValidators) GetLengthGt() int64
func (*FieldValidators) GetLengthLt ¶
func (m *FieldValidators) GetLengthLt() int64
func (*FieldValidators) GetMsgExists ¶
func (m *FieldValidators) GetMsgExists() bool
func (*FieldValidators) GetRegex ¶
func (m *FieldValidators) GetRegex() string
func (*FieldValidators) GetRepeatedCountMax ¶
func (m *FieldValidators) GetRepeatedCountMax() int64
func (*FieldValidators) GetRepeatedCountMin ¶
func (m *FieldValidators) GetRepeatedCountMin() int64
func (*FieldValidators) GetStringNotEmpty ¶
func (m *FieldValidators) GetStringNotEmpty() bool
func (*FieldValidators) GetUuidVer ¶
func (m *FieldValidators) GetUuidVer() int32
func (*FieldValidators) ProtoMessage ¶
func (*FieldValidators) ProtoMessage()
func (*FieldValidators) Reset ¶
func (m *FieldValidators) Reset()
func (*FieldValidators) String ¶
func (m *FieldValidators) String() string
func (*FieldValidators) XXX_DiscardUnknown ¶
func (m *FieldValidators) XXX_DiscardUnknown()
func (*FieldValidators) XXX_Marshal ¶
func (m *FieldValidators) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*FieldValidators) XXX_Merge ¶
func (m *FieldValidators) XXX_Merge(src proto.Message)
func (*FieldValidators) XXX_Size ¶
func (m *FieldValidators) XXX_Size() int
func (*FieldValidators) XXX_Unmarshal ¶
func (m *FieldValidators) XXX_Unmarshal(b []byte) error
type MultiError ¶
type MultiError struct {
// contains filtered or unexported fields
}
MultiError model
func CallValidatorIfExists ¶
func CallValidatorIfExists(candidate interface{}) *MultiError
func (*MultiError) Append ¶
func (m *MultiError) Append(key string, err error)
Append error to multierror
func (*MultiError) RPCError ¶
func (m *MultiError) RPCError() error
func (*MultiError) ToMap ¶
func (m *MultiError) ToMap() map[string]string
ToMap return list map of error
type OneofValidators ¶
type OneofValidators 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:"-"` }
func (*OneofValidators) Descriptor ¶
func (*OneofValidators) Descriptor() ([]byte, []int)
func (*OneofValidators) GetRequired ¶
func (m *OneofValidators) GetRequired() bool
func (*OneofValidators) ProtoMessage ¶
func (*OneofValidators) ProtoMessage()
func (*OneofValidators) Reset ¶
func (m *OneofValidators) Reset()
func (*OneofValidators) String ¶
func (m *OneofValidators) String() string
func (*OneofValidators) XXX_DiscardUnknown ¶
func (m *OneofValidators) XXX_DiscardUnknown()
func (*OneofValidators) XXX_Marshal ¶
func (m *OneofValidators) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*OneofValidators) XXX_Merge ¶
func (m *OneofValidators) XXX_Merge(src proto.Message)
func (*OneofValidators) XXX_Size ¶
func (m *OneofValidators) XXX_Size() int
func (*OneofValidators) XXX_Unmarshal ¶
func (m *OneofValidators) XXX_Unmarshal(b []byte) error
type Validator ¶
type Validator interface {
Validate(all bool) *MultiError
}
Validator is a general interface that allows a message to be validated.
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.