validate

package
v0.20231001.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StringRules_UnicodeNormalizationForm_name = map[int32]string{
		0:   "NFC",
		1:   "NFD",
		2:   "NFKC",
		3:   "NFKD",
		100: "PRECIS_USERNAME_CASE_MAPPED",
		101: "PRECIS_USERNAME_CASE_PRESERVED",
		102: "PRECIS_OPAQUE_STRING",
	}
	StringRules_UnicodeNormalizationForm_value = map[string]int32{
		"NFC":                            0,
		"NFD":                            1,
		"NFKC":                           2,
		"NFKD":                           3,
		"PRECIS_USERNAME_CASE_MAPPED":    100,
		"PRECIS_USERNAME_CASE_PRESERVED": 101,
		"PRECIS_OPAQUE_STRING":           102,
	}
)

Enum value maps for StringRules_UnicodeNormalizationForm.

View Source
var E164Pattern = regexp.MustCompile(`^\+[1-9][0-9-]+$`)

E164Pattern is a regular expression to match E.164 telephone number format.

View Source
var (
	// `ignored` stops generating `Validate()` method for this message.
	//
	// optional bool ignored = 1179;
	E_Ignored = &file_cybozu_validate_options_proto_extTypes[0]
)

Extension fields to descriptorpb.MessageOptions.

View Source
var (
	// `required` ensures that a field in this oneof is set.
	//
	// optional bool required = 1179;
	E_Required = &file_cybozu_validate_options_proto_extTypes[1]
)

Extension fields to descriptorpb.OneofOptions.

View Source
var (
	// `rules` specify the validations/normalizations to be performed on this field.
	// Note that a string field will always be normalized to the UNICODE NFC form
	// even if there is no rule specified.
	//
	// optional cybozu.validate.FieldRules rules = 1179;
	E_Rules = &file_cybozu_validate_options_proto_extTypes[2]
)

Extension fields to descriptorpb.FieldOptions.

View Source
var File_cybozu_validate_options_proto protoreflect.FileDescriptor

Functions

func CallValidate

func CallValidate(m any) error

CallValidate calls `Validate() error` function if `m` implements it.

func CallValidateCustom

func CallValidateCustom(m any) error

CallValidate calls `ValidateCustom() error` function if `m` implements it.

Types

type BoolRules

type BoolRules struct {
	// contains filtered or unexported fields
}

BoolRules provides rules for `bool` field. Currently, no rule is available.

func (*BoolRules) Descriptor deprecated

func (*BoolRules) Descriptor() ([]byte, []int)

Deprecated: Use BoolRules.ProtoReflect.Descriptor instead.

func (*BoolRules) ProtoMessage

func (*BoolRules) ProtoMessage()

func (*BoolRules) ProtoReflect

func (x *BoolRules) ProtoReflect() protoreflect.Message

func (*BoolRules) Reset

func (x *BoolRules) Reset()

func (*BoolRules) String

func (x *BoolRules) String() string

type BytesRules

type BytesRules struct {

	// `min_length` specifies the minimum length.
	// The length is counted as the number of bytes.
	MinLength *uint32 `protobuf:"varint,3,opt,name=min_length,json=minLength,proto3,oneof" json:"min_length,omitempty"`
	// `max_length` specifies the maximum length.
	// The length is counted as the number of bytes.
	MaxLength *uint32 `protobuf:"varint,4,opt,name=max_length,json=maxLength,proto3,oneof" json:"max_length,omitempty"`
	// contains filtered or unexported fields
}

BytesRules provides rules for `bytes` field.

func (*BytesRules) Descriptor deprecated

func (*BytesRules) Descriptor() ([]byte, []int)

Deprecated: Use BytesRules.ProtoReflect.Descriptor instead.

func (*BytesRules) GetMaxLength

func (x *BytesRules) GetMaxLength() uint32

func (*BytesRules) GetMinLength

func (x *BytesRules) GetMinLength() uint32

func (*BytesRules) ProtoMessage

