Documentation
¶
Index ¶
- func BytesToString(data []byte) string
- func ConstantToFloat(constv constant.Value) reflect.Value
- func ConstantToInt(constv constant.Value) reflect.Value
- func DeepEqual(lhs, rhs interface{}, fn func(lhs, rhs reflect.Value) (bool, error)) error
- func IsList(typ reflect.Type) bool
- func IsMap(typ reflect.Type) bool
- func IsValueType(t reflect.Type) bool
- func Len(v reflect.Value) int
- func Marshal(val reflect.Value, marshaler Marshaler, convention NamingConvention) error
- func PopulateFromEnv(to reflect.Value, automatic bool, names []string, ...) (bool, error)
- func Set(val reflect.Value, node *syntax.Node, convention encoding.NamingConvention, ...) (outerr error)
- func SetScalar(to reflect.Value, value interface{}, nodetype syntax.NodeType) (bool, error)
- func ToScalar(val reflect.Value) reflect.Value
- func Unmarshal(val reflect.Value, node *syntax.Node, convention encoding.NamingConvention, ...) error
- func UnmarshalText(to reflect.Value, value string) (bool, error)
- type FieldOpts
- type InfMarshaler
- type MapEntry
- type Marshaler
- type NaNMarshaler
- type NilMarshaler
- type PostListElemMarshaler
- type PostListMarshaler
- type PostMapMarshaler
- type PostMapValueMarshaler
- type Stringifier
- type StructField
- type StructTagParser
- type Tag
- type UnmarshalFunc
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
BytesToString converts the provided byte slice into a string. No copy is performed, which means that changing the data slice will also change the string, which will break any code that relies on the assumption that strings are read-only. Use with care.
func ConstantToFloat ¶
ConstantToFloat returns a float-like value from a constant. It will return a float64, *big.Rat, or *big.Float depending on whether the value fits in the types in that order without losing precision.
func ConstantToInt ¶
ConstantToInt returns an int-like value from a constant. It will return an int, uint, or *big.Int depending on whether the value fits in the types in that order.
func IsValueType ¶
IsValueType returns true if the specified type can be represented as a single value.
func Len ¶
Len returns the "length" of the specified value. If v is a map, slice, or array, it returns its length If v is a struct, it returns the number of fields For everything else, Len returns 1.
func PopulateFromEnv ¶
func Set ¶
func Set(val reflect.Value, node *syntax.Node, convention encoding.NamingConvention, unmarshaler Unmarshaler, at ...interface{}) (outerr error)
Types ¶
type FieldOpts ¶
type FieldOpts struct { Name string Help []string Ignore bool Naming NamingConvention Inline bool Env string }
func ParseFieldOpts ¶
func ParseFieldOpts(tag reflect.StructTag, marshaler interface{}, convention NamingConvention) (opts FieldOpts)
ParseFieldOpts parses the standard set of field options that boa supports.
type InfMarshaler ¶
type MapEntry ¶
func VisibleFieldsAsMapEntries ¶
func VisibleFieldsAsMapEntries(val reflect.Value, convention encoding.NamingConvention, marshaler interface{}) []MapEntry
type Marshaler ¶
type Marshaler interface { MarshalValue(v reflect.Value) (bool, error) MarshalList(v reflect.Value) (bool, error) MarshalListElem(l, v reflect.Value, i int) (bool, error) MarshalMap(v reflect.Value, kvs []MapEntry) (bool, error) MarshalMapKey(mv reflect.Value, kv MapEntry, i int) error MarshalMapValue(mv reflect.Value, kv MapEntry, i int) (bool, error) MarshalBool(v bool) error MarshalString(v string) error MarshalNumber(v constant.Value) error }
type NaNMarshaler ¶
type NilMarshaler ¶
type NilMarshaler interface {
MarshalNil() error
}
type PostListElemMarshaler ¶
type PostListMarshaler ¶
type PostMapMarshaler ¶
type PostMapValueMarshaler ¶
type StructField ¶
type StructField struct { reflect.StructField Value reflect.Value Options FieldOpts }
func VisibleFields ¶
func VisibleFields(val reflect.Value, convention encoding.NamingConvention, unmarshaler interface{}) ([]StructField, map[string]StructField)