go-proto-validators: github.com/mwitkow/go-proto-validators Index | Files | Directories

package validator

import "github.com/mwitkow/go-proto-validators"

Package validator is a generated protocol buffer package.

It is generated from these files:

validator.proto

It has these top-level messages:

FieldValidator

Index

Package Files

helper.go validator.pb.go

Variables

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 CallValidatorIfExists Uses

func CallValidatorIfExists(candidate interface{}) error

func FieldError Uses

func FieldError(fieldName string, err error) error

FieldError wraps a given Validator error providing a message call stack.

type FieldValidator Uses

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"`
    // Requires that the value is in the enum.
    IsInEnum         *bool  `protobuf:"varint,17,opt,name=is_in_enum,json=isInEnum" json:"is_in_enum,omitempty"`
    XXX_unrecognized []byte `json:"-"`
}

func (*FieldValidator) Descriptor Uses

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

func (*FieldValidator) GetFloatEpsilon Uses

func (m *FieldValidator) GetFloatEpsilon() float64

func (*FieldValidator) GetFloatGt Uses

func (m *FieldValidator) GetFloatGt() float64

func (*FieldValidator) GetFloatGte Uses

func (m *FieldValidator) GetFloatGte() float64

func (*FieldValidator) GetFloatLt Uses

func (m *FieldValidator) GetFloatLt() float64

func (*FieldValidator) GetFloatLte Uses

func (m *FieldValidator) GetFloatLte() float64

func (*FieldValidator) GetHumanError Uses

func (m *FieldValidator) GetHumanError() string

func (*FieldValidator) GetIntGt Uses

func (m *FieldValidator) GetIntGt() int64

func (*FieldValidator) GetIntLt Uses

func (m *FieldValidator) GetIntLt() int64

func (*FieldValidator) GetIsInEnum Uses

func (m *FieldValidator) GetIsInEnum() bool

func (*FieldValidator) GetLengthEq Uses

func (m *FieldValidator) GetLengthEq() int64

func (*FieldValidator) GetLengthGt Uses

func (m *FieldValidator) GetLengthGt() int64

func (*FieldValidator) GetLengthLt Uses

func (m *FieldValidator) GetLengthLt() int64

func (*FieldValidator) GetMsgExists Uses

func (m *FieldValidator) GetMsgExists() bool

func (*FieldValidator) GetRegex Uses

func (m *FieldValidator) GetRegex() string

func (*FieldValidator) GetRepeatedCountMax Uses

func (m *FieldValidator) GetRepeatedCountMax() int64

func (*FieldValidator) GetRepeatedCountMin Uses

func (m *FieldValidator) GetRepeatedCountMin() int64

func (*FieldValidator) GetStringNotEmpty Uses

func (m *FieldValidator) GetStringNotEmpty() bool

func (*FieldValidator) ProtoMessage Uses

func (*FieldValidator) ProtoMessage()

func (*FieldValidator) Reset Uses

func (m *FieldValidator) Reset()

func (*FieldValidator) String Uses

func (m *FieldValidator) String() string

type Validator Uses

type Validator interface {
    Validate() error
}

Validator is a general interface that allows a message to be validated.

Directories

PathSynopsis
examplesPackage validator_examples is a generated protocol buffer package.
pluginThe validator plugin generates a Validate method for each message.
protoc-gen-govalidators

Package validator imports 5 packages (graph) and is imported by 37 packages. Updated 2019-02-13. Refresh now. Tools for package owners.