func (*BytesRules) ProtoMessage()

func (*BytesRules) ProtoReflect

func (x *BytesRules) ProtoReflect() protoreflect.Message

func (*BytesRules) Reset

func (x *BytesRules) Reset()

func (*BytesRules) String

func (x *BytesRules) String() string

type CustomValidator

type CustomValidator interface {
	ValidateCustom() error
}

CustomValidator is the interface that a message struct can optionally implement. The generated `Validate()` function will call `ValidateCustom()` from inside if available.

type DoubleRules

type DoubleRules struct {

	// `lt` specifies that this field must be less than the specified value.
	Lt *float64 `protobuf:"fixed64,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"`
	// `lte` specifies that this field must be less than or equal to the specified value.
	Lte *float64 `protobuf:"fixed64,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"`
	// `gt` specifies that this field must be greater than the specified value.
	Gt *float64 `protobuf:"fixed64,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"`
	// `gte` specifies that this field must be greater than or equal to the specified value.
	Gte *float64 `protobuf:"fixed64,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"`
	// contains filtered or unexported fields
}

DoubleRules provides rules for `double` field.

func (*DoubleRules) Descriptor deprecated

func (*DoubleRules) Descriptor() ([]byte, []int)

Deprecated: Use DoubleRules.ProtoReflect.Descriptor instead.

func (*DoubleRules) GetGt

func (x *DoubleRules) GetGt() float64

func (*DoubleRules) GetGte

func (x *DoubleRules) GetGte() float64

func (*DoubleRules) GetLt

func (x *DoubleRules) GetLt() float64

func (*DoubleRules) GetLte

func (x *DoubleRules) GetLte() float64

func (*DoubleRules) ProtoMessage

func (*DoubleRules) ProtoMessage()

func (*DoubleRules) ProtoReflect

func (x *DoubleRules) ProtoReflect() protoreflect.Message

func (*DoubleRules) Reset

func (x *DoubleRules) Reset()

func (*DoubleRules) String

func (x *DoubleRules) String() string

type EnumRules

type EnumRules struct {

	// `required` specifies that this field must not be zero (usually, zero means unspecified).
	Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
	// `defined_only` specifies that this field must be only one of the defined
	// values for this enum, failing on any undefined value.
	DefinedOnly bool `protobuf:"varint,2,opt,name=defined_only,json=definedOnly,proto3" json:"defined_only,omitempty"`
	// contains filtered or unexported fields
}

EnumRules provides rules for `enum` field.

func (*EnumRules) Descriptor deprecated

func (*EnumRules) Descriptor() ([]byte, []int)

Deprecated: Use EnumRules.ProtoReflect.Descriptor instead.

func (*EnumRules) GetDefinedOnly

func (x *EnumRules) GetDefinedOnly() bool

func (*EnumRules) GetRequired

func (x *EnumRules) GetRequired() bool

func (*EnumRules) ProtoMessage

func (*EnumRules) ProtoMessage()

func (*EnumRules) ProtoReflect

func (x *EnumRules) ProtoReflect() protoreflect.Message

func (*EnumRules) Reset

func (x *EnumRules) Reset()

func (*EnumRules) String

func (x *EnumRules) String() string

type FieldRules

type FieldRules struct {

	// One of these constraints can be specified for a field.
	//
	// If the field is `optional` and not set, the specified rule will not be applied.
	// For a map type field like `map<string, int64>`, you may specify a rule for the value type, here `int64`.
	//
	// Types that are assignable to Type:
	//
	//	*FieldRules_Float
	//	*FieldRules_Double
	//	*FieldRules_Int32
	//	*FieldRules_Int64
	//	*FieldRules_Uint32
	//	*FieldRules_Uint64
	//	*FieldRules_Sint32
	//	*FieldRules_Sint64
	//	*FieldRules_Fixed32
	//	*FieldRules_Fixed64
	//	*FieldRules_Sfixed32
	//	*FieldRules_Sfixed64
	//	*FieldRules_Bool
	//	*FieldRules_String_
	//	*FieldRules_Bytes
	//	*FieldRules_Enum
	//	*FieldRules_Message
	Type isFieldRules_Type `protobuf_oneof:"type"`
	// One of these constraints can be specified for a repeated field or a map field.
	//
	// Types that are assignable to Items:
	//
	//	*FieldRules_Repeated
	//	*FieldRules_Map
	Items isFieldRules_Items `protobuf_oneof:"items"`
	// contains filtered or unexported fields
}

