Documentation ¶
Index ¶
- Variables
- func AsBool(v any) bool
- func AsByteArray(v any) ([]byte, bool)
- func AsFloat(v any) (float64, bool)
- func AsInt(v any) (int64, bool)
- func AsNumber(v any) (any, bool)
- func AsString(v any) (string, bool)
- func AsUint(v any) (uint64, bool)
- func Assign(dst, src any) error
- func BaseType(v any) any
- func SetValidator[T any](validator string, fnc func(T) error)
- func SetValidatorArgs(validator string, fnc any)
- func Validate(obj any) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAssignDestNotPointer = errors.New("assign destination must be a pointer") ErrAssignImpossible = errors.New("the requested assign is not possible") ErrNilPointerRead = errors.New("attempt to read from a nil pointer") ErrEmptyValue = errors.New("validator: value must not be empty") ErrDestinationNotAddressable = errors.New("assign: destination cannot be addressed") ErrStructPtrRequired = errors.New("parameter must be a pointer to a struct") )
Functions ¶
func AsByteArray ¶ added in v0.1.14
func BaseType ¶ added in v0.1.4
BaseType attempts to convert v into its base type, that is if v is a type that is defined as `type foo string`, a simple string will be returned.
func SetValidator ¶ added in v0.1.6
SetValidator sets the given function as validator with the given name. This should be typically called in init()
func SetValidatorArgs ¶ added in v0.1.13
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.