reduce api

This commit is contained in:
zhuyasen
2024-06-26 20:45:50 +08:00
parent 92be671b11
commit 2c008b6630
34 changed files with 319 additions and 4331 deletions

View File

@@ -597,212 +597,6 @@ var _ interface {
ErrorName() string
} = DeleteUserExampleByIDReplyValidationError{}
// Validate checks the field values on DeleteUserExampleByIDsRequest 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 *DeleteUserExampleByIDsRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DeleteUserExampleByIDsRequest 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
// DeleteUserExampleByIDsRequestMultiError, or nil if none found.
func (m *DeleteUserExampleByIDsRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DeleteUserExampleByIDsRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return DeleteUserExampleByIDsRequestMultiError(errors)
}
return nil
}
// DeleteUserExampleByIDsRequestMultiError is an error wrapping multiple
// validation errors returned by DeleteUserExampleByIDsRequest.ValidateAll()
// if the designated constraints aren't met.
type DeleteUserExampleByIDsRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DeleteUserExampleByIDsRequestMultiError) 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 DeleteUserExampleByIDsRequestMultiError) AllErrors() []error { return m }
// DeleteUserExampleByIDsRequestValidationError is the validation error
// returned by DeleteUserExampleByIDsRequest.Validate if the designated
// constraints aren't met.
type DeleteUserExampleByIDsRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DeleteUserExampleByIDsRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DeleteUserExampleByIDsRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DeleteUserExampleByIDsRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DeleteUserExampleByIDsRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DeleteUserExampleByIDsRequestValidationError) ErrorName() string {
return "DeleteUserExampleByIDsRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DeleteUserExampleByIDsRequestValidationError) 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 %sDeleteUserExampleByIDsRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DeleteUserExampleByIDsRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DeleteUserExampleByIDsRequestValidationError{}
// Validate checks the field values on DeleteUserExampleByIDsReply 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 *DeleteUserExampleByIDsReply) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DeleteUserExampleByIDsReply 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
// DeleteUserExampleByIDsReplyMultiError, or nil if none found.
func (m *DeleteUserExampleByIDsReply) ValidateAll() error {
return m.validate(true)
}
func (m *DeleteUserExampleByIDsReply) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return DeleteUserExampleByIDsReplyMultiError(errors)
}
return nil
}
// DeleteUserExampleByIDsReplyMultiError is an error wrapping multiple
// validation errors returned by DeleteUserExampleByIDsReply.ValidateAll() if
// the designated constraints aren't met.
type DeleteUserExampleByIDsReplyMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DeleteUserExampleByIDsReplyMultiError) 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 DeleteUserExampleByIDsReplyMultiError) AllErrors() []error { return m }
// DeleteUserExampleByIDsReplyValidationError is the validation error returned
// by DeleteUserExampleByIDsReply.Validate if the designated constraints
// aren't met.
type DeleteUserExampleByIDsReplyValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DeleteUserExampleByIDsReplyValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DeleteUserExampleByIDsReplyValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DeleteUserExampleByIDsReplyValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DeleteUserExampleByIDsReplyValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DeleteUserExampleByIDsReplyValidationError) ErrorName() string {
return "DeleteUserExampleByIDsReplyValidationError"
}
// Error satisfies the builtin error interface
func (e DeleteUserExampleByIDsReplyValidationError) 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 %sDeleteUserExampleByIDsReply.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DeleteUserExampleByIDsReplyValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = DeleteUserExampleByIDsReplyValidationError{}
// Validate checks the field values on UpdateUserExampleByIDRequest 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.
@@ -1402,777 +1196,6 @@ var _ interface {
ErrorName() string
} = GetUserExampleByIDReplyValidationError{}
// Validate checks the field values on GetUserExampleByConditionRequest 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 *GetUserExampleByConditionRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetUserExampleByConditionRequest 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
// GetUserExampleByConditionRequestMultiError, or nil if none found.
func (m *GetUserExampleByConditionRequest) ValidateAll() error {
return m.validate(true)
}
func (m *GetUserExampleByConditionRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetConditions() == nil {
err := GetUserExampleByConditionRequestValidationError{
field: "Conditions",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetConditions()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, GetUserExampleByConditionRequestValidationError{
field: "Conditions",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, GetUserExampleByConditionRequestValidationError{
field: "Conditions",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetConditions()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GetUserExampleByConditionRequestValidationError{
field: "Conditions",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return GetUserExampleByConditionRequestMultiError(errors)
}
return nil
}
// GetUserExampleByConditionRequestMultiError is an error wrapping multiple
// validation errors returned by
// GetUserExampleByConditionRequest.ValidateAll() if the designated
// constraints aren't met.
type GetUserExampleByConditionRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetUserExampleByConditionRequestMultiError) 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 GetUserExampleByConditionRequestMultiError) AllErrors() []error { return m }
// GetUserExampleByConditionRequestValidationError is the validation error
// returned by GetUserExampleByConditionRequest.Validate if the designated
// constraints aren't met.
type GetUserExampleByConditionRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetUserExampleByConditionRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetUserExampleByConditionRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetUserExampleByConditionRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetUserExampleByConditionRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetUserExampleByConditionRequestValidationError) ErrorName() string {
return "GetUserExampleByConditionRequestValidationError"
}
// Error satisfies the builtin error interface
func (e GetUserExampleByConditionRequestValidationError) 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 %sGetUserExampleByConditionRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetUserExampleByConditionRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetUserExampleByConditionRequestValidationError{}
// Validate checks the field values on GetUserExampleByConditionReply 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 *GetUserExampleByConditionReply) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetUserExampleByConditionReply 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
// GetUserExampleByConditionReplyMultiError, or nil if none found.
func (m *GetUserExampleByConditionReply) ValidateAll() error {
return m.validate(true)
}
func (m *GetUserExampleByConditionReply) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if all {
switch v := interface{}(m.GetUserExample()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, GetUserExampleByConditionReplyValidationError{
field: "UserExample",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, GetUserExampleByConditionReplyValidationError{
field: "UserExample",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetUserExample()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return GetUserExampleByConditionReplyValidationError{
field: "UserExample",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return GetUserExampleByConditionReplyMultiError(errors)
}
return nil
}
// GetUserExampleByConditionReplyMultiError is an error wrapping multiple
// validation errors returned by GetUserExampleByConditionReply.ValidateAll()
// if the designated constraints aren't met.
type GetUserExampleByConditionReplyMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetUserExampleByConditionReplyMultiError) 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 GetUserExampleByConditionReplyMultiError) AllErrors() []error { return m }
// GetUserExampleByConditionReplyValidationError is the validation error
// returned by GetUserExampleByConditionReply.Validate if the designated
// constraints aren't met.
type GetUserExampleByConditionReplyValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetUserExampleByConditionReplyValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetUserExampleByConditionReplyValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetUserExampleByConditionReplyValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetUserExampleByConditionReplyValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetUserExampleByConditionReplyValidationError) ErrorName() string {
return "GetUserExampleByConditionReplyValidationError"
}
// Error satisfies the builtin error interface
func (e GetUserExampleByConditionReplyValidationError) 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 %sGetUserExampleByConditionReply.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetUserExampleByConditionReplyValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetUserExampleByConditionReplyValidationError{}
// Validate checks the field values on ListUserExampleByIDsRequest 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 *ListUserExampleByIDsRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListUserExampleByIDsRequest 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
// ListUserExampleByIDsRequestMultiError, or nil if none found.
func (m *ListUserExampleByIDsRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ListUserExampleByIDsRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return ListUserExampleByIDsRequestMultiError(errors)
}
return nil
}
// ListUserExampleByIDsRequestMultiError is an error wrapping multiple
// validation errors returned by ListUserExampleByIDsRequest.ValidateAll() if
// the designated constraints aren't met.
type ListUserExampleByIDsRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListUserExampleByIDsRequestMultiError) 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 ListUserExampleByIDsRequestMultiError) AllErrors() []error { return m }
// ListUserExampleByIDsRequestValidationError is the validation error returned
// by ListUserExampleByIDsRequest.Validate if the designated constraints
// aren't met.
type ListUserExampleByIDsRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListUserExampleByIDsRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListUserExampleByIDsRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListUserExampleByIDsRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListUserExampleByIDsRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListUserExampleByIDsRequestValidationError) ErrorName() string {
return "ListUserExampleByIDsRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ListUserExampleByIDsRequestValidationError) 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 %sListUserExampleByIDsRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListUserExampleByIDsRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListUserExampleByIDsRequestValidationError{}
// Validate checks the field values on ListUserExampleByIDsReply 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 *ListUserExampleByIDsReply) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListUserExampleByIDsReply 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
// ListUserExampleByIDsReplyMultiError, or nil if none found.
func (m *ListUserExampleByIDsReply) ValidateAll() error {
return m.validate(true)
}
func (m *ListUserExampleByIDsReply) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetUserExamples() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ListUserExampleByIDsReplyValidationError{
field: fmt.Sprintf("UserExamples[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ListUserExampleByIDsReplyValidationError{
field: fmt.Sprintf("UserExamples[%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 ListUserExampleByIDsReplyValidationError{
field: fmt.Sprintf("UserExamples[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ListUserExampleByIDsReplyMultiError(errors)
}
return nil
}
// ListUserExampleByIDsReplyMultiError is an error wrapping multiple validation
// errors returned by ListUserExampleByIDsReply.ValidateAll() if the
// designated constraints aren't met.
type ListUserExampleByIDsReplyMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListUserExampleByIDsReplyMultiError) 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 ListUserExampleByIDsReplyMultiError) AllErrors() []error { return m }
// ListUserExampleByIDsReplyValidationError is the validation error returned by
// ListUserExampleByIDsReply.Validate if the designated constraints aren't met.
type ListUserExampleByIDsReplyValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListUserExampleByIDsReplyValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListUserExampleByIDsReplyValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListUserExampleByIDsReplyValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListUserExampleByIDsReplyValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListUserExampleByIDsReplyValidationError) ErrorName() string {
return "ListUserExampleByIDsReplyValidationError"
}
// Error satisfies the builtin error interface
func (e ListUserExampleByIDsReplyValidationError) 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 %sListUserExampleByIDsReply.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListUserExampleByIDsReplyValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListUserExampleByIDsReplyValidationError{}
// Validate checks the field values on ListUserExampleByLastIDRequest 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 *ListUserExampleByLastIDRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListUserExampleByLastIDRequest 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
// ListUserExampleByLastIDRequestMultiError, or nil if none found.
func (m *ListUserExampleByLastIDRequest) ValidateAll() error {
return m.validate(true)
}
func (m *ListUserExampleByLastIDRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for LastID
if m.GetLimit() <= 0 {
err := ListUserExampleByLastIDRequestValidationError{
field: "Limit",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
// no validation rules for Sort
if len(errors) > 0 {
return ListUserExampleByLastIDRequestMultiError(errors)
}
return nil
}
// ListUserExampleByLastIDRequestMultiError is an error wrapping multiple
// validation errors returned by ListUserExampleByLastIDRequest.ValidateAll()
// if the designated constraints aren't met.
type ListUserExampleByLastIDRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListUserExampleByLastIDRequestMultiError) 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 ListUserExampleByLastIDRequestMultiError) AllErrors() []error { return m }
// ListUserExampleByLastIDRequestValidationError is the validation error
// returned by ListUserExampleByLastIDRequest.Validate if the designated
// constraints aren't met.
type ListUserExampleByLastIDRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListUserExampleByLastIDRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListUserExampleByLastIDRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListUserExampleByLastIDRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListUserExampleByLastIDRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListUserExampleByLastIDRequestValidationError) ErrorName() string {
return "ListUserExampleByLastIDRequestValidationError"
}
// Error satisfies the builtin error interface
func (e ListUserExampleByLastIDRequestValidationError) 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 %sListUserExampleByLastIDRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListUserExampleByLastIDRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListUserExampleByLastIDRequestValidationError{}
// Validate checks the field values on ListUserExampleByLastIDReply 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 *ListUserExampleByLastIDReply) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListUserExampleByLastIDReply 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
// ListUserExampleByLastIDReplyMultiError, or nil if none found.
func (m *ListUserExampleByLastIDReply) ValidateAll() error {
return m.validate(true)
}
func (m *ListUserExampleByLastIDReply) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetUserExamples() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ListUserExampleByLastIDReplyValidationError{
field: fmt.Sprintf("UserExamples[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ListUserExampleByLastIDReplyValidationError{
field: fmt.Sprintf("UserExamples[%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 ListUserExampleByLastIDReplyValidationError{
field: fmt.Sprintf("UserExamples[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ListUserExampleByLastIDReplyMultiError(errors)
}
return nil
}
// ListUserExampleByLastIDReplyMultiError is an error wrapping multiple
// validation errors returned by ListUserExampleByLastIDReply.ValidateAll() if
// the designated constraints aren't met.
type ListUserExampleByLastIDReplyMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListUserExampleByLastIDReplyMultiError) 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 ListUserExampleByLastIDReplyMultiError) AllErrors() []error { return m }
// ListUserExampleByLastIDReplyValidationError is the validation error returned
// by ListUserExampleByLastIDReply.Validate if the designated constraints
// aren't met.
type ListUserExampleByLastIDReplyValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListUserExampleByLastIDReplyValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListUserExampleByLastIDReplyValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListUserExampleByLastIDReplyValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListUserExampleByLastIDReplyValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListUserExampleByLastIDReplyValidationError) ErrorName() string {
return "ListUserExampleByLastIDReplyValidationError"
}
// Error satisfies the builtin error interface
func (e ListUserExampleByLastIDReplyValidationError) 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 %sListUserExampleByLastIDReply.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListUserExampleByLastIDReplyValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListUserExampleByLastIDReplyValidationError{}
// Validate checks the field values on ListUserExampleRequest 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.