FieldRules encapsulates the rules for each type of field. Depending on the field type, one or two rule sets can be specified.

func (*FieldRules) Descriptor deprecated

func (*FieldRules) Descriptor() ([]byte, []int)

Deprecated: Use FieldRules.ProtoReflect.Descriptor instead.

func (*FieldRules) GetBool

func (x *FieldRules) GetBool() *BoolRules

func (*FieldRules) GetBytes

func (x *FieldRules) GetBytes() *BytesRules

func (*FieldRules) GetDouble

func (x *FieldRules) GetDouble() *DoubleRules

func (*FieldRules) GetEnum

func (x *FieldRules) GetEnum() *EnumRules

func (*FieldRules) GetFixed32

func (x *FieldRules) GetFixed32() *Uint32Rules

func (*FieldRules) GetFixed64

func (x *FieldRules) GetFixed64() *Uint64Rules

func (*FieldRules) GetFloat

func (x *FieldRules) GetFloat() *FloatRules

func (*FieldRules) GetInt32

func (x *FieldRules) GetInt32() *Int32Rules

func (*FieldRules) GetInt64

func (x *FieldRules) GetInt64() *Int64Rules

func (*FieldRules) GetItems

func (m *FieldRules) GetItems() isFieldRules_Items

func (*FieldRules) GetMap

func (x *FieldRules) GetMap() *ItemsRules

func (*FieldRules) GetMessage

func (x *FieldRules) GetMessage() *MessageRules

func (*FieldRules) GetRepeated

func (x *FieldRules) GetRepeated() *ItemsRules

func (*FieldRules) GetSfixed32

func (x *FieldRules) GetSfixed32() *Int32Rules

func (*FieldRules) GetSfixed64

func (x *FieldRules) GetSfixed64() *Int64Rules

func (*FieldRules) GetSint32

func (x *FieldRules) GetSint32() *Int32Rules

func (*FieldRules) GetSint64

func (x *FieldRules) GetSint64() *Int64Rules

func (*FieldRules) GetString_

func (x *FieldRules) GetString_() *StringRules

func (*FieldRules) GetType

func (m *FieldRules) GetType() isFieldRules_Type

func (*FieldRules) GetUint32

func (x *FieldRules) GetUint32() *Uint32Rules

func (*FieldRules) GetUint64

func (x *FieldRules) GetUint64() *Uint64Rules

func (*FieldRules) ProtoMessage

func (*FieldRules) ProtoMessage()

func (*FieldRules) ProtoReflect

func (x *FieldRules) ProtoReflect() protoreflect.Message

func (*FieldRules) Reset

func (x *FieldRules) Reset()

func (*FieldRules) String

func (x *FieldRules) String() string

type FieldRules_Bool

type FieldRules_Bool struct {
	// `bool` can be specified for a bool type field.
	Bool *BoolRules `protobuf:"bytes,13,opt,name=bool,proto3,oneof"`
}

type FieldRules_Bytes

type FieldRules_Bytes struct {
	// `bytes` can be specified for a bytes type field.
	Bytes *BytesRules `protobuf:"bytes,15,opt,name=bytes,proto3,oneof"`
}

type FieldRules_Double

type FieldRules_Double struct {
	// `double` can be specified for a double type field.
	Double *DoubleRules `protobuf:"bytes,2,opt,name=double,proto3,oneof"`
}

type FieldRules_Enum

type FieldRules_Enum struct {
	// `enum` can be specified for an enum type field.
	Enum *EnumRules `protobuf:"bytes,16,opt,name=enum,proto3,oneof"`
}

