You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3750 lines
96 KiB
3750 lines
96 KiB
2 years ago
|
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
||
|
// source: validate/validate.proto
|
||
|
|
||
|
package validate
|
||
|
|
||
|
import (
|
||
|
"bytes"
|
||
|
"errors"
|
||
|
"fmt"
|
||
|
"net"
|
||
|
"net/mail"
|
||
|
"net/url"
|
||
|
"regexp"
|
||
|
"sort"
|
||
|
"strings"
|
||
|
"time"
|
||
|
"unicode/utf8"
|
||
|
|
||
|
"google.golang.org/protobuf/types/known/anypb"
|
||
|
)
|
||
|
|
||
|
// ensure the imports are used
|
||
|
var (
|
||
|
_ = bytes.MinRead
|
||
|
_ = errors.New("")
|
||
|
_ = fmt.Print
|
||
|
_ = utf8.UTFMax
|
||
|
_ = (*regexp.Regexp)(nil)
|
||
|
_ = (*strings.Reader)(nil)
|
||
|
_ = net.IPv4len
|
||
|
_ = time.Duration(0)
|
||
|
_ = (*url.URL)(nil)
|
||
|
_ = (*mail.Address)(nil)
|
||
|
_ = anypb.Any{}
|
||
|
_ = sort.Sort
|
||
|
)
|
||
|
|
||
|
// Validate checks the field values on FieldRules with the rules defined in the
|
||
|
// proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *FieldRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on FieldRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in FieldRulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *FieldRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *FieldRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetMessage()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Message",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Message",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetMessage()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Message",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
switch m.Type.(type) {
|
||
|
|
||
|
case *FieldRules_Float:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetFloat()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Float",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Float",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetFloat()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Float",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Double:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetDouble()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Double",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Double",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetDouble()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Double",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Int32:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetInt32()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Int32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Int32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetInt32()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Int32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Int64:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetInt64()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Int64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Int64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetInt64()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Int64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Uint32:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetUint32()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Uint32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Uint32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetUint32()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Uint32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Uint64:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetUint64()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Uint64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Uint64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetUint64()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Uint64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Sint32:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetSint32()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Sint32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Sint32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetSint32()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Sint32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Sint64:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetSint64()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Sint64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Sint64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetSint64()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Sint64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Fixed32:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetFixed32()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Fixed32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Fixed32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetFixed32()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Fixed32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Fixed64:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetFixed64()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Fixed64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Fixed64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetFixed64()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Fixed64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Sfixed32:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetSfixed32()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Sfixed32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Sfixed32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetSfixed32()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Sfixed32",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Sfixed64:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetSfixed64()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Sfixed64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Sfixed64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetSfixed64()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Sfixed64",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Bool:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetBool()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Bool",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Bool",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetBool()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Bool",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_String_:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetString_()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "String_",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "String_",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetString_()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "String_",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Bytes:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetBytes()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Bytes",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Bytes",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetBytes()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Bytes",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Enum:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetEnum()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Enum",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Enum",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetEnum()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Enum",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Repeated:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetRepeated()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Repeated",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Repeated",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetRepeated()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Repeated",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Map:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetMap()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Map",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Map",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetMap()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Map",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Any:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetAny()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Any",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Any",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetAny()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Any",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Duration:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetDuration()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Duration",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Duration",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetDuration()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Duration",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
case *FieldRules_Timestamp:
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetTimestamp()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Timestamp",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, FieldRulesValidationError{
|
||
|
field: "Timestamp",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetTimestamp()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return FieldRulesValidationError{
|
||
|
field: "Timestamp",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return FieldRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// FieldRulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by FieldRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type FieldRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m FieldRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m FieldRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// FieldRulesValidationError is the validation error returned by
|
||
|
// FieldRules.Validate if the designated constraints aren't met.
|
||
|
type FieldRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e FieldRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e FieldRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e FieldRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e FieldRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e FieldRulesValidationError) ErrorName() string { return "FieldRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e FieldRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sFieldRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = FieldRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = FieldRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on FloatRules with the rules defined in the
|
||
|
// proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *FloatRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on FloatRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in FloatRulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *FloatRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *FloatRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return FloatRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// FloatRulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by FloatRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type FloatRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m FloatRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m FloatRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// FloatRulesValidationError is the validation error returned by
|
||
|
// FloatRules.Validate if the designated constraints aren't met.
|
||
|
type FloatRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e FloatRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e FloatRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e FloatRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e FloatRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e FloatRulesValidationError) ErrorName() string { return "FloatRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e FloatRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sFloatRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = FloatRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = FloatRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on DoubleRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *DoubleRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on DoubleRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in DoubleRulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *DoubleRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *DoubleRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return DoubleRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// DoubleRulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by DoubleRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type DoubleRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m DoubleRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m DoubleRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// DoubleRulesValidationError is the validation error returned by
|
||
|
// DoubleRules.Validate if the designated constraints aren't met.
|
||
|
type DoubleRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e DoubleRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e DoubleRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e DoubleRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e DoubleRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e DoubleRulesValidationError) ErrorName() string { return "DoubleRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e DoubleRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sDoubleRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = DoubleRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = DoubleRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on Int32Rules with the rules defined in the
|
||
|
// proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *Int32Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on Int32Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in Int32RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *Int32Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *Int32Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return Int32RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// Int32RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by Int32Rules.ValidateAll() if the designated constraints aren't met.
|
||
|
type Int32RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m Int32RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m Int32RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// Int32RulesValidationError is the validation error returned by
|
||
|
// Int32Rules.Validate if the designated constraints aren't met.
|
||
|
type Int32RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e Int32RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e Int32RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e Int32RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e Int32RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e Int32RulesValidationError) ErrorName() string { return "Int32RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e Int32RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sInt32Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = Int32RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = Int32RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on Int64Rules with the rules defined in the
|
||
|
// proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *Int64Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on Int64Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in Int64RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *Int64Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *Int64Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return Int64RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// Int64RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by Int64Rules.ValidateAll() if the designated constraints aren't met.
|
||
|
type Int64RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m Int64RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m Int64RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// Int64RulesValidationError is the validation error returned by
|
||
|
// Int64Rules.Validate if the designated constraints aren't met.
|
||
|
type Int64RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e Int64RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e Int64RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e Int64RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e Int64RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e Int64RulesValidationError) ErrorName() string { return "Int64RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e Int64RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sInt64Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = Int64RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = Int64RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on UInt32Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *UInt32Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on UInt32Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in UInt32RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *UInt32Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *UInt32Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return UInt32RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// UInt32RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by UInt32Rules.ValidateAll() if the designated constraints aren't met.
|
||
|
type UInt32RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m UInt32RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m UInt32RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// UInt32RulesValidationError is the validation error returned by
|
||
|
// UInt32Rules.Validate if the designated constraints aren't met.
|
||
|
type UInt32RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e UInt32RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e UInt32RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e UInt32RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e UInt32RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e UInt32RulesValidationError) ErrorName() string { return "UInt32RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e UInt32RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sUInt32Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = UInt32RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = UInt32RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on UInt64Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *UInt64Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on UInt64Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in UInt64RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *UInt64Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *UInt64Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return UInt64RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// UInt64RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by UInt64Rules.ValidateAll() if the designated constraints aren't met.
|
||
|
type UInt64RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m UInt64RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m UInt64RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// UInt64RulesValidationError is the validation error returned by
|
||
|
// UInt64Rules.Validate if the designated constraints aren't met.
|
||
|
type UInt64RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e UInt64RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e UInt64RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e UInt64RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e UInt64RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e UInt64RulesValidationError) ErrorName() string { return "UInt64RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e UInt64RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sUInt64Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = UInt64RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = UInt64RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on SInt32Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *SInt32Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on SInt32Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in SInt32RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *SInt32Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *SInt32Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return SInt32RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// SInt32RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by SInt32Rules.ValidateAll() if the designated constraints aren't met.
|
||
|
type SInt32RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m SInt32RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m SInt32RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// SInt32RulesValidationError is the validation error returned by
|
||
|
// SInt32Rules.Validate if the designated constraints aren't met.
|
||
|
type SInt32RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e SInt32RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e SInt32RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e SInt32RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e SInt32RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e SInt32RulesValidationError) ErrorName() string { return "SInt32RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e SInt32RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sSInt32Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = SInt32RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = SInt32RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on SInt64Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *SInt64Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on SInt64Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in SInt64RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *SInt64Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *SInt64Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return SInt64RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// SInt64RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by SInt64Rules.ValidateAll() if the designated constraints aren't met.
|
||
|
type SInt64RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m SInt64RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m SInt64RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// SInt64RulesValidationError is the validation error returned by
|
||
|
// SInt64Rules.Validate if the designated constraints aren't met.
|
||
|
type SInt64RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e SInt64RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e SInt64RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e SInt64RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e SInt64RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e SInt64RulesValidationError) ErrorName() string { return "SInt64RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e SInt64RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sSInt64Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = SInt64RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = SInt64RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on Fixed32Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *Fixed32Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on Fixed32Rules with the rules defined
|
||
|
// in the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in Fixed32RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *Fixed32Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *Fixed32Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return Fixed32RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// Fixed32RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by Fixed32Rules.ValidateAll() if the designated constraints aren't met.
|
||
|
type Fixed32RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m Fixed32RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m Fixed32RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// Fixed32RulesValidationError is the validation error returned by
|
||
|
// Fixed32Rules.Validate if the designated constraints aren't met.
|
||
|
type Fixed32RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e Fixed32RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e Fixed32RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e Fixed32RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e Fixed32RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e Fixed32RulesValidationError) ErrorName() string { return "Fixed32RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e Fixed32RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sFixed32Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = Fixed32RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = Fixed32RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on Fixed64Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *Fixed64Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on Fixed64Rules with the rules defined
|
||
|
// in the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in Fixed64RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *Fixed64Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *Fixed64Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return Fixed64RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// Fixed64RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by Fixed64Rules.ValidateAll() if the designated constraints aren't met.
|
||
|
type Fixed64RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m Fixed64RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m Fixed64RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// Fixed64RulesValidationError is the validation error returned by
|
||
|
// Fixed64Rules.Validate if the designated constraints aren't met.
|
||
|
type Fixed64RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e Fixed64RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e Fixed64RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e Fixed64RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e Fixed64RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e Fixed64RulesValidationError) ErrorName() string { return "Fixed64RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e Fixed64RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sFixed64Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = Fixed64RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = Fixed64RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on SFixed32Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *SFixed32Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on SFixed32Rules with the rules defined
|
||
|
// in the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in SFixed32RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *SFixed32Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *SFixed32Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return SFixed32RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// SFixed32RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by SFixed32Rules.ValidateAll() if the designated constraints
|
||
|
// aren't met.
|
||
|
type SFixed32RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m SFixed32RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m SFixed32RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// SFixed32RulesValidationError is the validation error returned by
|
||
|
// SFixed32Rules.Validate if the designated constraints aren't met.
|
||
|
type SFixed32RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e SFixed32RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e SFixed32RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e SFixed32RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e SFixed32RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e SFixed32RulesValidationError) ErrorName() string { return "SFixed32RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e SFixed32RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sSFixed32Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = SFixed32RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = SFixed32RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on SFixed64Rules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *SFixed64Rules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on SFixed64Rules with the rules defined
|
||
|
// in the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in SFixed64RulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *SFixed64Rules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *SFixed64Rules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Lt
|
||
|
|
||
|
// no validation rules for Lte
|
||
|
|
||
|
// no validation rules for Gt
|
||
|
|
||
|
// no validation rules for Gte
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return SFixed64RulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// SFixed64RulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by SFixed64Rules.ValidateAll() if the designated constraints
|
||
|
// aren't met.
|
||
|
type SFixed64RulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m SFixed64RulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m SFixed64RulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// SFixed64RulesValidationError is the validation error returned by
|
||
|
// SFixed64Rules.Validate if the designated constraints aren't met.
|
||
|
type SFixed64RulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e SFixed64RulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e SFixed64RulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e SFixed64RulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e SFixed64RulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e SFixed64RulesValidationError) ErrorName() string { return "SFixed64RulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e SFixed64RulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sSFixed64Rules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = SFixed64RulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = SFixed64RulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on BoolRules with the rules defined in the
|
||
|
// proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *BoolRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on BoolRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in BoolRulesMultiError, or nil
|
||
|
// if none found.
|
||
|
func (m *BoolRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *BoolRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return BoolRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// BoolRulesMultiError is an error wrapping multiple validation errors returned
|
||
|
// by BoolRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type BoolRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m BoolRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m BoolRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// BoolRulesValidationError is the validation error returned by
|
||
|
// BoolRules.Validate if the designated constraints aren't met.
|
||
|
type BoolRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e BoolRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e BoolRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e BoolRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e BoolRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e BoolRulesValidationError) ErrorName() string { return "BoolRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e BoolRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sBoolRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = BoolRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = BoolRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on StringRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *StringRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on StringRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in StringRulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *StringRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *StringRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Len
|
||
|
|
||
|
// no validation rules for MinLen
|
||
|
|
||
|
// no validation rules for MaxLen
|
||
|
|
||
|
// no validation rules for LenBytes
|
||
|
|
||
|
// no validation rules for MinBytes
|
||
|
|
||
|
// no validation rules for MaxBytes
|
||
|
|
||
|
// no validation rules for Pattern
|
||
|
|
||
|
// no validation rules for Prefix
|
||
|
|
||
|
// no validation rules for Suffix
|
||
|
|
||
|
// no validation rules for Contains
|
||
|
|
||
|
// no validation rules for NotContains
|
||
|
|
||
|
// no validation rules for Strict
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
switch m.WellKnown.(type) {
|
||
|
|
||
|
case *StringRules_Email:
|
||
|
// no validation rules for Email
|
||
|
|
||
|
case *StringRules_Hostname:
|
||
|
// no validation rules for Hostname
|
||
|
|
||
|
case *StringRules_Ip:
|
||
|
// no validation rules for Ip
|
||
|
|
||
|
case *StringRules_Ipv4:
|
||
|
// no validation rules for Ipv4
|
||
|
|
||
|
case *StringRules_Ipv6:
|
||
|
// no validation rules for Ipv6
|
||
|
|
||
|
case *StringRules_Uri:
|
||
|
// no validation rules for Uri
|
||
|
|
||
|
case *StringRules_UriRef:
|
||
|
// no validation rules for UriRef
|
||
|
|
||
|
case *StringRules_Address:
|
||
|
// no validation rules for Address
|
||
|
|
||
|
case *StringRules_Uuid:
|
||
|
// no validation rules for Uuid
|
||
|
|
||
|
case *StringRules_WellKnownRegex:
|
||
|
// no validation rules for WellKnownRegex
|
||
|
|
||
|
}
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return StringRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// StringRulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by StringRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type StringRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m StringRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m StringRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// StringRulesValidationError is the validation error returned by
|
||
|
// StringRules.Validate if the designated constraints aren't met.
|
||
|
type StringRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e StringRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e StringRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e StringRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e StringRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e StringRulesValidationError) ErrorName() string { return "StringRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e StringRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sStringRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = StringRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = StringRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on BytesRules with the rules defined in the
|
||
|
// proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *BytesRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on BytesRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in BytesRulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *BytesRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *BytesRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for Len
|
||
|
|
||
|
// no validation rules for MinLen
|
||
|
|
||
|
// no validation rules for MaxLen
|
||
|
|
||
|
// no validation rules for Pattern
|
||
|
|
||
|
// no validation rules for Prefix
|
||
|
|
||
|
// no validation rules for Suffix
|
||
|
|
||
|
// no validation rules for Contains
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
switch m.WellKnown.(type) {
|
||
|
|
||
|
case *BytesRules_Ip:
|
||
|
// no validation rules for Ip
|
||
|
|
||
|
case *BytesRules_Ipv4:
|
||
|
// no validation rules for Ipv4
|
||
|
|
||
|
case *BytesRules_Ipv6:
|
||
|
// no validation rules for Ipv6
|
||
|
|
||
|
}
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return BytesRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// BytesRulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by BytesRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type BytesRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m BytesRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m BytesRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// BytesRulesValidationError is the validation error returned by
|
||
|
// BytesRules.Validate if the designated constraints aren't met.
|
||
|
type BytesRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e BytesRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e BytesRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e BytesRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e BytesRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e BytesRulesValidationError) ErrorName() string { return "BytesRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e BytesRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sBytesRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = BytesRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = BytesRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on EnumRules with the rules defined in the
|
||
|
// proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *EnumRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on EnumRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in EnumRulesMultiError, or nil
|
||
|
// if none found.
|
||
|
func (m *EnumRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *EnumRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Const
|
||
|
|
||
|
// no validation rules for DefinedOnly
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return EnumRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// EnumRulesMultiError is an error wrapping multiple validation errors returned
|
||
|
// by EnumRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type EnumRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m EnumRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m EnumRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// EnumRulesValidationError is the validation error returned by
|
||
|
// EnumRules.Validate if the designated constraints aren't met.
|
||
|
type EnumRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e EnumRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e EnumRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e EnumRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e EnumRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e EnumRulesValidationError) ErrorName() string { return "EnumRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e EnumRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sEnumRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = EnumRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = EnumRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on MessageRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *MessageRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on MessageRules with the rules defined
|
||
|
// in the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in MessageRulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *MessageRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *MessageRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Skip
|
||
|
|
||
|
// no validation rules for Required
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return MessageRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// MessageRulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by MessageRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type MessageRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m MessageRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m MessageRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// MessageRulesValidationError is the validation error returned by
|
||
|
// MessageRules.Validate if the designated constraints aren't met.
|
||
|
type MessageRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e MessageRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e MessageRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e MessageRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e MessageRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e MessageRulesValidationError) ErrorName() string { return "MessageRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e MessageRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sMessageRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = MessageRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = MessageRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on RepeatedRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *RepeatedRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on RepeatedRules with the rules defined
|
||
|
// in the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in RepeatedRulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *RepeatedRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *RepeatedRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for MinItems
|
||
|
|
||
|
// no validation rules for MaxItems
|
||
|
|
||
|
// no validation rules for Unique
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetItems()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, RepeatedRulesValidationError{
|
||
|
field: "Items",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, RepeatedRulesValidationError{
|
||
|
field: "Items",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetItems()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return RepeatedRulesValidationError{
|
||
|
field: "Items",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return RepeatedRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// RepeatedRulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by RepeatedRules.ValidateAll() if the designated constraints
|
||
|
// aren't met.
|
||
|
type RepeatedRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m RepeatedRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m RepeatedRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// RepeatedRulesValidationError is the validation error returned by
|
||
|
// RepeatedRules.Validate if the designated constraints aren't met.
|
||
|
type RepeatedRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e RepeatedRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e RepeatedRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e RepeatedRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e RepeatedRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e RepeatedRulesValidationError) ErrorName() string { return "RepeatedRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e RepeatedRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sRepeatedRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = RepeatedRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = RepeatedRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on MapRules with the rules defined in the
|
||
|
// proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *MapRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on MapRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in MapRulesMultiError, or nil
|
||
|
// if none found.
|
||
|
func (m *MapRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *MapRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for MinPairs
|
||
|
|
||
|
// no validation rules for MaxPairs
|
||
|
|
||
|
// no validation rules for NoSparse
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetKeys()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, MapRulesValidationError{
|
||
|
field: "Keys",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, MapRulesValidationError{
|
||
|
field: "Keys",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetKeys()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return MapRulesValidationError{
|
||
|
field: "Keys",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetValues()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, MapRulesValidationError{
|
||
|
field: "Values",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, MapRulesValidationError{
|
||
|
field: "Values",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetValues()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return MapRulesValidationError{
|
||
|
field: "Values",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// no validation rules for IgnoreEmpty
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return MapRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// MapRulesMultiError is an error wrapping multiple validation errors returned
|
||
|
// by MapRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type MapRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m MapRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m MapRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// MapRulesValidationError is the validation error returned by
|
||
|
// MapRules.Validate if the designated constraints aren't met.
|
||
|
type MapRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e MapRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e MapRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e MapRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e MapRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e MapRulesValidationError) ErrorName() string { return "MapRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e MapRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sMapRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = MapRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = MapRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on AnyRules with the rules defined in the
|
||
|
// proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *AnyRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on AnyRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in AnyRulesMultiError, or nil
|
||
|
// if none found.
|
||
|
func (m *AnyRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *AnyRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Required
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return AnyRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// AnyRulesMultiError is an error wrapping multiple validation errors returned
|
||
|
// by AnyRules.ValidateAll() if the designated constraints aren't met.
|
||
|
type AnyRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m AnyRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m AnyRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// AnyRulesValidationError is the validation error returned by
|
||
|
// AnyRules.Validate if the designated constraints aren't met.
|
||
|
type AnyRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e AnyRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e AnyRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e AnyRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e AnyRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e AnyRulesValidationError) ErrorName() string { return "AnyRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e AnyRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sAnyRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = AnyRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = AnyRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on DurationRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *DurationRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on DurationRules with the rules defined
|
||
|
// in the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in DurationRulesMultiError, or
|
||
|
// nil if none found.
|
||
|
func (m *DurationRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *DurationRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Required
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetConst()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Const",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Const",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetConst()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return DurationRulesValidationError{
|
||
|
field: "Const",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetLt()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Lt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Lt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetLt()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return DurationRulesValidationError{
|
||
|
field: "Lt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetLte()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Lte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Lte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetLte()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return DurationRulesValidationError{
|
||
|
field: "Lte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetGt()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Gt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Gt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetGt()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return DurationRulesValidationError{
|
||
|
field: "Gt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetGte()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Gte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: "Gte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetGte()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return DurationRulesValidationError{
|
||
|
field: "Gte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
for idx, item := range m.GetIn() {
|
||
|
_, _ = idx, item
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(item).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: fmt.Sprintf("In[%v]", idx),
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: fmt.Sprintf("In[%v]", idx),
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return DurationRulesValidationError{
|
||
|
field: fmt.Sprintf("In[%v]", idx),
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
for idx, item := range m.GetNotIn() {
|
||
|
_, _ = idx, item
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(item).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: fmt.Sprintf("NotIn[%v]", idx),
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, DurationRulesValidationError{
|
||
|
field: fmt.Sprintf("NotIn[%v]", idx),
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return DurationRulesValidationError{
|
||
|
field: fmt.Sprintf("NotIn[%v]", idx),
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return DurationRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// DurationRulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by DurationRules.ValidateAll() if the designated constraints
|
||
|
// aren't met.
|
||
|
type DurationRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m DurationRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m DurationRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// DurationRulesValidationError is the validation error returned by
|
||
|
// DurationRules.Validate if the designated constraints aren't met.
|
||
|
type DurationRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e DurationRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e DurationRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e DurationRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e DurationRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e DurationRulesValidationError) ErrorName() string { return "DurationRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e DurationRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sDurationRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = DurationRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = DurationRulesValidationError{}
|
||
|
|
||
|
// Validate checks the field values on TimestampRules with the rules defined in
|
||
|
// the proto definition for this message. If any rules are violated, the first
|
||
|
// error encountered is returned, or nil if there are no violations.
|
||
|
func (m *TimestampRules) Validate() error {
|
||
|
return m.validate(false)
|
||
|
}
|
||
|
|
||
|
// ValidateAll checks the field values on TimestampRules with the rules defined
|
||
|
// in the proto definition for this message. If any rules are violated, the
|
||
|
// result is a list of violation errors wrapped in TimestampRulesMultiError,
|
||
|
// or nil if none found.
|
||
|
func (m *TimestampRules) ValidateAll() error {
|
||
|
return m.validate(true)
|
||
|
}
|
||
|
|
||
|
func (m *TimestampRules) validate(all bool) error {
|
||
|
if m == nil {
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
var errors []error
|
||
|
|
||
|
// no validation rules for Required
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetConst()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Const",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Const",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetConst()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return TimestampRulesValidationError{
|
||
|
field: "Const",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetLt()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Lt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Lt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetLt()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return TimestampRulesValidationError{
|
||
|
field: "Lt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetLte()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Lte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Lte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetLte()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return TimestampRulesValidationError{
|
||
|
field: "Lte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetGt()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Gt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Gt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetGt()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return TimestampRulesValidationError{
|
||
|
field: "Gt",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetGte()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Gte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Gte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetGte()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return TimestampRulesValidationError{
|
||
|
field: "Gte",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// no validation rules for LtNow
|
||
|
|
||
|
// no validation rules for GtNow
|
||
|
|
||
|
if all {
|
||
|
switch v := interface{}(m.GetWithin()).(type) {
|
||
|
case interface{ ValidateAll() error }:
|
||
|
if err := v.ValidateAll(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Within",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
case interface{ Validate() error }:
|
||
|
if err := v.Validate(); err != nil {
|
||
|
errors = append(errors, TimestampRulesValidationError{
|
||
|
field: "Within",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
} else if v, ok := interface{}(m.GetWithin()).(interface{ Validate() error }); ok {
|
||
|
if err := v.Validate(); err != nil {
|
||
|
return TimestampRulesValidationError{
|
||
|
field: "Within",
|
||
|
reason: "embedded message failed validation",
|
||
|
cause: err,
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if len(errors) > 0 {
|
||
|
return TimestampRulesMultiError(errors)
|
||
|
}
|
||
|
|
||
|
return nil
|
||
|
}
|
||
|
|
||
|
// TimestampRulesMultiError is an error wrapping multiple validation errors
|
||
|
// returned by TimestampRules.ValidateAll() if the designated constraints
|
||
|
// aren't met.
|
||
|
type TimestampRulesMultiError []error
|
||
|
|
||
|
// Error returns a concatenation of all the error messages it wraps.
|
||
|
func (m TimestampRulesMultiError) Error() string {
|
||
|
var msgs []string
|
||
|
for _, err := range m {
|
||
|
msgs = append(msgs, err.Error())
|
||
|
}
|
||
|
return strings.Join(msgs, "; ")
|
||
|
}
|
||
|
|
||
|
// AllErrors returns a list of validation violation errors.
|
||
|
func (m TimestampRulesMultiError) AllErrors() []error { return m }
|
||
|
|
||
|
// TimestampRulesValidationError is the validation error returned by
|
||
|
// TimestampRules.Validate if the designated constraints aren't met.
|
||
|
type TimestampRulesValidationError struct {
|
||
|
field string
|
||
|
reason string
|
||
|
cause error
|
||
|
key bool
|
||
|
}
|
||
|
|
||
|
// Field function returns field value.
|
||
|
func (e TimestampRulesValidationError) Field() string { return e.field }
|
||
|
|
||
|
// Reason function returns reason value.
|
||
|
func (e TimestampRulesValidationError) Reason() string { return e.reason }
|
||
|
|
||
|
// Cause function returns cause value.
|
||
|
func (e TimestampRulesValidationError) Cause() error { return e.cause }
|
||
|
|
||
|
// Key function returns key value.
|
||
|
func (e TimestampRulesValidationError) Key() bool { return e.key }
|
||
|
|
||
|
// ErrorName returns error name.
|
||
|
func (e TimestampRulesValidationError) ErrorName() string { return "TimestampRulesValidationError" }
|
||
|
|
||
|
// Error satisfies the builtin error interface
|
||
|
func (e TimestampRulesValidationError) Error() string {
|
||
|
cause := ""
|
||
|
if e.cause != nil {
|
||
|
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||
|
}
|
||
|
|
||
|
key := ""
|
||
|
if e.key {
|
||
|
key = "key for "
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf(
|
||
|
"invalid %sTimestampRules.%s: %s%s",
|
||
|
key,
|
||
|
e.field,
|
||
|
e.reason,
|
||
|
cause)
|
||
|
}
|
||
|
|
||
|
var _ error = TimestampRulesValidationError{}
|
||
|
|
||
|
var _ interface {
|
||
|
Field() string
|
||
|
Reason() string
|
||
|
Key() bool
|
||
|
Cause() error
|
||
|
ErrorName() string
|
||
|
} = TimestampRulesValidationError{}
|