Categorygithub.com/jackc/mp
modulepackage
0.0.0-20230818183750-4876f1da262b
Repository: https://github.com/jackc/mp.git
Documentation: pkg.go.dev

# Functions

AllowStrings returns a ValueConverter that returns an error unless value is one of the allowedItems.
Bool returns a ValueConverter that converts value to a bool.
Decimal returns a ValueConverter that converts value to a decimal.Decimal.
ExcludeStrings returns a ValueConverter that returns an error if value is one of the excludedItems.
Float32 returns a ValueConverter that converts value to an float32.
Float64 returns a ValueConverter that converts value to an float64.
GreaterThan returns a ValueConverter that fails unless value > x.
GreaterThanOrEqual returns a ValueConverter that fails unless value >= x.
No description provided by the author
Int32 returns a ValueConverter that converts value to an int32.
Int64 returns a ValueConverter that converts value to an int64.
LessThan returns a ValueConverter that fails unless value < x.
LessThanOrEqual returns a ValueConverter that fails unless value <= x.
MaxLen returns a ValueConverter that fails if len(value) > max.
MinLen returns a ValueConverter that fails if len(value) < min.
MultiLineString returns a ValueConverter that converts a string value to a normalized string.
NewField creates a new field with the given name and valueConverters.
No description provided by the author
NilifyEmpty converts strings, slices, and maps where len(value) == 0 to nil.
NotNil returns a ValueConverter that fails if value is nil.
Require returns a ValueConverter that returns an error if value is nil or "".
SingleLineString returns a ValueConverter that converts a string value to a normalized string.
Slice returns a ValueConverter that converts value to a []T.
String returns a ValueConverter that converts value to a string.
Time returns a ValueConverter that converts value to a time.Time using formats.
UUID returns a ValueConverter that converts value to a uuid.UUID.

# Structs

Record is an "instance" of a type.
StandardField is a field of a Type.
Type is a type that can be used to convert a map[string]any to a Record.

# Interfaces

No description provided by the author
No description provided by the author
ValueConverter is an interface that converts a value to a different type or validates the value.

# Type aliases

Errors is a map of field name to error.
ValueConverterFunc is a function that implements the ValueConverter interface.