type FieldRules_Fixed32

type FieldRules_Fixed32 struct {
	// `fixed32` can be specified for a fixed32 type field.
	Fixed32 *Uint32Rules `protobuf:"bytes,9,opt,name=fixed32,proto3,oneof"`
}

type FieldRules_Fixed64

type FieldRules_Fixed64 struct {
	// `fixed64` can be specified for a fixed64 type field.
	Fixed64 *Uint64Rules `protobuf:"bytes,10,opt,name=fixed64,proto3,oneof"`
}

type FieldRules_Float

type FieldRules_Float struct {
	// `float` can be specified for a float type field.
	Float *FloatRules `protobuf:"bytes,1,opt,name=float,proto3,oneof"`
}

type FieldRules_Int32

type FieldRules_Int32 struct {
	// `int32` can be specified for an int32 type field.
	Int32 *Int32Rules `protobuf:"bytes,3,opt,name=int32,proto3,oneof"`
}

type FieldRules_Int64

type FieldRules_Int64 struct {
	// `int64` can be specified for an int64 type field.
	Int64 *Int64Rules `protobuf:"bytes,4,opt,name=int64,proto3,oneof"`
}

type FieldRules_Map

type FieldRules_Map struct {
	// `map` can be specified for any map type field.
	Map *ItemsRules `protobuf:"bytes,1001,opt,name=map,proto3,oneof"`
}

type FieldRules_Message

type FieldRules_Message struct {
	// `message` can be specified for a message type field except for the well-known types.
	Message *MessageRules `protobuf:"bytes,17,opt,name=message,proto3,oneof"`
}

type FieldRules_Repeated

type FieldRules_Repeated struct {
	// `repeated` can be specified for any field with `repeated` specifier.
	Repeated *ItemsRules `protobuf:"bytes,1000,opt,name=repeated,proto3,oneof"`
}

type FieldRules_Sfixed32

type FieldRules_Sfixed32 struct {
	// `sfixed32` can be specified for an sfixed32 type field.
	Sfixed32 *Int32Rules `protobuf:"bytes,11,opt,name=sfixed32,proto3,oneof"`
}

type FieldRules_Sfixed64

type FieldRules_Sfixed64 struct {
	// `sfixed64` can be specified for an sfixed64 type field.
	Sfixed64 *Int64Rules `protobuf:"bytes,12,opt,name=sfixed64,proto3,oneof"`
}

type FieldRules_Sint32

type FieldRules_Sint32 struct {
	// `sint32` can be specified for a sint32 type field.
	Sint32 *Int32Rules `protobuf:"bytes,7,opt,name=sint32,proto3,oneof"`
}

type FieldRules_Sint64

type FieldRules_Sint64 struct {
	// `sint64` can be specified for a sint64 type field.
	Sint64 *Int64Rules `protobuf:"bytes,8,opt,name=sint64,proto3,oneof"`
}

type FieldRules_String_

type FieldRules_String_ struct {
	// `string` can be specified for a string type field.
	String_ *StringRules `protobuf:"bytes,14,opt,name=string,proto3,oneof"`
}

type FieldRules_Uint32

type FieldRules_Uint32 struct {
	// `uint32` can be specified for a uint32 type field.
	Uint32 *Uint32Rules `protobuf:"bytes,5,opt,name=uint32,proto3,oneof"`
}

type FieldRules_Uint64

type FieldRules_Uint64 struct {
	// `uint64` can be specified for a uint64 type field.
	Uint64 *Uint64Rules `protobuf:"bytes,6,opt,name=uint64,proto3,oneof"`
}

type FloatRules

type FloatRules struct {

	// `lt` specifies that this field must be less than the specified value.
	Lt *float32 `protobuf:"fixed32,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"`
	// `lte` specifies that this field must be less than or equal to the specified value.
	Lte *float32 `protobuf:"fixed32,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"`
	// `gt` specifies that this field must be greater than the specified value.
	Gt *float32 `protobuf:"fixed32,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"`
	// `gte` specifies that this field must be greater than or equal to the specified value.
	Gte *float32 `protobuf:"fixed32,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"`
	// contains filtered or unexported fields
}

