mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 12:32:21 +00:00
239 lines
9.4 KiB
Go
Executable File
239 lines
9.4 KiB
Go
Executable File
// Code generated by protoc-gen-gogo.
|
|
// source: validator.proto
|
|
// DO NOT EDIT!
|
|
|
|
/*
|
|
Package validator is a generated protocol buffer package.
|
|
|
|
It is generated from these files:
|
|
validator.proto
|
|
|
|
It has these top-level messages:
|
|
FieldValidator
|
|
*/
|
|
package validator
|
|
|
|
import proto "github.com/gogo/protobuf/proto"
|
|
import fmt "fmt"
|
|
import math "math"
|
|
import google_protobuf "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
// This is a compile-time assertion to ensure that this generated file
|
|
// is compatible with the proto package it is being compiled against.
|
|
// A compilation error at this line likely means your copy of the
|
|
// proto package needs to be updated.
|
|
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
|
|
|
type FieldValidator struct {
|
|
// Uses a Golang RE2-syntax regex to match the field contents.
|
|
Regex *string `protobuf:"bytes,1,opt,name=regex" json:"regex,omitempty"`
|
|
// Field value of integer strictly greater than this value.
|
|
IntGt *int64 `protobuf:"varint,2,opt,name=int_gt,json=intGt" json:"int_gt,omitempty"`
|
|
// Field value of integer strictly smaller than this value.
|
|
IntLt *int64 `protobuf:"varint,3,opt,name=int_lt,json=intLt" json:"int_lt,omitempty"`
|
|
// Used for nested message types, requires that the message type exists.
|
|
MsgExists *bool `protobuf:"varint,4,opt,name=msg_exists,json=msgExists" json:"msg_exists,omitempty"`
|
|
// Human error specifies a user-customizable error that is visible to the user.
|
|
HumanError *string `protobuf:"bytes,5,opt,name=human_error,json=humanError" json:"human_error,omitempty"`
|
|
// Field value of double strictly greater than this value.
|
|
// Note that this value can only take on a valid floating point
|
|
// value. Use together with float_epsilon if you need something more specific.
|
|
FloatGt *float64 `protobuf:"fixed64,6,opt,name=float_gt,json=floatGt" json:"float_gt,omitempty"`
|
|
// Field value of double strictly smaller than this value.
|
|
// Note that this value can only take on a valid floating point
|
|
// value. Use together with float_epsilon if you need something more specific.
|
|
FloatLt *float64 `protobuf:"fixed64,7,opt,name=float_lt,json=floatLt" json:"float_lt,omitempty"`
|
|
// Field value of double describing the epsilon within which
|
|
// any comparison should be considered to be true. For example,
|
|
// when using float_gt = 0.35, using a float_epsilon of 0.05
|
|
// would mean that any value above 0.30 is acceptable. It can be
|
|
// thought of as a {float_value_condition} +- {float_epsilon}.
|
|
// If unset, no correction for floating point inaccuracies in
|
|
// comparisons will be attempted.
|
|
FloatEpsilon *float64 `protobuf:"fixed64,8,opt,name=float_epsilon,json=floatEpsilon" json:"float_epsilon,omitempty"`
|
|
// Floating-point value compared to which the field content should be greater or equal.
|
|
FloatGte *float64 `protobuf:"fixed64,9,opt,name=float_gte,json=floatGte" json:"float_gte,omitempty"`
|
|
// Floating-point value compared to which the field content should be smaller or equal.
|
|
FloatLte *float64 `protobuf:"fixed64,10,opt,name=float_lte,json=floatLte" json:"float_lte,omitempty"`
|
|
// Used for string fields, requires the string to be not empty (i.e different from "").
|
|
StringNotEmpty *bool `protobuf:"varint,11,opt,name=string_not_empty,json=stringNotEmpty" json:"string_not_empty,omitempty"`
|
|
// Repeated field with at least this number of elements.
|
|
RepeatedCountMin *int64 `protobuf:"varint,12,opt,name=repeated_count_min,json=repeatedCountMin" json:"repeated_count_min,omitempty"`
|
|
// Repeated field with at most this number of elements.
|
|
RepeatedCountMax *int64 `protobuf:"varint,13,opt,name=repeated_count_max,json=repeatedCountMax" json:"repeated_count_max,omitempty"`
|
|
// Field value of length greater than this value.
|
|
LengthGt *int64 `protobuf:"varint,14,opt,name=length_gt,json=lengthGt" json:"length_gt,omitempty"`
|
|
// Field value of length smaller than this value.
|
|
LengthLt *int64 `protobuf:"varint,15,opt,name=length_lt,json=lengthLt" json:"length_lt,omitempty"`
|
|
// Field value of integer strictly equal this value.
|
|
LengthEq *int64 `protobuf:"varint,16,opt,name=length_eq,json=lengthEq" json:"length_eq,omitempty"`
|
|
XXX_unrecognized []byte `json:"-"`
|
|
}
|
|
|
|
func (m *FieldValidator) Reset() { *m = FieldValidator{} }
|
|
func (m *FieldValidator) String() string { return proto.CompactTextString(m) }
|
|
func (*FieldValidator) ProtoMessage() {}
|
|
func (*FieldValidator) Descriptor() ([]byte, []int) { return fileDescriptorValidator, []int{0} }
|
|
|
|
func (m *FieldValidator) GetRegex() string {
|
|
if m != nil && m.Regex != nil {
|
|
return *m.Regex
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *FieldValidator) GetIntGt() int64 {
|
|
if m != nil && m.IntGt != nil {
|
|
return *m.IntGt
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetIntLt() int64 {
|
|
if m != nil && m.IntLt != nil {
|
|
return *m.IntLt
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetMsgExists() bool {
|
|
if m != nil && m.MsgExists != nil {
|
|
return *m.MsgExists
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (m *FieldValidator) GetHumanError() string {
|
|
if m != nil && m.HumanError != nil {
|
|
return *m.HumanError
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func (m *FieldValidator) GetFloatGt() float64 {
|
|
if m != nil && m.FloatGt != nil {
|
|
return *m.FloatGt
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetFloatLt() float64 {
|
|
if m != nil && m.FloatLt != nil {
|
|
return *m.FloatLt
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetFloatEpsilon() float64 {
|
|
if m != nil && m.FloatEpsilon != nil {
|
|
return *m.FloatEpsilon
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetFloatGte() float64 {
|
|
if m != nil && m.FloatGte != nil {
|
|
return *m.FloatGte
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetFloatLte() float64 {
|
|
if m != nil && m.FloatLte != nil {
|
|
return *m.FloatLte
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetStringNotEmpty() bool {
|
|
if m != nil && m.StringNotEmpty != nil {
|
|
return *m.StringNotEmpty
|
|
}
|
|
return false
|
|
}
|
|
|
|
func (m *FieldValidator) GetRepeatedCountMin() int64 {
|
|
if m != nil && m.RepeatedCountMin != nil {
|
|
return *m.RepeatedCountMin
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetRepeatedCountMax() int64 {
|
|
if m != nil && m.RepeatedCountMax != nil {
|
|
return *m.RepeatedCountMax
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetLengthGt() int64 {
|
|
if m != nil && m.LengthGt != nil {
|
|
return *m.LengthGt
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetLengthLt() int64 {
|
|
if m != nil && m.LengthLt != nil {
|
|
return *m.LengthLt
|
|
}
|
|
return 0
|
|
}
|
|
|
|
func (m *FieldValidator) GetLengthEq() int64 {
|
|
if m != nil && m.LengthEq != nil {
|
|
return *m.LengthEq
|
|
}
|
|
return 0
|
|
}
|
|
|
|
var E_Field = &proto.ExtensionDesc{
|
|
ExtendedType: (*google_protobuf.FieldOptions)(nil),
|
|
ExtensionType: (*FieldValidator)(nil),
|
|
Field: 65020,
|
|
Name: "validator.field",
|
|
Tag: "bytes,65020,opt,name=field",
|
|
Filename: "validator.proto",
|
|
}
|
|
|
|
func init() {
|
|
proto.RegisterType((*FieldValidator)(nil), "validator.FieldValidator")
|
|
proto.RegisterExtension(E_Field)
|
|
}
|
|
|
|
func init() { proto.RegisterFile("validator.proto", fileDescriptorValidator) }
|
|
|
|
var fileDescriptorValidator = []byte{
|
|
// 392 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 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