Documentation ¶
Index ¶
- Constants
- Variables
- type Generator
- type JSONGenerator
- type Logger
- type Mapper
- func (m *Mapper) AddFieldNestedMapper(fieldName string, nestedMapper *Mapper)
- func (m *Mapper) AddFieldValidationName(fieldName, fieldTagName string)
- func (m *Mapper) GetFieldNestedMapper(fieldName string) *Mapper
- func (m *Mapper) GetFieldValidationName(fieldName string) (string, bool)
- func (m *Mapper) GetFieldsValidationsName() *map[string]string
- func (m *Mapper) GetNestedMappers() *map[string]*Mapper
- func (m *Mapper) GetParsedFields() *map[string]bool
- func (m *Mapper) HasFieldsValidations() bool
- func (m *Mapper) IsFieldParsed(fieldName string) (bool, bool)
- func (m *Mapper) SetFieldParsed(fieldName string, parsed bool)
- type ProtobufGenerator
Constants ¶
const ( State = "state" SizeCache = "sizeCache" UnknownFields = "unknownFields" ProtobufTag = "protobuf" ProtobufOneOf = "oneof" ProtobufNamePrefix = "name=" JSONTag = "json" JSONOmitempty = "omitempty" )
Protobuf fields generated by the protoc compiler
Variables ¶
var ( ErrMissingProtobufTag = "missing protobuf tag: %s" ErrMissingProtobufTagName = "missing protobuf tag name: %s" ErrMissingJSONTag = "missing json tag: %s" ErrMissingJSONTagLooksLikeProtocField = "missing json tag, looks like a protoc field: %s. If it is a protoc field, use ProtobufGenerator instead" ErrEmptyJSONTag = "empty json tag: %s" )
Functions ¶
This section is empty.
Types ¶
type JSONGenerator ¶ added in v0.3.0
type JSONGenerator struct {
// contains filtered or unexported fields
}
JSONGenerator is a generator for JSON mappers
func NewJSONGenerator ¶ added in v0.3.0
func NewJSONGenerator(logger *Logger) *JSONGenerator
NewJSONGenerator creates a new JSON generator
func (*JSONGenerator) NewMapper ¶ added in v0.3.0
func (j *JSONGenerator) NewMapper(structInstance interface{}) ( *Mapper, error, )
NewMapper creates the fields to validate from a JSON struct
type Logger ¶ added in v0.4.6
type Logger struct {
// contains filtered or unexported fields
}
Logger is the JWT validator logger
type Mapper ¶
type Mapper struct {
// contains filtered or unexported fields
}
Mapper is a map of fields to validate from a struct
func (*Mapper) AddFieldNestedMapper ¶ added in v0.5.5
AddFieldNestedMapper adds a nested mapper to the mapper
func (*Mapper) AddFieldValidationName ¶ added in v0.5.5
AddFieldValidationName adds a field validation name to the mapper
func (*Mapper) GetFieldNestedMapper ¶ added in v0.5.5
GetFieldNestedMapper returns the nested mapper of a field
func (*Mapper) GetFieldValidationName ¶ added in v0.5.5
GetFieldValidationName returns the validation name of a field
func (*Mapper) GetFieldsValidationsName ¶ added in v0.5.5
GetFieldsValidationsName returns the fields of the mapper
func (*Mapper) GetNestedMappers ¶ added in v0.5.5
GetNestedMappers returns the nested mappers of the mapper
func (*Mapper) GetParsedFields ¶ added in v0.5.5
GetParsedFields returns the parsed fields of the mapper
func (*Mapper) HasFieldsValidations ¶ added in v0.5.5
HasFieldsValidations returns if the mapper has fields
func (*Mapper) IsFieldParsed ¶ added in v0.5.5
IsFieldParsed returns if a field was parsed
func (*Mapper) SetFieldParsed ¶ added in v0.5.5
SetFieldParsed sets if a field was parsed
type ProtobufGenerator ¶ added in v0.3.0
type ProtobufGenerator struct {
// contains filtered or unexported fields
}
ProtobufGenerator is a generator for Protobuf mappers
func NewProtobufGenerator ¶ added in v0.3.0
func NewProtobufGenerator(logger *Logger) *ProtobufGenerator
NewProtobufGenerator creates a new Protobuf generator
func (*ProtobufGenerator) NewMapper ¶ added in v0.3.0
func (p *ProtobufGenerator) NewMapper(structInstance interface{}) ( *Mapper, error, )
NewMapper creates the fields to validate from a Protobuf compiled struct