FloatRules provides rules for `float` field.

func (*FloatRules) Descriptor deprecated

func (*FloatRules) Descriptor() ([]byte, []int)

Deprecated: Use FloatRules.ProtoReflect.Descriptor instead.

func (*FloatRules) GetGt

func (x *FloatRules) GetGt() float32

func (*FloatRules) GetGte

func (x *FloatRules) GetGte() float32

func (*FloatRules) GetLt

func (x *FloatRules) GetLt() float32

func (*FloatRules) GetLte

func (x *FloatRules) GetLte() float32

func (*FloatRules) ProtoMessage

func (*FloatRules) ProtoMessage()

func (*FloatRules) ProtoReflect

func (x *FloatRules) ProtoReflect() protoreflect.Message

func (*FloatRules) Reset

func (x *FloatRules) Reset()

func (*FloatRules) String

func (x *FloatRules) String() string

type Int32Rules

type Int32Rules struct {

	// `lt` specifies that this field must be less than the specified value.
	Lt *int32 `protobuf:"varint,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"`
	// `lte` specifies that this field must be less than or equal to the specified value.
	Lte *int32 `protobuf:"varint,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"`
	// `gt` specifies that this field must be greater than the specified value.
	Gt *int32 `protobuf:"varint,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"`
	// `gte` specifies that this field must be greater than or equal to the specified value.
	Gte *int32 `protobuf:"varint,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"`
	// contains filtered or unexported fields
}

Int32Rules provides rules for `int32`, `sint32`, `sfixed32` fields.

func (*Int32Rules) Descriptor deprecated

func (*Int32Rules) Descriptor() ([]byte, []int)

Deprecated: Use Int32Rules.ProtoReflect.Descriptor instead.

func (*Int32Rules) GetGt

func (x *Int32Rules) GetGt() int32

func (*Int32Rules) GetGte

func (x *Int32Rules) GetGte() int32

func (*Int32Rules) GetLt

func (x *Int32Rules) GetLt() int32

func (*Int32Rules) GetLte

func (x *Int32Rules) GetLte() int32

func (*Int32Rules) ProtoMessage

func (*Int32Rules) ProtoMessage()

func (*Int32Rules) ProtoReflect

func (x *Int32Rules) ProtoReflect() protoreflect.Message

func (*Int32Rules) Reset

func (x *Int32Rules) Reset()

func (*Int32Rules) String

func (x *Int32Rules) String() string

type Int64Rules

type Int64Rules struct {

	// `lt` specifies that this field must be less than the specified value.
	Lt *int64 `protobuf:"varint,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"`
	// `lte` specifies that this field must be less than or equal to the specified value.
	Lte *int64 `protobuf:"varint,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"`
	// `gt` specifies that this field must be greater than the specified value.
	Gt *int64 `protobuf:"varint,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"`
	// `gte` specifies that this field must be greater than or equal to the specified value.
	Gte *int64 `protobuf:"varint,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"`
	// contains filtered or unexported fields
}

Int64Rules provides rules for `int64`, `sint64`, `sfixed64` fields.

func (*Int64Rules) Descriptor deprecated

func (*Int64Rules) Descriptor() ([]byte, []int)

Deprecated: Use Int64Rules.ProtoReflect.Descriptor instead.

func (*Int64Rules) GetGt

func (x *Int64Rules) GetGt() int64

func (*Int64Rules) GetGte

func (x *Int64Rules) GetGte() int64

func (*Int64Rules) GetLt

func (x *Int64Rules) GetLt() int64

func (*Int64Rules) GetLte

func (x *Int64Rules) GetLte() int64

func (*Int64Rules) ProtoMessage

func (*Int64Rules) ProtoMessage()

func (*Int64Rules) ProtoReflect

func (x *Int64Rules) ProtoReflect() protoreflect.Message

