@@ -35,6 +35,240 @@ var (
|
||||
_ = sort.Sort
|
||||
)
|
||||
|
||||
// Validate checks the field values on HandlerListReq 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 *HandlerListReq) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on HandlerListReq 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 HandlerListReqMultiError,
|
||||
// or nil if none found.
|
||||
func (m *HandlerListReq) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *HandlerListReq) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for Package
|
||||
|
||||
if len(errors) > 0 {
|
||||
return HandlerListReqMultiError(errors)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// HandlerListReqMultiError is an error wrapping multiple validation errors
|
||||
// returned by HandlerListReq.ValidateAll() if the designated constraints
|
||||
// aren't met.
|
||||
type HandlerListReqMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m HandlerListReqMultiError) 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 HandlerListReqMultiError) AllErrors() []error { return m }
|
||||
|
||||
// HandlerListReqValidationError is the validation error returned by
|
||||
// HandlerListReq.Validate if the designated constraints aren't met.
|
||||
type HandlerListReqValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e HandlerListReqValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e HandlerListReqValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e HandlerListReqValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e HandlerListReqValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e HandlerListReqValidationError) ErrorName() string { return "HandlerListReqValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e HandlerListReqValidationError) 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 %sHandlerListReq.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = HandlerListReqValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = HandlerListReqValidationError{}
|
||||
|
||||
// Validate checks the field values on HandlerListRsp 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 *HandlerListRsp) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on HandlerListRsp 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 HandlerListRspMultiError,
|
||||
// or nil if none found.
|
||||
func (m *HandlerListRsp) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *HandlerListRsp) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
for idx, item := range m.GetHandlers() {
|
||||
_, _ = idx, item
|
||||
|
||||
if all {
|
||||
switch v := interface{}(item).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, HandlerListRspValidationError{
|
||||
field: fmt.Sprintf("Handlers[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, HandlerListRspValidationError{
|
||||
field: fmt.Sprintf("Handlers[%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 HandlerListRspValidationError{
|
||||
field: fmt.Sprintf("Handlers[%v]", idx),
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
return HandlerListRspMultiError(errors)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// HandlerListRspMultiError is an error wrapping multiple validation errors
|
||||
// returned by HandlerListRsp.ValidateAll() if the designated constraints
|
||||
// aren't met.
|
||||
type HandlerListRspMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m HandlerListRspMultiError) 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 HandlerListRspMultiError) AllErrors() []error { return m }
|
||||
|
||||
// HandlerListRspValidationError is the validation error returned by
|
||||
// HandlerListRsp.Validate if the designated constraints aren't met.
|
||||
type HandlerListRspValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e HandlerListRspValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e HandlerListRspValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e HandlerListRspValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e HandlerListRspValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e HandlerListRspValidationError) ErrorName() string { return "HandlerListRspValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e HandlerListRspValidationError) 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 %sHandlerListRsp.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = HandlerListRspValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = HandlerListRspValidationError{}
|
||||
|
||||
// Validate checks the field values on PackageModulesReq 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.
|
||||
@@ -679,6 +913,8 @@ func (m *Package) validate(all bool) error {
|
||||
|
||||
// no validation rules for Comments
|
||||
|
||||
// no validation rules for Handlers
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetCreated()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
@@ -766,6 +1002,10 @@ func (m *Package) validate(all bool) error {
|
||||
}
|
||||
}
|
||||
|
||||
// no validation rules for Type
|
||||
|
||||
// no validation rules for Coverage
|
||||
|
||||
if len(errors) > 0 {
|
||||
return PackageMultiError(errors)
|
||||
}
|
||||
@@ -842,6 +1082,138 @@ var _ interface {
|
||||
ErrorName() string
|
||||
} = PackageValidationError{}
|
||||
|
||||
// Validate checks the field values on Handler 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 *Handler) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on Handler 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 HandlerMultiError, or nil if none found.
|
||||
func (m *Handler) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *Handler) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
if m.GetId() <= 0 {
|
||||
err := HandlerValidationError{
|
||||
field: "Id",
|
||||
reason: "value must be greater than 0",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if m.GetPackage() <= 0 {
|
||||
err := HandlerValidationError{
|
||||
field: "Package",
|
||||
reason: "value must be greater than 0",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if utf8.RuneCountInString(m.GetName()) < 1 {
|
||||
err := HandlerValidationError{
|
||||
field: "Name",
|
||||
reason: "value length must be at least 1 runes",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
// no validation rules for Coverage
|
||||
|
||||
if len(errors) > 0 {
|
||||
return HandlerMultiError(errors)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// HandlerMultiError is an error wrapping multiple validation errors returned
|
||||
// by Handler.ValidateAll() if the designated constraints aren't met.
|
||||
type HandlerMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m HandlerMultiError) 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 HandlerMultiError) AllErrors() []error { return m }
|
||||
|
||||
// HandlerValidationError is the validation error returned by Handler.Validate
|
||||
// if the designated constraints aren't met.
|
||||
type HandlerValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e HandlerValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e HandlerValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e HandlerValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e HandlerValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e HandlerValidationError) ErrorName() string { return "HandlerValidationError" }
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e HandlerValidationError) 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 %sHandler.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = HandlerValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = HandlerValidationError{}
|
||||
|
||||
// Validate checks the field values on Module 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.
|
||||
@@ -2068,6 +2440,8 @@ func (m *PackageUpdateReq) validate(all bool) error {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
// no validation rules for Coverprofile
|
||||
|
||||
if len(errors) > 0 {
|
||||
return PackageUpdateReqMultiError(errors)
|
||||
}
|
||||
@@ -2557,6 +2931,8 @@ func (m *PackageCreateReq) validate(all bool) error {
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
// no validation rules for Description
|
||||
|
||||
if len(errors) > 0 {
|
||||
return PackageCreateReqMultiError(errors)
|
||||
}
|
||||
@@ -2784,6 +3160,8 @@ func (m *ModuleListReq) validate(all bool) error {
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for Package
|
||||
|
||||
if len(errors) > 0 {
|
||||
return ModuleListReqMultiError(errors)
|
||||
}
|
||||
@@ -3016,7 +3394,7 @@ func (m *CommentListReq) validate(all bool) error {
|
||||
|
||||
var errors []error
|
||||
|
||||
// no validation rules for PackageId
|
||||
// no validation rules for Package
|
||||
|
||||
if len(errors) > 0 {
|
||||
return CommentListReqMultiError(errors)
|
||||
@@ -3252,7 +3630,7 @@ func (m *CommentLookupReq) validate(all bool) error {
|
||||
|
||||
// no validation rules for Id
|
||||
|
||||
// no validation rules for PackageId
|
||||
// no validation rules for Package
|
||||
|
||||
if len(errors) > 0 {
|
||||
return CommentLookupReqMultiError(errors)
|
||||
|
Reference in New Issue
Block a user