grpc/proxy/testservice/test.pb.validate.go
Adphi 3a3d77169c
interceptors: migrate to otel and add logging interceptor
Signed-off-by: Adphi <philippe.adrien.nousse@gmail.com>
2024-10-17 17:15:05 +02:00

241 lines
5.9 KiB
Go

// Code generated by protoc-gen-validate. DO NOT EDIT.
// source: proxy/testservice/test.proto
package testservice
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 PingRequest 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 *PingRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on PingRequest 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 PingRequestMultiError, or
// nil if none found.
func (m *PingRequest) ValidateAll() error {
return m.validate(true)
}
func (m *PingRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Value
if len(errors) > 0 {
return PingRequestMultiError(errors)
}
return nil
}
// PingRequestMultiError is an error wrapping multiple validation errors
// returned by PingRequest.ValidateAll() if the designated constraints aren't met.
type PingRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PingRequestMultiError) 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 PingRequestMultiError) AllErrors() []error { return m }
// PingRequestValidationError is the validation error returned by
// PingRequest.Validate if the designated constraints aren't met.
type PingRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PingRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PingRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PingRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PingRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PingRequestValidationError) ErrorName() string { return "PingRequestValidationError" }
// Error satisfies the builtin error interface
func (e PingRequestValidationError) 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 %sPingRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PingRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PingRequestValidationError{}
// Validate checks the field values on PingResponse 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 *PingResponse) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on PingResponse 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 PingResponseMultiError, or
// nil if none found.
func (m *PingResponse) ValidateAll() error {
return m.validate(true)
}
func (m *PingResponse) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
// no validation rules for Value
// no validation rules for Counter
if len(errors) > 0 {
return PingResponseMultiError(errors)
}
return nil
}
// PingResponseMultiError is an error wrapping multiple validation errors
// returned by PingResponse.ValidateAll() if the designated constraints aren't met.
type PingResponseMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m PingResponseMultiError) 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 PingResponseMultiError) AllErrors() []error { return m }
// PingResponseValidationError is the validation error returned by
// PingResponse.Validate if the designated constraints aren't met.
type PingResponseValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e PingResponseValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e PingResponseValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e PingResponseValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e PingResponseValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e PingResponseValidationError) ErrorName() string { return "PingResponseValidationError" }
// Error satisfies the builtin error interface
func (e PingResponseValidationError) 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 %sPingResponse.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = PingResponseValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
ErrorName() string
} = PingResponseValidationError{}