func (*Int64Rules) Reset

func (x *Int64Rules) Reset()

func (*Int64Rules) String

func (x *Int64Rules) String() string

type ItemsRules

type ItemsRules struct {

	// `min_items` specifies that this field must have the specified number of items at a minimum.
	MinItems *uint32 `protobuf:"varint,1,opt,name=min_items,json=minItems,proto3,oneof" json:"min_items,omitempty"`
	// `max_items` specifies that this field must have the specified number of items at a maximum.
	MaxItems *uint32 `protobuf:"varint,2,opt,name=max_items,json=maxItems,proto3,oneof" json:"max_items,omitempty"`
	// contains filtered or unexported fields
}

ItemsRules are optional message to specify the constraints on the number of items in a repeated field or a map type.

func (*ItemsRules) Descriptor deprecated

func (*ItemsRules) Descriptor() ([]byte, []int)

Deprecated: Use ItemsRules.ProtoReflect.Descriptor instead.

func (*ItemsRules) GetMaxItems

func (x *ItemsRules) GetMaxItems() uint32

func (*ItemsRules) GetMinItems

func (x *ItemsRules) GetMinItems() uint32

func (*ItemsRules) ProtoMessage

func (*ItemsRules) ProtoMessage()

func (*ItemsRules) ProtoReflect

func (x *ItemsRules) ProtoReflect() protoreflect.Message

func (*ItemsRules) Reset

func (x *ItemsRules) Reset()

func (*ItemsRules) String

func (x *ItemsRules) String() string

type MessageRules

type MessageRules struct {

	// `required` specifies that this field must be set.
	Required bool `protobuf:"varint,1,opt,name=required,proto3" json:"required,omitempty"`
	// contains filtered or unexported fields
}

MessageRules provides rules for `message` field. For a message field, validation/normalization will be done recursively.

func (*MessageRules) Descriptor deprecated

func (*MessageRules) Descriptor() ([]byte, []int)

Deprecated: Use MessageRules.ProtoReflect.Descriptor instead.

func (*MessageRules) GetRequired

func (x *MessageRules) GetRequired() bool

func (*MessageRules) ProtoMessage

func (*MessageRules) ProtoMessage()

func (*MessageRules) ProtoReflect

func (x *MessageRules) ProtoReflect() protoreflect.Message

func (*MessageRules) Reset

func (x *MessageRules) Reset()

func (*MessageRules) String

func (x *MessageRules) String() string

type StringRules

type StringRules struct {

	// `norm` specifies which normalization is to be applied to the string.
	// By default, strings are normalized into the NFC form.
	Norm StringRules_UnicodeNormalizationForm `protobuf:"varint,1,opt,name=norm,proto3,enum=cybozu.validate.StringRules_UnicodeNormalizationForm" json:"norm,omitempty"`
	// `ignore_empty` specifies whether to ignore validation rules when the string is empty.
	IgnoreEmpty bool `protobuf:"varint,2,opt,name=ignore_empty,json=ignoreEmpty,proto3" json:"ignore_empty,omitempty"`
	// `min_length` specifies the minimum string length.
	// The length is counted as the number of UNICODE codepoints after normalization is applied.
	MinLength *uint32 `protobuf:"varint,3,opt,name=min_length,json=minLength,proto3,oneof" json:"min_length,omitempty"`
	// `max_length` specifies the maximum string length.
	// The length is counted as the number of UNICODE codepoints after normalization is applied.
	MaxLength *uint32 `protobuf:"varint,4,opt,name=max_length,json=maxLength,proto3,oneof" json:"max_length,omitempty"`
	// `regex` specifies a regular expression that the string must match.
	// The syntax of the regular expression is the same as google/re2.
	// https://github.com/google/re2/wiki/Syntax
	Regex *string `protobuf:"bytes,5,opt,name=regex,proto3,oneof" json:"regex,omitempty"`
	// For convenience, one of the following well-known pattern can be specified.
	//
	// Types that are assignable to Predefined:
	//
	//	*StringRules_Email
	//	*StringRules_Uri
	//	*StringRules_E164
	Predefined isStringRules_Predefined `protobuf_oneof:"predefined"`
	// contains filtered or unexported fields
}

