pkgdash/proto/pkgdash.pb.validate.go

2378 lines
60 KiB
Go

// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: pkgdash.proto
package pkgdashpb
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 ErrorRsp 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 *ErrorRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ErrorRsp 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 ErrorRspMultiError, or nil
// if none found.
func (m *ErrorRsp) ValidateAll() error {
return m.validate(true)
}
func (m *ErrorRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if all {
switch v := interface{}(m.GetError()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ErrorRspValidationError{
field: "Error",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ErrorRspValidationError{
field: "Error",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetError()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return ErrorRspValidationError{
field: "Error",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return ErrorRspMultiError(errors)
}
return nil
}
// ErrorRspMultiError is an error wrapping multiple validation errors returned
// by ErrorRsp.ValidateAll() if the designated constraints aren't met.
type ErrorRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ErrorRspMultiError) 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 ErrorRspMultiError) AllErrors() []error { return m }
// ErrorRspValidationError is the validation error returned by
// ErrorRsp.Validate if the designated constraints aren't met.
type ErrorRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ErrorRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ErrorRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ErrorRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ErrorRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ErrorRspValidationError) ErrorName() string { return "ErrorRspValidationError" }
// Error satisfies the builtin error interface
func (e ErrorRspValidationError) 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 %sErrorRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ErrorRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ErrorRspValidationError{}
// Validate checks the field values on Error 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 *Error) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Error 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 ErrorMultiError, or nil if none found.
func (m *Error) ValidateAll() error {
return m.validate(true)
}
func (m *Error) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Code
// no validation rules for Title
// no validation rules for Uuid
// no validation rules for Details
if len(errors) > 0 {
return ErrorMultiError(errors)
}
return nil
}
// ErrorMultiError is an error wrapping multiple validation errors returned by
// Error.ValidateAll() if the designated constraints aren't met.
type ErrorMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ErrorMultiError) 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 ErrorMultiError) AllErrors() []error { return m }
// ErrorValidationError is the validation error returned by Error.Validate if
// the designated constraints aren't met.
type ErrorValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ErrorValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ErrorValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ErrorValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ErrorValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ErrorValidationError) ErrorName() string { return "ErrorValidationError" }
// Error satisfies the builtin error interface
func (e ErrorValidationError) 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 %sError.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ErrorValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ErrorValidationError{}
// Validate checks the field values on Package 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 *Package) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Package 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 PackageMultiError, or nil if none found.
func (m *Package) ValidateAll() error {
return m.validate(true)
}
func (m *Package) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetId() <= 0 {
err := PackageValidationError{
field: "Id",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetName()) < 1 {
err := PackageValidationError{
field: "Name",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetUrl()) < 1 {
err := PackageValidationError{
field: "Url",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return PackageMultiError(errors)
}
return nil
}
// PackageMultiError is an error wrapping multiple validation errors returned
// by Package.ValidateAll() if the designated constraints aren't met.
type PackageMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PackageMultiError) 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 PackageMultiError) AllErrors() []error { return m }
// PackageValidationError is the validation error returned by Package.Validate
// if the designated constraints aren't met.
type PackageValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PackageValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PackageValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PackageValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PackageValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PackageValidationError) ErrorName() string { return "PackageValidationError" }
// Error satisfies the builtin error interface
func (e PackageValidationError) 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 %sPackage.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PackageValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PackageValidationError{}
// 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.
func (m *Module) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Module 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 ModuleMultiError, or nil if none found.
func (m *Module) ValidateAll() error {
return m.validate(true)
}
func (m *Module) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetId() <= 0 {
err := ModuleValidationError{
field: "Id",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetName()) < 1 {
err := ModuleValidationError{
field: "Name",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetVersion()) < 1 {
err := ModuleValidationError{
field: "Version",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetPackage() <= 0 {
err := ModuleValidationError{
field: "Package",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetLastVersion()) < 1 {
err := ModuleValidationError{
field: "LastVersion",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return ModuleMultiError(errors)
}
return nil
}
// ModuleMultiError is an error wrapping multiple validation errors returned by
// Module.ValidateAll() if the designated constraints aren't met.
type ModuleMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ModuleMultiError) 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 ModuleMultiError) AllErrors() []error { return m }
// ModuleValidationError is the validation error returned by Module.Validate if
// the designated constraints aren't met.
type ModuleValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ModuleValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ModuleValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ModuleValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ModuleValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ModuleValidationError) ErrorName() string { return "ModuleValidationError" }
// Error satisfies the builtin error interface
func (e ModuleValidationError) 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 %sModule.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ModuleValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ModuleValidationError{}
// Validate checks the field values on Issue 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 *Issue) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Issue 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 IssueMultiError, or nil if none found.
func (m *Issue) ValidateAll() error {
return m.validate(true)
}
func (m *Issue) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetId() <= 0 {
err := IssueValidationError{
field: "Id",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetStatus() <= 0 {
err := IssueValidationError{
field: "Status",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetDesc()) < 1 {
err := IssueValidationError{
field: "Desc",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetPackage() <= 0 {
err := IssueValidationError{
field: "Package",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return IssueMultiError(errors)
}
return nil
}
// IssueMultiError is an error wrapping multiple validation errors returned by
// Issue.ValidateAll() if the designated constraints aren't met.
type IssueMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m IssueMultiError) 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 IssueMultiError) AllErrors() []error { return m }
// IssueValidationError is the validation error returned by Issue.Validate if
// the designated constraints aren't met.
type IssueValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e IssueValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e IssueValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e IssueValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e IssueValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e IssueValidationError) ErrorName() string { return "IssueValidationError" }
// Error satisfies the builtin error interface
func (e IssueValidationError) 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 %sIssue.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = IssueValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = IssueValidationError{}
// Validate checks the field values on Comment 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 *Comment) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on Comment 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 CommentMultiError, or nil if none found.
func (m *Comment) ValidateAll() error {
return m.validate(true)
}
func (m *Comment) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetId() <= 0 {
err := CommentValidationError{
field: "Id",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if m.GetPackage() <= 0 {
err := CommentValidationError{
field: "Package",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
// no validation rules for Text
// no validation rules for Created
// no validation rules for Updated
if len(errors) > 0 {
return CommentMultiError(errors)
}
return nil
}
// CommentMultiError is an error wrapping multiple validation errors returned
// by Comment.ValidateAll() if the designated constraints aren't met.
type CommentMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m CommentMultiError) 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 CommentMultiError) AllErrors() []error { return m }
// CommentValidationError is the validation error returned by Comment.Validate
// if the designated constraints aren't met.
type CommentValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e CommentValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e CommentValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e CommentValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e CommentValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e CommentValidationError) ErrorName() string { return "CommentValidationError" }
// Error satisfies the builtin error interface
func (e CommentValidationError) 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 %sComment.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = CommentValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = CommentValidationError{}
// Validate checks the field values on ListPackageReq 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 *ListPackageReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListPackageReq 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 ListPackageReqMultiError,
// or nil if none found.
func (m *ListPackageReq) ValidateAll() error {
return m.validate(true)
}
func (m *ListPackageReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return ListPackageReqMultiError(errors)
}
return nil
}
// ListPackageReqMultiError is an error wrapping multiple validation errors
// returned by ListPackageReq.ValidateAll() if the designated constraints
// aren't met.
type ListPackageReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListPackageReqMultiError) 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 ListPackageReqMultiError) AllErrors() []error { return m }
// ListPackageReqValidationError is the validation error returned by
// ListPackageReq.Validate if the designated constraints aren't met.
type ListPackageReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListPackageReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListPackageReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListPackageReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListPackageReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListPackageReqValidationError) ErrorName() string { return "ListPackageReqValidationError" }
// Error satisfies the builtin error interface
func (e ListPackageReqValidationError) 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 %sListPackageReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListPackageReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListPackageReqValidationError{}
// Validate checks the field values on ListPackageRsp 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 *ListPackageRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on ListPackageRsp 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 ListPackageRspMultiError,
// or nil if none found.
func (m *ListPackageRsp) ValidateAll() error {
return m.validate(true)
}
func (m *ListPackageRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetPackages() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, ListPackageRspValidationError{
field: fmt.Sprintf("Packages[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, ListPackageRspValidationError{
field: fmt.Sprintf("Packages[%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 ListPackageRspValidationError{
field: fmt.Sprintf("Packages[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return ListPackageRspMultiError(errors)
}
return nil
}
// ListPackageRspMultiError is an error wrapping multiple validation errors
// returned by ListPackageRsp.ValidateAll() if the designated constraints
// aren't met.
type ListPackageRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m ListPackageRspMultiError) 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 ListPackageRspMultiError) AllErrors() []error { return m }
// ListPackageRspValidationError is the validation error returned by
// ListPackageRsp.Validate if the designated constraints aren't met.
type ListPackageRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e ListPackageRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e ListPackageRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e ListPackageRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e ListPackageRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e ListPackageRspValidationError) ErrorName() string { return "ListPackageRspValidationError" }
// Error satisfies the builtin error interface
func (e ListPackageRspValidationError) 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 %sListPackageRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = ListPackageRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = ListPackageRspValidationError{}
// Validate checks the field values on UpdatePackageReq 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 *UpdatePackageReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UpdatePackageReq 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
// UpdatePackageReqMultiError, or nil if none found.
func (m *UpdatePackageReq) ValidateAll() error {
return m.validate(true)
}
func (m *UpdatePackageReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetId() <= 0 {
err := UpdatePackageReqValidationError{
field: "Id",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetName()) < 1 {
err := UpdatePackageReqValidationError{
field: "Name",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetUrl()) < 1 {
err := UpdatePackageReqValidationError{
field: "Url",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return UpdatePackageReqMultiError(errors)
}
return nil
}
// UpdatePackageReqMultiError is an error wrapping multiple validation errors
// returned by UpdatePackageReq.ValidateAll() if the designated constraints
// aren't met.
type UpdatePackageReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UpdatePackageReqMultiError) 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 UpdatePackageReqMultiError) AllErrors() []error { return m }
// UpdatePackageReqValidationError is the validation error returned by
// UpdatePackageReq.Validate if the designated constraints aren't met.
type UpdatePackageReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdatePackageReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdatePackageReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdatePackageReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdatePackageReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdatePackageReqValidationError) ErrorName() string { return "UpdatePackageReqValidationError" }
// Error satisfies the builtin error interface
func (e UpdatePackageReqValidationError) 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 %sUpdatePackageReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdatePackageReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdatePackageReqValidationError{}
// Validate checks the field values on UpdatePackageRsp 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 *UpdatePackageRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on UpdatePackageRsp 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
// UpdatePackageRspMultiError, or nil if none found.
func (m *UpdatePackageRsp) ValidateAll() error {
return m.validate(true)
}
func (m *UpdatePackageRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetId() <= 0 {
err := UpdatePackageRspValidationError{
field: "Id",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return UpdatePackageRspMultiError(errors)
}
return nil
}
// UpdatePackageRspMultiError is an error wrapping multiple validation errors
// returned by UpdatePackageRsp.ValidateAll() if the designated constraints
// aren't met.
type UpdatePackageRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m UpdatePackageRspMultiError) 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 UpdatePackageRspMultiError) AllErrors() []error { return m }
// UpdatePackageRspValidationError is the validation error returned by
// UpdatePackageRsp.Validate if the designated constraints aren't met.
type UpdatePackageRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e UpdatePackageRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e UpdatePackageRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e UpdatePackageRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e UpdatePackageRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e UpdatePackageRspValidationError) ErrorName() string { return "UpdatePackageRspValidationError" }
// Error satisfies the builtin error interface
func (e UpdatePackageRspValidationError) 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 %sUpdatePackageRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = UpdatePackageRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = UpdatePackageRspValidationError{}
// Validate checks the field values on CommentReq 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 *CommentReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on CommentReq 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 CommentReqMultiError, or
// nil if none found.
func (m *CommentReq) ValidateAll() error {
return m.validate(true)
}
func (m *CommentReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetPkg() <= 0 {
err := CommentReqValidationError{
field: "Pkg",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
// no validation rules for Text
if len(errors) > 0 {
return CommentReqMultiError(errors)
}
return nil
}
// CommentReqMultiError is an error wrapping multiple validation errors
// returned by CommentReq.ValidateAll() if the designated constraints aren't met.
type CommentReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m CommentReqMultiError) 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 CommentReqMultiError) AllErrors() []error { return m }
// CommentReqValidationError is the validation error returned by
// CommentReq.Validate if the designated constraints aren't met.
type CommentReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e CommentReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e CommentReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e CommentReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e CommentReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e CommentReqValidationError) ErrorName() string { return "CommentReqValidationError" }
// Error satisfies the builtin error interface
func (e CommentReqValidationError) 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 %sCommentReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = CommentReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = CommentReqValidationError{}
// Validate checks the field values on AddCommentReq 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 *AddCommentReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on AddCommentReq 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 AddCommentReqMultiError, or
// nil if none found.
func (m *AddCommentReq) ValidateAll() error {
return m.validate(true)
}
func (m *AddCommentReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetIdPackage() <= 0 {
err := AddCommentReqValidationError{
field: "IdPackage",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
// no validation rules for Text
if len(errors) > 0 {
return AddCommentReqMultiError(errors)
}
return nil
}
// AddCommentReqMultiError is an error wrapping multiple validation errors
// returned by AddCommentReq.ValidateAll() if the designated constraints
// aren't met.
type AddCommentReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m AddCommentReqMultiError) 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 AddCommentReqMultiError) AllErrors() []error { return m }
// AddCommentReqValidationError is the validation error returned by
// AddCommentReq.Validate if the designated constraints aren't met.
type AddCommentReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AddCommentReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AddCommentReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AddCommentReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AddCommentReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AddCommentReqValidationError) ErrorName() string { return "AddCommentReqValidationError" }
// Error satisfies the builtin error interface
func (e AddCommentReqValidationError) 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 %sAddCommentReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AddCommentReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AddCommentReqValidationError{}
// Validate checks the field values on AddCommentRsp 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 *AddCommentRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on AddCommentRsp 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 AddCommentRspMultiError, or
// nil if none found.
func (m *AddCommentRsp) ValidateAll() error {
return m.validate(true)
}
func (m *AddCommentRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetId() <= 0 {
err := AddCommentRspValidationError{
field: "Id",
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return AddCommentRspMultiError(errors)
}
return nil
}
// AddCommentRspMultiError is an error wrapping multiple validation errors
// returned by AddCommentRsp.ValidateAll() if the designated constraints
// aren't met.
type AddCommentRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m AddCommentRspMultiError) 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 AddCommentRspMultiError) AllErrors() []error { return m }
// AddCommentRspValidationError is the validation error returned by
// AddCommentRsp.Validate if the designated constraints aren't met.
type AddCommentRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AddCommentRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AddCommentRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AddCommentRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AddCommentRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AddCommentRspValidationError) ErrorName() string { return "AddCommentRspValidationError" }
// Error satisfies the builtin error interface
func (e AddCommentRspValidationError) 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 %sAddCommentRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AddCommentRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AddCommentRspValidationError{}
// Validate checks the field values on AddPackageReq 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 *AddPackageReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on AddPackageReq 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 AddPackageReqMultiError, or
// nil if none found.
func (m *AddPackageReq) ValidateAll() error {
return m.validate(true)
}
func (m *AddPackageReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetName()) < 1 {
err := AddPackageReqValidationError{
field: "Name",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if utf8.RuneCountInString(m.GetUrl()) < 1 {
err := AddPackageReqValidationError{
field: "Url",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return AddPackageReqMultiError(errors)
}
return nil
}
// AddPackageReqMultiError is an error wrapping multiple validation errors
// returned by AddPackageReq.ValidateAll() if the designated constraints
// aren't met.
type AddPackageReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m AddPackageReqMultiError) 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 AddPackageReqMultiError) AllErrors() []error { return m }
// AddPackageReqValidationError is the validation error returned by
// AddPackageReq.Validate if the designated constraints aren't met.
type AddPackageReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AddPackageReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AddPackageReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AddPackageReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AddPackageReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AddPackageReqValidationError) ErrorName() string { return "AddPackageReqValidationError" }
// Error satisfies the builtin error interface
func (e AddPackageReqValidationError) 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 %sAddPackageReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AddPackageReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AddPackageReqValidationError{}
// Validate checks the field values on AddPackageRsp 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 *AddPackageRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on AddPackageRsp 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 AddPackageRspMultiError, or
// nil if none found.
func (m *AddPackageRsp) ValidateAll() error {
return m.validate(true)
}
func (m *AddPackageRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if utf8.RuneCountInString(m.GetStatus()) < 1 {
err := AddPackageRspValidationError{
field: "Status",
reason: "value length must be at least 1 runes",
}
if !all {
return err
}
errors = append(errors, err)
}
if len(errors) > 0 {
return AddPackageRspMultiError(errors)
}
return nil
}
// AddPackageRspMultiError is an error wrapping multiple validation errors
// returned by AddPackageRsp.ValidateAll() if the designated constraints
// aren't met.
type AddPackageRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m AddPackageRspMultiError) 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 AddPackageRspMultiError) AllErrors() []error { return m }
// AddPackageRspValidationError is the validation error returned by
// AddPackageRsp.Validate if the designated constraints aren't met.
type AddPackageRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e AddPackageRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e AddPackageRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e AddPackageRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e AddPackageRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e AddPackageRspValidationError) ErrorName() string { return "AddPackageRspValidationError" }
// Error satisfies the builtin error interface
func (e AddPackageRspValidationError) 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 %sAddPackageRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = AddPackageRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = AddPackageRspValidationError{}
// Validate checks the field values on GetModuleReq 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 *GetModuleReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetModuleReq 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 GetModuleReqMultiError, or
// nil if none found.
func (m *GetModuleReq) ValidateAll() error {
return m.validate(true)
}
func (m *GetModuleReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(errors) > 0 {
return GetModuleReqMultiError(errors)
}
return nil
}
// GetModuleReqMultiError is an error wrapping multiple validation errors
// returned by GetModuleReq.ValidateAll() if the designated constraints aren't met.
type GetModuleReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetModuleReqMultiError) 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 GetModuleReqMultiError) AllErrors() []error { return m }
// GetModuleReqValidationError is the validation error returned by
// GetModuleReq.Validate if the designated constraints aren't met.
type GetModuleReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetModuleReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetModuleReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetModuleReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetModuleReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetModuleReqValidationError) ErrorName() string { return "GetModuleReqValidationError" }
// Error satisfies the builtin error interface
func (e GetModuleReqValidationError) 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 %sGetModuleReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetModuleReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetModuleReqValidationError{}
// Validate checks the field values on GetModuleRsp 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 *GetModuleRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetModuleRsp 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 GetModuleRspMultiError, or
// nil if none found.
func (m *GetModuleRsp) ValidateAll() error {
return m.validate(true)
}
func (m *GetModuleRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetModules() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, GetModuleRspValidationError{
field: fmt.Sprintf("Modules[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, GetModuleRspValidationError{
field: fmt.Sprintf("Modules[%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 GetModuleRspValidationError{
field: fmt.Sprintf("Modules[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return GetModuleRspMultiError(errors)
}
return nil
}
// GetModuleRspMultiError is an error wrapping multiple validation errors
// returned by GetModuleRsp.ValidateAll() if the designated constraints aren't met.
type GetModuleRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetModuleRspMultiError) 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 GetModuleRspMultiError) AllErrors() []error { return m }
// GetModuleRspValidationError is the validation error returned by
// GetModuleRsp.Validate if the designated constraints aren't met.
type GetModuleRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetModuleRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetModuleRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetModuleRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetModuleRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetModuleRspValidationError) ErrorName() string { return "GetModuleRspValidationError" }
// Error satisfies the builtin error interface
func (e GetModuleRspValidationError) 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 %sGetModuleRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetModuleRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetModuleRspValidationError{}
// Validate checks the field values on GetCommentsReq 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 *GetCommentsReq) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetCommentsReq 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 GetCommentsReqMultiError,
// or nil if none found.
func (m *GetCommentsReq) ValidateAll() error {
return m.validate(true)
}
func (m *GetCommentsReq) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if len(m.GetId()) < 1 {
err := GetCommentsReqValidationError{
field: "Id",
reason: "value must contain at least 1 item(s)",
}
if !all {
return err
}
errors = append(errors, err)
}
_GetCommentsReq_Id_Unique := make(map[uint64]struct{}, len(m.GetId()))
for idx, item := range m.GetId() {
_, _ = idx, item
if _, exists := _GetCommentsReq_Id_Unique[item]; exists {
err := GetCommentsReqValidationError{
field: fmt.Sprintf("Id[%v]", idx),
reason: "repeated value must contain unique items",
}
if !all {
return err
}
errors = append(errors, err)
} else {
_GetCommentsReq_Id_Unique[item] = struct{}{}
}
if item <= 0 {
err := GetCommentsReqValidationError{
field: fmt.Sprintf("Id[%v]", idx),
reason: "value must be greater than 0",
}
if !all {
return err
}
errors = append(errors, err)
}
}
if len(errors) > 0 {
return GetCommentsReqMultiError(errors)
}
return nil
}
// GetCommentsReqMultiError is an error wrapping multiple validation errors
// returned by GetCommentsReq.ValidateAll() if the designated constraints
// aren't met.
type GetCommentsReqMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetCommentsReqMultiError) 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 GetCommentsReqMultiError) AllErrors() []error { return m }
// GetCommentsReqValidationError is the validation error returned by
// GetCommentsReq.Validate if the designated constraints aren't met.
type GetCommentsReqValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetCommentsReqValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetCommentsReqValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetCommentsReqValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetCommentsReqValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetCommentsReqValidationError) ErrorName() string { return "GetCommentsReqValidationError" }
// Error satisfies the builtin error interface
func (e GetCommentsReqValidationError) 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 %sGetCommentsReq.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetCommentsReqValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetCommentsReqValidationError{}
// Validate checks the field values on GetCommentsRsp 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 *GetCommentsRsp) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on GetCommentsRsp 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 GetCommentsRspMultiError,
// or nil if none found.
func (m *GetCommentsRsp) ValidateAll() error {
return m.validate(true)
}
func (m *GetCommentsRsp) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
for idx, item := range m.GetComments() {
_, _ = idx, item
if all {
switch v := interface{}(item).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, GetCommentsRspValidationError{
field: fmt.Sprintf("Comments[%v]", idx),
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, GetCommentsRspValidationError{
field: fmt.Sprintf("Comments[%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 GetCommentsRspValidationError{
field: fmt.Sprintf("Comments[%v]", idx),
reason: "embedded message failed validation",
cause: err,
}
}
}
}
if len(errors) > 0 {
return GetCommentsRspMultiError(errors)
}
return nil
}
// GetCommentsRspMultiError is an error wrapping multiple validation errors
// returned by GetCommentsRsp.ValidateAll() if the designated constraints
// aren't met.
type GetCommentsRspMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m GetCommentsRspMultiError) 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 GetCommentsRspMultiError) AllErrors() []error { return m }
// GetCommentsRspValidationError is the validation error returned by
// GetCommentsRsp.Validate if the designated constraints aren't met.
type GetCommentsRspValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e GetCommentsRspValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e GetCommentsRspValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e GetCommentsRspValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e GetCommentsRspValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e GetCommentsRspValidationError) ErrorName() string { return "GetCommentsRspValidationError" }
// Error satisfies the builtin error interface
func (e GetCommentsRspValidationError) 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 %sGetCommentsRsp.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = GetCommentsRspValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = GetCommentsRspValidationError{}