Documentation ¶
Overview ¶
Package refconv implements the Converter interface by using the standard libraries reflection package.
Package refconv implements the Converter interface by using the standard libraries reflection package.
Index ¶
- type Conv
- func (c Conv) Bool(from interface{}) (bool, error)
- func (c Conv) Duration(from interface{}) (time.Duration, error)
- func (c Conv) Float32(from interface{}) (float32, error)
- func (c Conv) Float64(from interface{}) (float64, error)
- func (c Conv) Infer(into, from interface{}) error
- func (c Conv) Int(from interface{}) (int, error)
- func (c Conv) Int16(from interface{}) (int16, error)
- func (c Conv) Int32(from interface{}) (int32, error)
- func (c Conv) Int64(from interface{}) (int64, error)
- func (c Conv) Int8(from interface{}) (int8, error)
- func (c Conv) String(from interface{}) (string, error)
- func (c Conv) Time(from interface{}) (time.Time, error)
- func (c Conv) Uint(from interface{}) (uint, error)
- func (c Conv) Uint16(from interface{}) (uint16, error)
- func (c Conv) Uint32(from interface{}) (uint32, error)
- func (c Conv) Uint64(from interface{}) (uint64, error)
- func (c Conv) Uint8(from interface{}) (uint8, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conv ¶
type Conv struct{}
Conv implements the Converter interface by using the reflection package. It will never panic, does not require initialization or share state so is safe for use by multiple Goroutines.
func (Conv) Bool ¶
Bool attempts to convert the given value to bool, returns the zero value and an error on failure.
func (Conv) Duration ¶
Duration attempts to convert the given value to time.Duration, returns the zero value and an error on failure.
func (Conv) Float32 ¶
Float32 attempts to convert the given value to Float32, returns the zero value and an error on failure.
func (Conv) Float64 ¶
Float64 attempts to convert the given value to float64, returns the zero value and an error on failure.
func (Conv) Infer ¶
Infer will perform conversion by inferring the conversion operation from the T of `into`.
func (Conv) Int ¶
Int attempts to convert the given value to int, returns the zero value and an error on failure.
func (Conv) Int16 ¶
Int16 attempts to convert the given value to int16, returns the zero value and an error on failure.
func (Conv) Int32 ¶
Int32 attempts to convert the given value to int32, returns the zero value and an error on failure.
func (Conv) Int64 ¶
Int64 attempts to convert the given value to int64, returns the zero value and an error on failure.
func (Conv) Int8 ¶
Int8 attempts to convert the given value to int8, returns the zero value and an error on failure.
func (Conv) String ¶
String returns the string representation from the given interface{} value and can not currently fail. Although an error is currently provided only for API cohesion you should still check it to be future proof.
func (Conv) Time ¶
Time attempts to convert the given value to time.Time, returns the zero value of time.Time and an error on failure.
func (Conv) Uint ¶
Uint attempts to convert the given value to uint, returns the zero value and an error on failure.
func (Conv) Uint16 ¶
Uint16 attempts to convert the given value to uint16, returns the zero value and an error on failure.
func (Conv) Uint32 ¶
Uint32 attempts to convert the given value to uint32, returns the zero value and an error on failure.