StringRules provides rules for `string` field.

func (*StringRules) Descriptor deprecated

func (*StringRules) Descriptor() ([]byte, []int)

Deprecated: Use StringRules.ProtoReflect.Descriptor instead.

func (*StringRules) GetE164

func (x *StringRules) GetE164() bool

func (*StringRules) GetEmail

func (x *StringRules) GetEmail() bool

func (*StringRules) GetIgnoreEmpty

func (x *StringRules) GetIgnoreEmpty() bool

func (*StringRules) GetMaxLength

func (x *StringRules) GetMaxLength() uint32

func (*StringRules) GetMinLength

func (x *StringRules) GetMinLength() uint32

func (*StringRules) GetNorm

func (*StringRules) GetPredefined

func (m *StringRules) GetPredefined() isStringRules_Predefined

func (*StringRules) GetRegex

func (x *StringRules) GetRegex() string

func (*StringRules) GetUri

func (x *StringRules) GetUri() bool

func (*StringRules) ProtoMessage

func (*StringRules) ProtoMessage()

func (*StringRules) ProtoReflect

func (x *StringRules) ProtoReflect() protoreflect.Message

func (*StringRules) Reset

func (x *StringRules) Reset()

func (*StringRules) String

func (x *StringRules) String() string

type StringRules_E164

type StringRules_E164 struct {
	// `e164` specifies that the field must be canonicalized and validated as a telephone number as defined by E.164
	// with a prefixing `+` sign and optional hyphen separators. E.g., "+81-3-1111-1111".
	// See https://en.wikipedia.org/wiki/E.164
	E164 bool `protobuf:"varint,102,opt,name=e164,proto3,oneof"`
}

type StringRules_Email

type StringRules_Email struct {
	// `email` specifies that the field must be canonicalized and validated as an email address as defined by Section 3.4.1 in RFC 5322.
	// See https://www.rfc-editor.org/rfc/rfc5322#section-3.4.1
	Email bool `protobuf:"varint,100,opt,name=email,proto3,oneof"`
}

type StringRules_UnicodeNormalizationForm

type StringRules_UnicodeNormalizationForm int32

UNICODE normalization forms. In addition to the forms defined by https://www.unicode.org/reports/tr15/, we include PRECIS profiles as they are considered a variant of the NFC form.

const (
	// NFC form as defined by https://www.unicode.org/reports/tr15/
	StringRules_NFC StringRules_UnicodeNormalizationForm = 0
	// NFD form as defined by https://www.unicode.org/reports/tr15/
	StringRules_NFD StringRules_UnicodeNormalizationForm = 1
	// NFKC form as defined by https://www.unicode.org/reports/tr15/
	StringRules_NFKC StringRules_UnicodeNormalizationForm = 2
	// NFKD form as defined by https://www.unicode.org/reports/tr15/
	StringRules_NFKD StringRules_UnicodeNormalizationForm = 3
	// PRECIS UsernameCaseMapped profile as defined by RFC 8265
	StringRules_PRECIS_USERNAME_CASE_MAPPED StringRules_UnicodeNormalizationForm = 100
	// PRECIS UsernameCasePreserved profile as defined by RFC 8265
	StringRules_PRECIS_USERNAME_CASE_PRESERVED StringRules_UnicodeNormalizationForm = 101
	// PRECIS OpaqueString profile as defined by RFC 8265
	StringRules_PRECIS_OPAQUE_STRING StringRules_UnicodeNormalizationForm = 102
)

func (StringRules_UnicodeNormalizationForm) Descriptor

func (StringRules_UnicodeNormalizationForm) Enum

func (StringRules_UnicodeNormalizationForm) EnumDescriptor deprecated

func (StringRules_UnicodeNormalizationForm) EnumDescriptor() ([]byte, []int)

Deprecated: Use StringRules_UnicodeNormalizationForm.Descriptor instead.

func (StringRules_UnicodeNormalizationForm) Number

func (StringRules_UnicodeNormalizationForm) String

func (StringRules_UnicodeNormalizationForm) Type

type StringRules_Uri

type StringRules_Uri struct {
	// `uri` specifies that the field must be canonicalized and validated as an absolute URI as defined by RFC 3986.
	Uri bool `protobuf:"varint,101,opt,name=uri,proto3,oneof"`
}

type Uint32Rules

type Uint32Rules struct {

	// `lt` specifies that this field must be less than the specified value.
	Lt *uint32 `protobuf:"varint,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"`
	// `lte` specifies that this field must be less than or equal to the specified value.
	Lte *uint32 `protobuf:"varint,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"`
	// `gt` specifies that this field must be greater than the specified value.
	Gt *uint32 `protobuf:"varint,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"`
	// `gte` specifies that this field must be greater than or equal to the specified value.
	Gte *uint32 `protobuf:"varint,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"`
	// contains filtered or unexported fields
}

Uint32Rules provides rules for `uint32` and `fixed32` fields.

func (*Uint32Rules) Descriptor deprecated

func (*Uint32Rules) Descriptor() ([]byte, []int)

Deprecated: Use Uint32Rules.ProtoReflect.Descriptor instead.

func (*Uint32Rules) GetGt

func (x *Uint32Rules) GetGt() uint32

func (*Uint32Rules) GetGte

func (x *Uint32Rules) GetGte() uint32

func (*Uint32Rules) GetLt

func (x *Uint32Rules) GetLt() uint32

func (*Uint32Rules) GetLte

func (x *Uint32Rules) GetLte() uint32

func (*Uint32Rules) ProtoMessage

func (*Uint32Rules) ProtoMessage()

func (*Uint32Rules) ProtoReflect

func (x *Uint32Rules) ProtoReflect() protoreflect.Message

func (*Uint32Rules) Reset

func (x *Uint32Rules) Reset()

func (*Uint32Rules) String

func (x *Uint32Rules) String() string

type Uint64Rules

type Uint64Rules struct {

	// `lt` specifies that this field must be less than the specified value.
	Lt *uint64 `protobuf:"varint,1,opt,name=lt,proto3,oneof" json:"lt,omitempty"`
	// `lte` specifies that this field must be less than or equal to the specified value.
	Lte *uint64 `protobuf:"varint,2,opt,name=lte,proto3,oneof" json:"lte,omitempty"`
	// `gt` specifies that this field must be greater than the specified value.
	Gt *uint64 `protobuf:"varint,3,opt,name=gt,proto3,oneof" json:"gt,omitempty"`
	// `gte` specifies that this field must be greater than or equal to the specified value.
	Gte *uint64 `protobuf:"varint,4,opt,name=gte,proto3,oneof" json:"gte,omitempty"`
	// contains filtered or unexported fields
}

Uint64Rules provides rules for `uint64` and `fixed64` fields.

func (*Uint64Rules) Descriptor deprecated

func (*Uint64Rules) Descriptor() ([]byte, []int)

Deprecated: Use Uint64Rules.ProtoReflect.Descriptor instead.

func (*Uint64Rules) GetGt

func (x *Uint64Rules) GetGt() uint64

func (*Uint64Rules) GetGte

func (x *Uint64Rules) GetGte() uint64

func (*Uint64Rules) GetLt

func (x *Uint64Rules) GetLt() uint64

func (*Uint64Rules) GetLte

func (x *Uint64Rules) GetLte() uint64

func (*Uint64Rules) ProtoMessage

func (*Uint64Rules) ProtoMessage()

func (*Uint64Rules) ProtoReflect

func (x *Uint64Rules) ProtoReflect() protoreflect.Message

func (*Uint64Rules) Reset

func (x *Uint64Rules) Reset()

func (*Uint64Rules) String

func (x *Uint64Rules) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL