Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TypeBool = reflect.TypeOf(false)
TypeBool represents the bool type.
var TypeFloat32 = reflect.TypeOf(float32(0))
TypeFloat32 represents the float32 type.
var TypeFloat64 = reflect.TypeOf(float64(0))
TypeFloat64 represents the float64 type.
var TypeInt = reflect.TypeOf(0)
TypeInt represents the int type.
var TypeInt16 = reflect.TypeOf(int16(0))
TypeInt16 represents the int16 type.
var TypeInt32 = reflect.TypeOf(int32(0))
TypeInt32 represents the int32 type.
var TypeInt64 = reflect.TypeOf(int64(0))
TypeInt64 represents the int64 type.
var TypeInt8 = reflect.TypeOf(int8(0))
TypeInt8 represents the int8 type.
var TypeString = reflect.TypeOf("")
TypeString represents the string type.
var TypeUint = reflect.TypeOf(uint(0))
TypeUint represents the uint type.
var TypeUint16 = reflect.TypeOf(uint16(0))
TypeUint16 represents the uint16 type.
var TypeUint32 = reflect.TypeOf(uint32(0))
TypeUint32 represents the uint32 type.
var TypeUint64 = reflect.TypeOf(uint64(0))
TypeUint64 represents the uint64 type.
var TypeUint8 = reflect.TypeOf(uint8(0))
TypeUint8 represents the uint8 type.
Functions ¶
Types ¶
type Conversions ¶
Conversion is a type alias for a Conversions instance that is used for converting between Go types.
func New ¶
func New(opts ...Option) (*Conversions, error)
New creates a new Conversions instance configured to convert between Go types.
type Option ¶
func WithDefaultConversions ¶
func WithDefaultConversions() Option
WithDefaultConversions makes default type conversions available, this will add converters between the built-in types, such as string to int. The following types are supported: string, int, int8, in16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, bool.
These converters run in safe mode where they will error if they can not convert the value, such as turning a non-numeric string into an int. Or uint64 into an int32 if the value is too large.