structd

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSeperator = ","

Variables

This section is empty.

Functions

func DefaultCast

func DefaultCast(from any, to reflect.Type) (any, error)

Types

type CastError

type CastError struct {
	Err error
}

func (*CastError) Error

func (e *CastError) Error() string

func (*CastError) Unwrap

func (e *CastError) Unwrap() error

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func New

func New(getter Getter, key string) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(v any) error

type Getter

type Getter interface {
	Get(string) any
}

type InvalidUnmarshalError

type InvalidUnmarshalError struct {
	Type reflect.Type
}

An InvalidUnmarshalError describes an invalid argument passed to [Unmarshal]. (The argument to [Unmarshal] must be a non-nil pointer.)

func (*InvalidUnmarshalError) Error

func (e *InvalidUnmarshalError) Error() string

type UnmarshalTypeError

type UnmarshalTypeError struct {
	Value  string       // description of a value - "bool", "array", "number -5"
	Type   reflect.Type // type of Go value it could not be assigned to
	Struct string       // name of the struct type containing the field
	Field  string       // the full path from root node to the field, include embedded struct
}

An UnmarshalTypeError describes a value that was not appropriate for a value of a specific Go type.

func (*UnmarshalTypeError) Error

func (e *UnmarshalTypeError) Error() string

type Unmarshaler

type Unmarshaler interface {
	UnmarshalString(v string) error
}

type UnmarshalerError

type UnmarshalerError struct {
	Err         error
	Value       string
	Unmarshaler reflect.Type
}

func (*UnmarshalerError) Error

func (e *UnmarshalerError) Error() string

func (*UnmarshalerError) Unwrap

func (e *UnmarshalerError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL