Documentation
¶
Index ¶
- Constants
- type BoolParser
- type CannotParseErr
- type Complex64Parser
- type Complex128Parser
- type Field
- type Float32Parser
- type Float64Parser
- type Int8Parser
- type Int16Parser
- type Int32Parser
- type Int64Parser
- type IntParser
- type Parser
- type RequiredFieldMissingErr
- type StringParser
- type Tag
- type Uint8Parser
- type Uint16Parser
- type Uint32Parser
- type Uint64Parser
- type UintParser
Constants ¶
View Source
const (
TagName = "form"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolParser ¶ added in v0.2.0
type BoolParser struct{}
type CannotParseErr ¶ added in v0.2.0
func (CannotParseErr) Error ¶ added in v0.2.0
func (i CannotParseErr) Error() string
type Complex64Parser ¶ added in v0.2.0
type Complex64Parser struct{}
type Complex128Parser ¶ added in v0.2.0
type Complex128Parser struct{}
type Field ¶
type Field struct {
// Name is the name of the field inside the struct
Name string
// Parser used to turn string value into Field type
Parser Parser
// MetaData contains additional Tag metadata used during decoding
MetaData Tag
// contains filtered or unexported fields
}
Field contains the metadata and type parser to decode a key-value pair from url.Values into a struct field.
type Float32Parser ¶ added in v0.2.0
type Float32Parser struct{}
type Float64Parser ¶ added in v0.2.0
type Float64Parser struct{}
type Int8Parser ¶ added in v0.2.0
type Int8Parser struct{}
type Int16Parser ¶ added in v0.2.0
type Int16Parser struct{}
type Int32Parser ¶ added in v0.2.0
type Int32Parser struct{}
type Int64Parser ¶ added in v0.2.0
type Int64Parser struct{}
type IntParser ¶ added in v0.2.0
type IntParser struct{}
IntParser parses the field string as a 64 bit int and casts it to int
type Parser ¶ added in v0.2.0
type Parser interface {
// ParseForm converts a string into a type.
ParseForm(field string) (any, error)
}
Parser converts a string into a type. Which type is controlled by the implementation of the Parser. Parser must always return the same type.
type RequiredFieldMissingErr ¶
type RequiredFieldMissingErr struct {
Field string
}
func (RequiredFieldMissingErr) Error ¶
func (r RequiredFieldMissingErr) Error() string
type StringParser ¶ added in v0.2.0
type StringParser struct{}
StringParser returns the field string unchanged
type Tag ¶
type Tag struct {
// If Alias is not an empty string, it will be used instead of the struct field name.
Alias string
// If Required is true decode will fail if FieldName is not present in url.Values.
Required bool
// If Regex is not nil it will be used to validate the field value before decoding it.
Regex *regexp.Regexp
}
Tag represents the configuration options that can be with the struct tag (see TagName) set on struct fields.
type Uint8Parser ¶ added in v0.2.0
type Uint8Parser struct{}
type Uint16Parser ¶ added in v0.2.0
type Uint16Parser struct{}
type Uint32Parser ¶ added in v0.2.0
type Uint32Parser struct{}
type Uint64Parser ¶ added in v0.2.0
type Uint64Parser struct{}
type UintParser ¶ added in v0.2.0
type UintParser struct{}
UintParser parses the field string as a 64 bit uint and casts it to uint
Click to show internal directories.
Click to hide internal directories.