fix: global proto name conflict
This commit is contained in:
27
buf.gen.yaml
27
buf.gen.yaml
@@ -8,30 +8,3 @@ plugins:
|
|||||||
- name: go
|
- name: go
|
||||||
out: gen/api/go
|
out: gen/api/go
|
||||||
opt: paths=source_relative
|
opt: paths=source_relative
|
||||||
|
|
||||||
# generate grpc service code
|
|
||||||
#- plugin: buf.build/grpc/go
|
|
||||||
- name: go-grpc
|
|
||||||
out: gen/api/go
|
|
||||||
opt:
|
|
||||||
- paths=source_relative
|
|
||||||
|
|
||||||
# generate rest service code
|
|
||||||
- name: go-http
|
|
||||||
out: gen/api/go
|
|
||||||
opt:
|
|
||||||
- paths=source_relative
|
|
||||||
|
|
||||||
# generate kratos errors code
|
|
||||||
- name: go-errors
|
|
||||||
out: gen/api/go
|
|
||||||
opt:
|
|
||||||
- paths=source_relative
|
|
||||||
|
|
||||||
# generate message validator code
|
|
||||||
#- plugin: buf.build/bufbuild/validate-go
|
|
||||||
- name: validate
|
|
||||||
out: gen/api/go
|
|
||||||
opt:
|
|
||||||
- paths=source_relative
|
|
||||||
- lang=go
|
|
||||||
|
|||||||
@@ -1,396 +0,0 @@
|
|||||||
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
||||||
// source: conf/v1/kratos_conf_bootstrap.proto
|
|
||||||
|
|
||||||
package conf
|
|
||||||
|
|
||||||
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 Bootstrap 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 *Bootstrap) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Bootstrap 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 BootstrapMultiError, or nil
|
|
||||||
// if none found.
|
|
||||||
func (m *Bootstrap) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Bootstrap) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetServer()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Server",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Server",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetServer()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return BootstrapValidationError{
|
|
||||||
field: "Server",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetClient()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Client",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Client",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetClient()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return BootstrapValidationError{
|
|
||||||
field: "Client",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetData()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Data",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Data",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetData()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return BootstrapValidationError{
|
|
||||||
field: "Data",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetTrace()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Trace",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Trace",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetTrace()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return BootstrapValidationError{
|
|
||||||
field: "Trace",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetLogger()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Logger",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Logger",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetLogger()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return BootstrapValidationError{
|
|
||||||
field: "Logger",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetRegistry()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Registry",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Registry",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetRegistry()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return BootstrapValidationError{
|
|
||||||
field: "Registry",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetConfig()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Config",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Config",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetConfig()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return BootstrapValidationError{
|
|
||||||
field: "Config",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetOss()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Oss",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Oss",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetOss()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return BootstrapValidationError{
|
|
||||||
field: "Oss",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetNotify()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Notify",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, BootstrapValidationError{
|
|
||||||
field: "Notify",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetNotify()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return BootstrapValidationError{
|
|
||||||
field: "Notify",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return BootstrapMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// BootstrapMultiError is an error wrapping multiple validation errors returned
|
|
||||||
// by Bootstrap.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type BootstrapMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m BootstrapMultiError) 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 BootstrapMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// BootstrapValidationError is the validation error returned by
|
|
||||||
// Bootstrap.Validate if the designated constraints aren't met.
|
|
||||||
type BootstrapValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e BootstrapValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e BootstrapValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e BootstrapValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e BootstrapValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e BootstrapValidationError) ErrorName() string { return "BootstrapValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e BootstrapValidationError) 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 %sBootstrap.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = BootstrapValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = BootstrapValidationError{}
|
|
||||||
@@ -1,506 +0,0 @@
|
|||||||
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
||||||
// source: conf/v1/kratos_conf_client.proto
|
|
||||||
|
|
||||||
package conf
|
|
||||||
|
|
||||||
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 Client 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 *Client) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Client 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 ClientMultiError, or nil if none found.
|
|
||||||
func (m *Client) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Client) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetRest()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, ClientValidationError{
|
|
||||||
field: "Rest",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, ClientValidationError{
|
|
||||||
field: "Rest",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetRest()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return ClientValidationError{
|
|
||||||
field: "Rest",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetGrpc()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, ClientValidationError{
|
|
||||||
field: "Grpc",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, ClientValidationError{
|
|
||||||
field: "Grpc",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetGrpc()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return ClientValidationError{
|
|
||||||
field: "Grpc",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return ClientMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// ClientMultiError is an error wrapping multiple validation errors returned by
|
|
||||||
// Client.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type ClientMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m ClientMultiError) 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 ClientMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// ClientValidationError is the validation error returned by Client.Validate if
|
|
||||||
// the designated constraints aren't met.
|
|
||||||
type ClientValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e ClientValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e ClientValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e ClientValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e ClientValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e ClientValidationError) ErrorName() string { return "ClientValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e ClientValidationError) 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 %sClient.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = ClientValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = ClientValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Client_REST 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 *Client_REST) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Client_REST 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 Client_RESTMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Client_REST) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Client_REST) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetTimeout()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, Client_RESTValidationError{
|
|
||||||
field: "Timeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, Client_RESTValidationError{
|
|
||||||
field: "Timeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return Client_RESTValidationError{
|
|
||||||
field: "Timeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetMiddleware()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, Client_RESTValidationError{
|
|
||||||
field: "Middleware",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, Client_RESTValidationError{
|
|
||||||
field: "Middleware",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetMiddleware()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return Client_RESTValidationError{
|
|
||||||
field: "Middleware",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Client_RESTMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Client_RESTMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Client_REST.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type Client_RESTMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Client_RESTMultiError) 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 Client_RESTMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Client_RESTValidationError is the validation error returned by
|
|
||||||
// Client_REST.Validate if the designated constraints aren't met.
|
|
||||||
type Client_RESTValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Client_RESTValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Client_RESTValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Client_RESTValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Client_RESTValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Client_RESTValidationError) ErrorName() string { return "Client_RESTValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Client_RESTValidationError) 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 %sClient_REST.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Client_RESTValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Client_RESTValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Client_GRPC 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 *Client_GRPC) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Client_GRPC 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 Client_GRPCMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Client_GRPC) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Client_GRPC) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetTimeout()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, Client_GRPCValidationError{
|
|
||||||
field: "Timeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, Client_GRPCValidationError{
|
|
||||||
field: "Timeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return Client_GRPCValidationError{
|
|
||||||
field: "Timeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetMiddleware()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, Client_GRPCValidationError{
|
|
||||||
field: "Middleware",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, Client_GRPCValidationError{
|
|
||||||
field: "Middleware",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetMiddleware()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return Client_GRPCValidationError{
|
|
||||||
field: "Middleware",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Client_GRPCMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Client_GRPCMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Client_GRPC.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type Client_GRPCMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Client_GRPCMultiError) 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 Client_GRPCMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Client_GRPCValidationError is the validation error returned by
|
|
||||||
// Client_GRPC.Validate if the designated constraints aren't met.
|
|
||||||
type Client_GRPCValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Client_GRPCValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Client_GRPCValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Client_GRPCValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Client_GRPCValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Client_GRPCValidationError) ErrorName() string { return "Client_GRPCValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Client_GRPCValidationError) 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 %sClient_GRPC.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Client_GRPCValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Client_GRPCValidationError{}
|
|
||||||
@@ -1,978 +0,0 @@
|
|||||||
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
||||||
// source: conf/v1/kratos_conf_config.proto
|
|
||||||
|
|
||||||
package conf
|
|
||||||
|
|
||||||
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 RemoteConfig 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 *RemoteConfig) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on RemoteConfig 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 RemoteConfigMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *RemoteConfig) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RemoteConfig) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Type
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetEtcd()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Etcd",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Etcd",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetEtcd()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return RemoteConfigValidationError{
|
|
||||||
field: "Etcd",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetConsul()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Consul",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Consul",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetConsul()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return RemoteConfigValidationError{
|
|
||||||
field: "Consul",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetNacos()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Nacos",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Nacos",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetNacos()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return RemoteConfigValidationError{
|
|
||||||
field: "Nacos",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetApollo()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Apollo",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Apollo",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetApollo()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return RemoteConfigValidationError{
|
|
||||||
field: "Apollo",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetKubernetes()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Kubernetes",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Kubernetes",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetKubernetes()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return RemoteConfigValidationError{
|
|
||||||
field: "Kubernetes",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetPolaris()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Polaris",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfigValidationError{
|
|
||||||
field: "Polaris",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetPolaris()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return RemoteConfigValidationError{
|
|
||||||
field: "Polaris",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return RemoteConfigMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoteConfigMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by RemoteConfig.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type RemoteConfigMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m RemoteConfigMultiError) 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 RemoteConfigMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// RemoteConfigValidationError is the validation error returned by
|
|
||||||
// RemoteConfig.Validate if the designated constraints aren't met.
|
|
||||||
type RemoteConfigValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e RemoteConfigValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e RemoteConfigValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e RemoteConfigValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e RemoteConfigValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e RemoteConfigValidationError) ErrorName() string { return "RemoteConfigValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e RemoteConfigValidationError) 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 %sRemoteConfig.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = RemoteConfigValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = RemoteConfigValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on RemoteConfig_Nacos 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 *RemoteConfig_Nacos) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on RemoteConfig_Nacos 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
|
|
||||||
// RemoteConfig_NacosMultiError, or nil if none found.
|
|
||||||
func (m *RemoteConfig_Nacos) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RemoteConfig_Nacos) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Address
|
|
||||||
|
|
||||||
// no validation rules for Port
|
|
||||||
|
|
||||||
// no validation rules for Key
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return RemoteConfig_NacosMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoteConfig_NacosMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by RemoteConfig_Nacos.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type RemoteConfig_NacosMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m RemoteConfig_NacosMultiError) 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 RemoteConfig_NacosMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// RemoteConfig_NacosValidationError is the validation error returned by
|
|
||||||
// RemoteConfig_Nacos.Validate if the designated constraints aren't met.
|
|
||||||
type RemoteConfig_NacosValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e RemoteConfig_NacosValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e RemoteConfig_NacosValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e RemoteConfig_NacosValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e RemoteConfig_NacosValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e RemoteConfig_NacosValidationError) ErrorName() string {
|
|
||||||
return "RemoteConfig_NacosValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e RemoteConfig_NacosValidationError) 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 %sRemoteConfig_Nacos.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = RemoteConfig_NacosValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = RemoteConfig_NacosValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on RemoteConfig_Etcd 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 *RemoteConfig_Etcd) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on RemoteConfig_Etcd 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
|
|
||||||
// RemoteConfig_EtcdMultiError, or nil if none found.
|
|
||||||
func (m *RemoteConfig_Etcd) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RemoteConfig_Etcd) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetTimeout()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfig_EtcdValidationError{
|
|
||||||
field: "Timeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, RemoteConfig_EtcdValidationError{
|
|
||||||
field: "Timeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetTimeout()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return RemoteConfig_EtcdValidationError{
|
|
||||||
field: "Timeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// no validation rules for Key
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return RemoteConfig_EtcdMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoteConfig_EtcdMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by RemoteConfig_Etcd.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type RemoteConfig_EtcdMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m RemoteConfig_EtcdMultiError) 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 RemoteConfig_EtcdMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// RemoteConfig_EtcdValidationError is the validation error returned by
|
|
||||||
// RemoteConfig_Etcd.Validate if the designated constraints aren't met.
|
|
||||||
type RemoteConfig_EtcdValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e RemoteConfig_EtcdValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e RemoteConfig_EtcdValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e RemoteConfig_EtcdValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e RemoteConfig_EtcdValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e RemoteConfig_EtcdValidationError) ErrorName() string {
|
|
||||||
return "RemoteConfig_EtcdValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e RemoteConfig_EtcdValidationError) 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 %sRemoteConfig_Etcd.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = RemoteConfig_EtcdValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = RemoteConfig_EtcdValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on RemoteConfig_Consul 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 *RemoteConfig_Consul) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on RemoteConfig_Consul 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
|
|
||||||
// RemoteConfig_ConsulMultiError, or nil if none found.
|
|
||||||
func (m *RemoteConfig_Consul) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RemoteConfig_Consul) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Scheme
|
|
||||||
|
|
||||||
// no validation rules for Address
|
|
||||||
|
|
||||||
// no validation rules for Key
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return RemoteConfig_ConsulMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoteConfig_ConsulMultiError is an error wrapping multiple validation
|
|
||||||
// errors returned by RemoteConfig_Consul.ValidateAll() if the designated
|
|
||||||
// constraints aren't met.
|
|
||||||
type RemoteConfig_ConsulMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m RemoteConfig_ConsulMultiError) 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 RemoteConfig_ConsulMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// RemoteConfig_ConsulValidationError is the validation error returned by
|
|
||||||
// RemoteConfig_Consul.Validate if the designated constraints aren't met.
|
|
||||||
type RemoteConfig_ConsulValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e RemoteConfig_ConsulValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e RemoteConfig_ConsulValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e RemoteConfig_ConsulValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e RemoteConfig_ConsulValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e RemoteConfig_ConsulValidationError) ErrorName() string {
|
|
||||||
return "RemoteConfig_ConsulValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e RemoteConfig_ConsulValidationError) 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 %sRemoteConfig_Consul.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = RemoteConfig_ConsulValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = RemoteConfig_ConsulValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on RemoteConfig_Apollo 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 *RemoteConfig_Apollo) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on RemoteConfig_Apollo 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
|
|
||||||
// RemoteConfig_ApolloMultiError, or nil if none found.
|
|
||||||
func (m *RemoteConfig_Apollo) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RemoteConfig_Apollo) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Endpoint
|
|
||||||
|
|
||||||
// no validation rules for AppId
|
|
||||||
|
|
||||||
// no validation rules for Cluster
|
|
||||||
|
|
||||||
// no validation rules for Namespace
|
|
||||||
|
|
||||||
// no validation rules for Secret
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return RemoteConfig_ApolloMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoteConfig_ApolloMultiError is an error wrapping multiple validation
|
|
||||||
// errors returned by RemoteConfig_Apollo.ValidateAll() if the designated
|
|
||||||
// constraints aren't met.
|
|
||||||
type RemoteConfig_ApolloMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m RemoteConfig_ApolloMultiError) 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 RemoteConfig_ApolloMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// RemoteConfig_ApolloValidationError is the validation error returned by
|
|
||||||
// RemoteConfig_Apollo.Validate if the designated constraints aren't met.
|
|
||||||
type RemoteConfig_ApolloValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e RemoteConfig_ApolloValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e RemoteConfig_ApolloValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e RemoteConfig_ApolloValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e RemoteConfig_ApolloValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e RemoteConfig_ApolloValidationError) ErrorName() string {
|
|
||||||
return "RemoteConfig_ApolloValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e RemoteConfig_ApolloValidationError) 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 %sRemoteConfig_Apollo.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = RemoteConfig_ApolloValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = RemoteConfig_ApolloValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on RemoteConfig_Kubernetes 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 *RemoteConfig_Kubernetes) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on RemoteConfig_Kubernetes 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
|
|
||||||
// RemoteConfig_KubernetesMultiError, or nil if none found.
|
|
||||||
func (m *RemoteConfig_Kubernetes) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RemoteConfig_Kubernetes) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Namespace
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return RemoteConfig_KubernetesMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoteConfig_KubernetesMultiError is an error wrapping multiple validation
|
|
||||||
// errors returned by RemoteConfig_Kubernetes.ValidateAll() if the designated
|
|
||||||
// constraints aren't met.
|
|
||||||
type RemoteConfig_KubernetesMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m RemoteConfig_KubernetesMultiError) 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 RemoteConfig_KubernetesMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// RemoteConfig_KubernetesValidationError is the validation error returned by
|
|
||||||
// RemoteConfig_Kubernetes.Validate if the designated constraints aren't met.
|
|
||||||
type RemoteConfig_KubernetesValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e RemoteConfig_KubernetesValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e RemoteConfig_KubernetesValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e RemoteConfig_KubernetesValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e RemoteConfig_KubernetesValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e RemoteConfig_KubernetesValidationError) ErrorName() string {
|
|
||||||
return "RemoteConfig_KubernetesValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e RemoteConfig_KubernetesValidationError) 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 %sRemoteConfig_Kubernetes.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = RemoteConfig_KubernetesValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = RemoteConfig_KubernetesValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on RemoteConfig_Polaris 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 *RemoteConfig_Polaris) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on RemoteConfig_Polaris 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
|
|
||||||
// RemoteConfig_PolarisMultiError, or nil if none found.
|
|
||||||
func (m *RemoteConfig_Polaris) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *RemoteConfig_Polaris) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return RemoteConfig_PolarisMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// RemoteConfig_PolarisMultiError is an error wrapping multiple validation
|
|
||||||
// errors returned by RemoteConfig_Polaris.ValidateAll() if the designated
|
|
||||||
// constraints aren't met.
|
|
||||||
type RemoteConfig_PolarisMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m RemoteConfig_PolarisMultiError) 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 RemoteConfig_PolarisMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// RemoteConfig_PolarisValidationError is the validation error returned by
|
|
||||||
// RemoteConfig_Polaris.Validate if the designated constraints aren't met.
|
|
||||||
type RemoteConfig_PolarisValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e RemoteConfig_PolarisValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e RemoteConfig_PolarisValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e RemoteConfig_PolarisValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e RemoteConfig_PolarisValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e RemoteConfig_PolarisValidationError) ErrorName() string {
|
|
||||||
return "RemoteConfig_PolarisValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e RemoteConfig_PolarisValidationError) 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 %sRemoteConfig_Polaris.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = RemoteConfig_PolarisValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = RemoteConfig_PolarisValidationError{}
|
|
||||||
@@ -1,527 +0,0 @@
|
|||||||
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
||||||
// source: conf/v1/kratos_conf_data.proto
|
|
||||||
|
|
||||||
package conf
|
|
||||||
|
|
||||||
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 Data 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 *Data) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Data 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 DataMultiError, or nil if none found.
|
|
||||||
func (m *Data) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Data) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetDatabase()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, DataValidationError{
|
|
||||||
field: "Database",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, DataValidationError{
|
|
||||||
field: "Database",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetDatabase()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return DataValidationError{
|
|
||||||
field: "Database",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetRedis()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, DataValidationError{
|
|
||||||
field: "Redis",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, DataValidationError{
|
|
||||||
field: "Redis",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetRedis()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return DataValidationError{
|
|
||||||
field: "Redis",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return DataMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// DataMultiError is an error wrapping multiple validation errors returned by
|
|
||||||
// Data.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type DataMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m DataMultiError) 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 DataMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// DataValidationError is the validation error returned by Data.Validate if the
|
|
||||||
// designated constraints aren't met.
|
|
||||||
type DataValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e DataValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e DataValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e DataValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e DataValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e DataValidationError) ErrorName() string { return "DataValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e DataValidationError) 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 %sData.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = DataValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = DataValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Data_Database 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 *Data_Database) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Data_Database 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 Data_DatabaseMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Data_Database) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Data_Database) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Driver
|
|
||||||
|
|
||||||
// no validation rules for Source
|
|
||||||
|
|
||||||
// no validation rules for Migrate
|
|
||||||
|
|
||||||
// no validation rules for Debug
|
|
||||||
|
|
||||||
// no validation rules for MaxIdleConnections
|
|
||||||
|
|
||||||
// no validation rules for MaxOpenConnections
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetConnectionMaxLifetime()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, Data_DatabaseValidationError{
|
|
||||||
field: "ConnectionMaxLifetime",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, Data_DatabaseValidationError{
|
|
||||||
field: "ConnectionMaxLifetime",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetConnectionMaxLifetime()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return Data_DatabaseValidationError{
|
|
||||||
field: "ConnectionMaxLifetime",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Data_DatabaseMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data_DatabaseMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Data_Database.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type Data_DatabaseMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Data_DatabaseMultiError) 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 Data_DatabaseMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Data_DatabaseValidationError is the validation error returned by
|
|
||||||
// Data_Database.Validate if the designated constraints aren't met.
|
|
||||||
type Data_DatabaseValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Data_DatabaseValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Data_DatabaseValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Data_DatabaseValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Data_DatabaseValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Data_DatabaseValidationError) ErrorName() string { return "Data_DatabaseValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Data_DatabaseValidationError) 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 %sData_Database.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Data_DatabaseValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Data_DatabaseValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Data_Redis 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 *Data_Redis) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Data_Redis 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 Data_RedisMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Data_Redis) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Data_Redis) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Network
|
|
||||||
|
|
||||||
// no validation rules for Addr
|
|
||||||
|
|
||||||
// no validation rules for Password
|
|
||||||
|
|
||||||
// no validation rules for Db
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetDialTimeout()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, Data_RedisValidationError{
|
|
||||||
field: "DialTimeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, Data_RedisValidationError{
|
|
||||||
field: "DialTimeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetDialTimeout()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return Data_RedisValidationError{
|
|
||||||
field: "DialTimeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetReadTimeout()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, Data_RedisValidationError{
|
|
||||||
field: "ReadTimeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, Data_RedisValidationError{
|
|
||||||
field: "ReadTimeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetReadTimeout()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return Data_RedisValidationError{
|
|
||||||
field: "ReadTimeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetWriteTimeout()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, Data_RedisValidationError{
|
|
||||||
field: "WriteTimeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, Data_RedisValidationError{
|
|
||||||
field: "WriteTimeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetWriteTimeout()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return Data_RedisValidationError{
|
|
||||||
field: "WriteTimeout",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Data_RedisMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Data_RedisMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Data_Redis.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type Data_RedisMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Data_RedisMultiError) 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 Data_RedisMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Data_RedisValidationError is the validation error returned by
|
|
||||||
// Data_Redis.Validate if the designated constraints aren't met.
|
|
||||||
type Data_RedisValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Data_RedisValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Data_RedisValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Data_RedisValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Data_RedisValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Data_RedisValidationError) ErrorName() string { return "Data_RedisValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Data_RedisValidationError) 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 %sData_Redis.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Data_RedisValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Data_RedisValidationError{}
|
|
||||||
@@ -1,818 +0,0 @@
|
|||||||
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
||||||
// source: conf/v1/kratos_conf_logger.proto
|
|
||||||
|
|
||||||
package conf
|
|
||||||
|
|
||||||
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 Logger 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 *Logger) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Logger 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 LoggerMultiError, or nil if none found.
|
|
||||||
func (m *Logger) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Logger) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Type
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetZap()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Zap",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Zap",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetZap()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return LoggerValidationError{
|
|
||||||
field: "Zap",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetLogrus()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Logrus",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Logrus",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetLogrus()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return LoggerValidationError{
|
|
||||||
field: "Logrus",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetFluent()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Fluent",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Fluent",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetFluent()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return LoggerValidationError{
|
|
||||||
field: "Fluent",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetAliyun()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Aliyun",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Aliyun",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetAliyun()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return LoggerValidationError{
|
|
||||||
field: "Aliyun",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetTencent()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Tencent",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, LoggerValidationError{
|
|
||||||
field: "Tencent",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetTencent()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return LoggerValidationError{
|
|
||||||
field: "Tencent",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return LoggerMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// LoggerMultiError is an error wrapping multiple validation errors returned by
|
|
||||||
// Logger.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type LoggerMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m LoggerMultiError) 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 LoggerMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// LoggerValidationError is the validation error returned by Logger.Validate if
|
|
||||||
// the designated constraints aren't met.
|
|
||||||
type LoggerValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e LoggerValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e LoggerValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e LoggerValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e LoggerValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e LoggerValidationError) ErrorName() string { return "LoggerValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e LoggerValidationError) 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 %sLogger.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = LoggerValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = LoggerValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Logger_Zap 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 *Logger_Zap) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Logger_Zap 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 Logger_ZapMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Logger_Zap) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Logger_Zap) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Filename
|
|
||||||
|
|
||||||
// no validation rules for Level
|
|
||||||
|
|
||||||
// no validation rules for MaxSize
|
|
||||||
|
|
||||||
// no validation rules for MaxAge
|
|
||||||
|
|
||||||
// no validation rules for MaxBackups
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Logger_ZapMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logger_ZapMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Logger_Zap.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type Logger_ZapMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Logger_ZapMultiError) 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 Logger_ZapMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Logger_ZapValidationError is the validation error returned by
|
|
||||||
// Logger_Zap.Validate if the designated constraints aren't met.
|
|
||||||
type Logger_ZapValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Logger_ZapValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Logger_ZapValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Logger_ZapValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Logger_ZapValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Logger_ZapValidationError) ErrorName() string { return "Logger_ZapValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Logger_ZapValidationError) 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 %sLogger_Zap.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Logger_ZapValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Logger_ZapValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Logger_Logrus 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 *Logger_Logrus) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Logger_Logrus 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 Logger_LogrusMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Logger_Logrus) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Logger_Logrus) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Level
|
|
||||||
|
|
||||||
// no validation rules for Formatter
|
|
||||||
|
|
||||||
// no validation rules for TimestampFormat
|
|
||||||
|
|
||||||
// no validation rules for DisableColors
|
|
||||||
|
|
||||||
// no validation rules for DisableTimestamp
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Logger_LogrusMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logger_LogrusMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Logger_Logrus.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type Logger_LogrusMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Logger_LogrusMultiError) 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 Logger_LogrusMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Logger_LogrusValidationError is the validation error returned by
|
|
||||||
// Logger_Logrus.Validate if the designated constraints aren't met.
|
|
||||||
type Logger_LogrusValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Logger_LogrusValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Logger_LogrusValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Logger_LogrusValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Logger_LogrusValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Logger_LogrusValidationError) ErrorName() string { return "Logger_LogrusValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Logger_LogrusValidationError) 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 %sLogger_Logrus.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Logger_LogrusValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Logger_LogrusValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Logger_Fluent 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 *Logger_Fluent) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Logger_Fluent 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 Logger_FluentMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Logger_Fluent) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Logger_Fluent) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Endpoint
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Logger_FluentMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logger_FluentMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Logger_Fluent.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type Logger_FluentMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Logger_FluentMultiError) 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 Logger_FluentMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Logger_FluentValidationError is the validation error returned by
|
|
||||||
// Logger_Fluent.Validate if the designated constraints aren't met.
|
|
||||||
type Logger_FluentValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Logger_FluentValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Logger_FluentValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Logger_FluentValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Logger_FluentValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Logger_FluentValidationError) ErrorName() string { return "Logger_FluentValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Logger_FluentValidationError) 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 %sLogger_Fluent.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Logger_FluentValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Logger_FluentValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Logger_Aliyun 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 *Logger_Aliyun) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Logger_Aliyun 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 Logger_AliyunMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Logger_Aliyun) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Logger_Aliyun) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Endpoint
|
|
||||||
|
|
||||||
// no validation rules for Project
|
|
||||||
|
|
||||||
// no validation rules for AccessKey
|
|
||||||
|
|
||||||
// no validation rules for AccessSecret
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Logger_AliyunMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logger_AliyunMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Logger_Aliyun.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type Logger_AliyunMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Logger_AliyunMultiError) 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 Logger_AliyunMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Logger_AliyunValidationError is the validation error returned by
|
|
||||||
// Logger_Aliyun.Validate if the designated constraints aren't met.
|
|
||||||
type Logger_AliyunValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Logger_AliyunValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Logger_AliyunValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Logger_AliyunValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Logger_AliyunValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Logger_AliyunValidationError) ErrorName() string { return "Logger_AliyunValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Logger_AliyunValidationError) 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 %sLogger_Aliyun.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Logger_AliyunValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Logger_AliyunValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Logger_Tencent 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 *Logger_Tencent) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Logger_Tencent 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 Logger_TencentMultiError,
|
|
||||||
// or nil if none found.
|
|
||||||
func (m *Logger_Tencent) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Logger_Tencent) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Endpoint
|
|
||||||
|
|
||||||
// no validation rules for TopicId
|
|
||||||
|
|
||||||
// no validation rules for AccessKey
|
|
||||||
|
|
||||||
// no validation rules for AccessSecret
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Logger_TencentMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Logger_TencentMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Logger_Tencent.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type Logger_TencentMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Logger_TencentMultiError) 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 Logger_TencentMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Logger_TencentValidationError is the validation error returned by
|
|
||||||
// Logger_Tencent.Validate if the designated constraints aren't met.
|
|
||||||
type Logger_TencentValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Logger_TencentValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Logger_TencentValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Logger_TencentValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Logger_TencentValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Logger_TencentValidationError) ErrorName() string { return "Logger_TencentValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Logger_TencentValidationError) 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 %sLogger_Tencent.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Logger_TencentValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Logger_TencentValidationError{}
|
|
||||||
@@ -1,550 +0,0 @@
|
|||||||
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
||||||
// source: conf/v1/kratos_conf_middleware.proto
|
|
||||||
|
|
||||||
package conf
|
|
||||||
|
|
||||||
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 Middleware 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 *Middleware) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Middleware 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 MiddlewareMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Middleware) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Middleware) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for EnableLogging
|
|
||||||
|
|
||||||
// no validation rules for EnableRecovery
|
|
||||||
|
|
||||||
// no validation rules for EnableTracing
|
|
||||||
|
|
||||||
// no validation rules for EnableValidate
|
|
||||||
|
|
||||||
// no validation rules for EnableCircuitBreaker
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetLimiter()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, MiddlewareValidationError{
|
|
||||||
field: "Limiter",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, MiddlewareValidationError{
|
|
||||||
field: "Limiter",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetLimiter()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return MiddlewareValidationError{
|
|
||||||
field: "Limiter",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetMetrics()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, MiddlewareValidationError{
|
|
||||||
field: "Metrics",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, MiddlewareValidationError{
|
|
||||||
field: "Metrics",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetMetrics()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return MiddlewareValidationError{
|
|
||||||
field: "Metrics",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetAuth()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, MiddlewareValidationError{
|
|
||||||
field: "Auth",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, MiddlewareValidationError{
|
|
||||||
field: "Auth",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetAuth()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return MiddlewareValidationError{
|
|
||||||
field: "Auth",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return MiddlewareMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// MiddlewareMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Middleware.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type MiddlewareMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m MiddlewareMultiError) 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 MiddlewareMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// MiddlewareValidationError is the validation error returned by
|
|
||||||
// Middleware.Validate if the designated constraints aren't met.
|
|
||||||
type MiddlewareValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e MiddlewareValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e MiddlewareValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e MiddlewareValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e MiddlewareValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e MiddlewareValidationError) ErrorName() string { return "MiddlewareValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e MiddlewareValidationError) 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 %sMiddleware.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = MiddlewareValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = MiddlewareValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Middleware_Auth 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 *Middleware_Auth) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Middleware_Auth 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
|
|
||||||
// Middleware_AuthMultiError, or nil if none found.
|
|
||||||
func (m *Middleware_Auth) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Middleware_Auth) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Method
|
|
||||||
|
|
||||||
// no validation rules for Key
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Middleware_AuthMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Middleware_AuthMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Middleware_Auth.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type Middleware_AuthMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Middleware_AuthMultiError) 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 Middleware_AuthMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Middleware_AuthValidationError is the validation error returned by
|
|
||||||
// Middleware_Auth.Validate if the designated constraints aren't met.
|
|
||||||
type Middleware_AuthValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Middleware_AuthValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Middleware_AuthValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Middleware_AuthValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Middleware_AuthValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Middleware_AuthValidationError) ErrorName() string { return "Middleware_AuthValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Middleware_AuthValidationError) 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 %sMiddleware_Auth.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Middleware_AuthValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Middleware_AuthValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Middleware_RateLimiter 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 *Middleware_RateLimiter) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Middleware_RateLimiter 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
|
|
||||||
// Middleware_RateLimiterMultiError, or nil if none found.
|
|
||||||
func (m *Middleware_RateLimiter) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Middleware_RateLimiter) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Name
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Middleware_RateLimiterMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Middleware_RateLimiterMultiError is an error wrapping multiple validation
|
|
||||||
// errors returned by Middleware_RateLimiter.ValidateAll() if the designated
|
|
||||||
// constraints aren't met.
|
|
||||||
type Middleware_RateLimiterMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Middleware_RateLimiterMultiError) 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 Middleware_RateLimiterMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Middleware_RateLimiterValidationError is the validation error returned by
|
|
||||||
// Middleware_RateLimiter.Validate if the designated constraints aren't met.
|
|
||||||
type Middleware_RateLimiterValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Middleware_RateLimiterValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Middleware_RateLimiterValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Middleware_RateLimiterValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Middleware_RateLimiterValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Middleware_RateLimiterValidationError) ErrorName() string {
|
|
||||||
return "Middleware_RateLimiterValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Middleware_RateLimiterValidationError) 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 %sMiddleware_RateLimiter.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Middleware_RateLimiterValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Middleware_RateLimiterValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Middleware_Metrics 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 *Middleware_Metrics) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Middleware_Metrics 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
|
|
||||||
// Middleware_MetricsMultiError, or nil if none found.
|
|
||||||
func (m *Middleware_Metrics) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Middleware_Metrics) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Histogram
|
|
||||||
|
|
||||||
// no validation rules for Counter
|
|
||||||
|
|
||||||
// no validation rules for Gauge
|
|
||||||
|
|
||||||
// no validation rules for Summary
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Middleware_MetricsMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Middleware_MetricsMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Middleware_Metrics.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type Middleware_MetricsMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Middleware_MetricsMultiError) 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 Middleware_MetricsMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Middleware_MetricsValidationError is the validation error returned by
|
|
||||||
// Middleware_Metrics.Validate if the designated constraints aren't met.
|
|
||||||
type Middleware_MetricsValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Middleware_MetricsValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Middleware_MetricsValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Middleware_MetricsValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Middleware_MetricsValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Middleware_MetricsValidationError) ErrorName() string {
|
|
||||||
return "Middleware_MetricsValidationError"
|
|
||||||
}
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Middleware_MetricsValidationError) 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 %sMiddleware_Metrics.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Middleware_MetricsValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Middleware_MetricsValidationError{}
|
|
||||||
@@ -1,272 +0,0 @@
|
|||||||
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
||||||
// source: conf/v1/kratos_conf_notify.proto
|
|
||||||
|
|
||||||
package conf
|
|
||||||
|
|
||||||
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 Notification 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 *Notification) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Notification 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 NotificationMultiError, or
|
|
||||||
// nil if none found.
|
|
||||||
func (m *Notification) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Notification) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetSms()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, NotificationValidationError{
|
|
||||||
field: "Sms",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, NotificationValidationError{
|
|
||||||
field: "Sms",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetSms()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return NotificationValidationError{
|
|
||||||
field: "Sms",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return NotificationMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// NotificationMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Notification.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type NotificationMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m NotificationMultiError) 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 NotificationMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// NotificationValidationError is the validation error returned by
|
|
||||||
// Notification.Validate if the designated constraints aren't met.
|
|
||||||
type NotificationValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e NotificationValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e NotificationValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e NotificationValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e NotificationValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e NotificationValidationError) ErrorName() string { return "NotificationValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e NotificationValidationError) 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 %sNotification.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = NotificationValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = NotificationValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on Notification_SMS 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 *Notification_SMS) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Notification_SMS 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
|
|
||||||
// Notification_SMSMultiError, or nil if none found.
|
|
||||||
func (m *Notification_SMS) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Notification_SMS) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Endpoint
|
|
||||||
|
|
||||||
// no validation rules for RegionId
|
|
||||||
|
|
||||||
// no validation rules for AccessKeyId
|
|
||||||
|
|
||||||
// no validation rules for AccessKeySecret
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return Notification_SMSMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notification_SMSMultiError is an error wrapping multiple validation errors
|
|
||||||
// returned by Notification_SMS.ValidateAll() if the designated constraints
|
|
||||||
// aren't met.
|
|
||||||
type Notification_SMSMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m Notification_SMSMultiError) 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 Notification_SMSMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// Notification_SMSValidationError is the validation error returned by
|
|
||||||
// Notification_SMS.Validate if the designated constraints aren't met.
|
|
||||||
type Notification_SMSValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e Notification_SMSValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e Notification_SMSValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e Notification_SMSValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e Notification_SMSValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e Notification_SMSValidationError) ErrorName() string { return "Notification_SMSValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e Notification_SMSValidationError) 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 %sNotification_SMS.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = Notification_SMSValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = Notification_SMSValidationError{}
|
|
||||||
@@ -1,276 +0,0 @@
|
|||||||
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
||||||
// source: conf/v1/kratos_conf_oss.proto
|
|
||||||
|
|
||||||
package conf
|
|
||||||
|
|
||||||
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 OSS 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 *OSS) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on OSS 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 OSSMultiError, or nil if none found.
|
|
||||||
func (m *OSS) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *OSS) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
if all {
|
|
||||||
switch v := interface{}(m.GetMinio()).(type) {
|
|
||||||
case interface{ ValidateAll() error }:
|
|
||||||
if err := v.ValidateAll(); err != nil {
|
|
||||||
errors = append(errors, OSSValidationError{
|
|
||||||
field: "Minio",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
case interface{ Validate() error }:
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
errors = append(errors, OSSValidationError{
|
|
||||||
field: "Minio",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if v, ok := interface{}(m.GetMinio()).(interface{ Validate() error }); ok {
|
|
||||||
if err := v.Validate(); err != nil {
|
|
||||||
return OSSValidationError{
|
|
||||||
field: "Minio",
|
|
||||||
reason: "embedded message failed validation",
|
|
||||||
cause: err,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return OSSMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// OSSMultiError is an error wrapping multiple validation errors returned by
|
|
||||||
// OSS.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type OSSMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m OSSMultiError) 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 OSSMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// OSSValidationError is the validation error returned by OSS.Validate if the
|
|
||||||
// designated constraints aren't met.
|
|
||||||
type OSSValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e OSSValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e OSSValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e OSSValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e OSSValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e OSSValidationError) ErrorName() string { return "OSSValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e OSSValidationError) 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 %sOSS.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = OSSValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = OSSValidationError{}
|
|
||||||
|
|
||||||
// Validate checks the field values on OSS_MinIO 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 *OSS_MinIO) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on OSS_MinIO 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 OSS_MinIOMultiError, or nil
|
|
||||||
// if none found.
|
|
||||||
func (m *OSS_MinIO) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *OSS_MinIO) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Endpoint
|
|
||||||
|
|
||||||
// no validation rules for AccessKey
|
|
||||||
|
|
||||||
// no validation rules for SecretKey
|
|
||||||
|
|
||||||
// no validation rules for Token
|
|
||||||
|
|
||||||
// no validation rules for UseSsl
|
|
||||||
|
|
||||||
// no validation rules for UploadHost
|
|
||||||
|
|
||||||
// no validation rules for DownloadHost
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return OSS_MinIOMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// OSS_MinIOMultiError is an error wrapping multiple validation errors returned
|
|
||||||
// by OSS_MinIO.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type OSS_MinIOMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m OSS_MinIOMultiError) 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 OSS_MinIOMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// OSS_MinIOValidationError is the validation error returned by
|
|
||||||
// OSS_MinIO.Validate if the designated constraints aren't met.
|
|
||||||
type OSS_MinIOValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e OSS_MinIOValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e OSS_MinIOValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e OSS_MinIOValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e OSS_MinIOValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e OSS_MinIOValidationError) ErrorName() string { return "OSS_MinIOValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e OSS_MinIOValidationError) 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 %sOSS_MinIO.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = OSS_MinIOValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = OSS_MinIOValidationError{}
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,142 +0,0 @@
|
|||||||
// Code generated by protoc-gen-validate. DO NOT EDIT.
|
|
||||||
// source: conf/v1/kratos_conf_tracer.proto
|
|
||||||
|
|
||||||
package conf
|
|
||||||
|
|
||||||
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 Tracer 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 *Tracer) Validate() error {
|
|
||||||
return m.validate(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// ValidateAll checks the field values on Tracer 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 TracerMultiError, or nil if none found.
|
|
||||||
func (m *Tracer) ValidateAll() error {
|
|
||||||
return m.validate(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (m *Tracer) validate(all bool) error {
|
|
||||||
if m == nil {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
var errors []error
|
|
||||||
|
|
||||||
// no validation rules for Batcher
|
|
||||||
|
|
||||||
// no validation rules for Endpoint
|
|
||||||
|
|
||||||
// no validation rules for Sampler
|
|
||||||
|
|
||||||
// no validation rules for Env
|
|
||||||
|
|
||||||
if len(errors) > 0 {
|
|
||||||
return TracerMultiError(errors)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// TracerMultiError is an error wrapping multiple validation errors returned by
|
|
||||||
// Tracer.ValidateAll() if the designated constraints aren't met.
|
|
||||||
type TracerMultiError []error
|
|
||||||
|
|
||||||
// Error returns a concatenation of all the error messages it wraps.
|
|
||||||
func (m TracerMultiError) 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 TracerMultiError) AllErrors() []error { return m }
|
|
||||||
|
|
||||||
// TracerValidationError is the validation error returned by Tracer.Validate if
|
|
||||||
// the designated constraints aren't met.
|
|
||||||
type TracerValidationError struct {
|
|
||||||
field string
|
|
||||||
reason string
|
|
||||||
cause error
|
|
||||||
key bool
|
|
||||||
}
|
|
||||||
|
|
||||||
// Field function returns field value.
|
|
||||||
func (e TracerValidationError) Field() string { return e.field }
|
|
||||||
|
|
||||||
// Reason function returns reason value.
|
|
||||||
func (e TracerValidationError) Reason() string { return e.reason }
|
|
||||||
|
|
||||||
// Cause function returns cause value.
|
|
||||||
func (e TracerValidationError) Cause() error { return e.cause }
|
|
||||||
|
|
||||||
// Key function returns key value.
|
|
||||||
func (e TracerValidationError) Key() bool { return e.key }
|
|
||||||
|
|
||||||
// ErrorName returns error name.
|
|
||||||
func (e TracerValidationError) ErrorName() string { return "TracerValidationError" }
|
|
||||||
|
|
||||||
// Error satisfies the builtin error interface
|
|
||||||
func (e TracerValidationError) 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 %sTracer.%s: %s%s",
|
|
||||||
key,
|
|
||||||
e.field,
|
|
||||||
e.reason,
|
|
||||||
cause)
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ error = TracerValidationError{}
|
|
||||||
|
|
||||||
var _ interface {
|
|
||||||
Field() string
|
|
||||||
Reason() string
|
|
||||||
Key() bool
|
|
||||||
Cause() error
|
|
||||||
ErrorName() string
|
|
||||||
} = TracerValidationError{}
|
|
||||||
Reference in New Issue
Block a user