Documentation ¶
Index ¶
- Variables
- func As[T any](v any) (T, error)
- 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 AssignReflect(vdst, vsrc reflect.Value) error
- func BaseType(v any) any
- func Equal(a, b any) bool
- func Math(mathop string, a, b any) (any, bool)
- func OffsetGet(ctx context.Context, v any, offset string) (any, error)
- func SetValidator[T any](validator string, fnc func(T) error)
- func SetValidatorArgs(validator string, fnc any)
- func ToType(ref, v any) (any, bool)
- func Validate(obj any) error
Constants ¶
This section is empty.
Variables ¶
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") ErrBadOffset = errors.New("bad offset type") )
Functions ¶
func AsByteArray ¶ added in v0.1.14
func AssignReflect ¶ added in v0.1.19
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 Math ¶ added in v0.1.16
Math performs a mathematical operation on two variables of any type and returns a numeric type and true if everything went fine.
For example Math("+", 40.000, "2") will return float64(42)
For now if passed any float value, the function will always return a float value in the end. This may change in the future.
func OffsetGet ¶ added in v0.2.6
OffsetGet returns v[offset] dealing with various case of figure. ctx will be passed to some methods handling it
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.