// Code generated by protoc-gen-validate. DO NOT EDIT. // source: system.proto package pb 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 Setting 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 *Setting) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Setting 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 SettingMultiError, or nil if none found. func (m *Setting) ValidateAll() error { return m.validate(true) } func (m *Setting) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Id // no validation rules for CreatedAt // no validation rules for UpdatedAt if utf8.RuneCountInString(m.GetName()) > 20 { err := SettingValidationError{ field: "Name", reason: "value length must be at most 20 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetValue()) > 512 { err := SettingValidationError{ field: "Value", reason: "value length must be at most 512 runes", } if !all { return err } errors = append(errors, err) } if utf8.RuneCountInString(m.GetDescription()) > 1024 { err := SettingValidationError{ field: "Description", reason: "value length must be at most 1024 runes", } if !all { return err } errors = append(errors, err) } if len(errors) > 0 { return SettingMultiError(errors) } return nil } // SettingMultiError is an error wrapping multiple validation errors returned // by Setting.ValidateAll() if the designated constraints aren't met. type SettingMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SettingMultiError) Error() string { msgs := make([]string, 0, len(m)) for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m SettingMultiError) AllErrors() []error { return m } // SettingValidationError is the validation error returned by Setting.Validate // if the designated constraints aren't met. type SettingValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SettingValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SettingValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SettingValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SettingValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SettingValidationError) ErrorName() string { return "SettingValidationError" } // Error satisfies the builtin error interface func (e SettingValidationError) 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 %sSetting.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SettingValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SettingValidationError{} // Validate checks the field values on Activity 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 *Activity) Validate() error { return m.validate(false) } // ValidateAll checks the field values on Activity 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 ActivityMultiError, or nil // if none found. func (m *Activity) ValidateAll() error { return m.validate(true) } func (m *Activity) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Id // no validation rules for CreatedAt if l := utf8.RuneCountInString(m.GetUid()); l < 5 || l > 20 { err := ActivityValidationError{ field: "Uid", reason: "value length must be between 5 and 20 runes, inclusive", } if !all { return err } errors = append(errors, err) } // no validation rules for Action // no validation rules for Module // no validation rules for Table // no validation rules for Data if len(errors) > 0 { return ActivityMultiError(errors) } return nil } // ActivityMultiError is an error wrapping multiple validation errors returned // by Activity.ValidateAll() if the designated constraints aren't met. type ActivityMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m ActivityMultiError) Error() string { msgs := make([]string, 0, len(m)) for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m ActivityMultiError) AllErrors() []error { return m } // ActivityValidationError is the validation error returned by // Activity.Validate if the designated constraints aren't met. type ActivityValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e ActivityValidationError) Field() string { return e.field } // Reason function returns reason value. func (e ActivityValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e ActivityValidationError) Cause() error { return e.cause } // Key function returns key value. func (e ActivityValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e ActivityValidationError) ErrorName() string { return "ActivityValidationError" } // Error satisfies the builtin error interface func (e ActivityValidationError) 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 %sActivity.%s: %s%s", key, e.field, e.reason, cause) } var _ error = ActivityValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = ActivityValidationError{} // Validate checks the field values on SettingItem 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 *SettingItem) Validate() error { return m.validate(false) } // ValidateAll checks the field values on SettingItem 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 SettingItemMultiError, or // nil if none found. func (m *SettingItem) ValidateAll() error { return m.validate(true) } func (m *SettingItem) validate(all bool) error { if m == nil { return nil } var errors []error // no validation rules for Name // no validation rules for Value if len(errors) > 0 { return SettingItemMultiError(errors) } return nil } // SettingItemMultiError is an error wrapping multiple validation errors // returned by SettingItem.ValidateAll() if the designated constraints aren't met. type SettingItemMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m SettingItemMultiError) Error() string { msgs := make([]string, 0, len(m)) for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m SettingItemMultiError) AllErrors() []error { return m } // SettingItemValidationError is the validation error returned by // SettingItem.Validate if the designated constraints aren't met. type SettingItemValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e SettingItemValidationError) Field() string { return e.field } // Reason function returns reason value. func (e SettingItemValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e SettingItemValidationError) Cause() error { return e.cause } // Key function returns key value. func (e SettingItemValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e SettingItemValidationError) ErrorName() string { return "SettingItemValidationError" } // Error satisfies the builtin error interface func (e SettingItemValidationError) 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 %sSettingItem.%s: %s%s", key, e.field, e.reason, cause) } var _ error = SettingItemValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = SettingItemValidationError{} // Validate checks the field values on GetSettingRequest 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 *GetSettingRequest) Validate() error { return m.validate(false) } // ValidateAll checks the field values on GetSettingRequest 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 // GetSettingRequestMultiError, or nil if none found. func (m *GetSettingRequest) ValidateAll() error { return m.validate(true) } func (m *GetSettingRequest) validate(all bool) error { if m == nil { return nil } var errors []error if len(errors) > 0 { return GetSettingRequestMultiError(errors) } return nil } // GetSettingRequestMultiError is an error wrapping multiple validation errors // returned by GetSettingRequest.ValidateAll() if the designated constraints // aren't met. type GetSettingRequestMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m GetSettingRequestMultiError) Error() string { msgs := make([]string, 0, len(m)) for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m GetSettingRequestMultiError) AllErrors() []error { return m } // GetSettingRequestValidationError is the validation error returned by // GetSettingRequest.Validate if the designated constraints aren't met. type GetSettingRequestValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e GetSettingRequestValidationError) Field() string { return e.field } // Reason function returns reason value. func (e GetSettingRequestValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e GetSettingRequestValidationError) Cause() error { return e.cause } // Key function returns key value. func (e GetSettingRequestValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e GetSettingRequestValidationError) ErrorName() string { return "GetSettingRequestValidationError" } // Error satisfies the builtin error interface func (e GetSettingRequestValidationError) 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 %sGetSettingRequest.%s: %s%s", key, e.field, e.reason, cause) } var _ error = GetSettingRequestValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = GetSettingRequestValidationError{} // Validate checks the field values on GetSettingResponse 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 *GetSettingResponse) Validate() error { return m.validate(false) } // ValidateAll checks the field values on GetSettingResponse 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 // GetSettingResponseMultiError, or nil if none found. func (m *GetSettingResponse) ValidateAll() error { return m.validate(true) } func (m *GetSettingResponse) validate(all bool) error { if m == nil { return nil } var errors []error for idx, item := range m.GetData() { _, _ = idx, item if all { switch v := interface{}(item).(type) { case interface{ ValidateAll() error }: if err := v.ValidateAll(); err != nil { errors = append(errors, GetSettingResponseValidationError{ field: fmt.Sprintf("Data[%v]", idx), reason: "embedded message failed validation", cause: err, }) } case interface{ Validate() error }: if err := v.Validate(); err != nil { errors = append(errors, GetSettingResponseValidationError{ field: fmt.Sprintf("Data[%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 GetSettingResponseValidationError{ field: fmt.Sprintf("Data[%v]", idx), reason: "embedded message failed validation", cause: err, } } } } if len(errors) > 0 { return GetSettingResponseMultiError(errors) } return nil } // GetSettingResponseMultiError is an error wrapping multiple validation errors // returned by GetSettingResponse.ValidateAll() if the designated constraints // aren't met. type GetSettingResponseMultiError []error // Error returns a concatenation of all the error messages it wraps. func (m GetSettingResponseMultiError) Error() string { msgs := make([]string, 0, len(m)) for _, err := range m { msgs = append(msgs, err.Error()) } return strings.Join(msgs, "; ") } // AllErrors returns a list of validation violation errors. func (m GetSettingResponseMultiError) AllErrors() []error { return m } // GetSettingResponseValidationError is the validation error returned by // GetSettingResponse.Validate if the designated constraints aren't met. type GetSettingResponseValidationError struct { field string reason string cause error key bool } // Field function returns field value. func (e GetSettingResponseValidationError) Field() string { return e.field } // Reason function returns reason value. func (e GetSettingResponseValidationError) Reason() string { return e.reason } // Cause function returns cause value. func (e GetSettingResponseValidationError) Cause() error { return e.cause } // Key function returns key value. func (e GetSettingResponseValidationError) Key() bool { return e.key } // ErrorName returns error name. func (e GetSettingResponseValidationError) ErrorName() string { return "GetSettingResponseValidationError" } // Error satisfies the builtin error interface func (e GetSettingResponseValidationError) 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 %sGetSettingResponse.%s: %s%s", key, e.field, e.reason, cause) } var _ error = GetSettingResponseValidationError{} var _ interface { Field() string Reason() string Key() bool Cause() error ErrorName() string } = GetSettingResponseValidationError{}