Documentation ¶
Index ¶
- Variables
- func AppendError(base error, err error) error
- func Autotype(in interface{}) interface{}
- func ConvertTo(toType ConvertType, inI interface{}) (interface{}, error)
- func ConvertToBool(in interface{}) (bool, error)
- func ConvertToBytes(in interface{}) ([]byte, error)
- func ConvertToFloat(in interface{}) (float64, error)
- func ConvertToInteger(in interface{}) (int64, error)
- func ConvertToString(in interface{}) (string, error)
- func ConvertToTime(in interface{}) (time.Time, error)
- func DetectTimeFormat(in string) string
- func GenericMarshalJSON(in interface{}, extraData ...map[string]interface{}) ([]byte, error)
- func IsBoolean(inI interface{}) bool
- func IsBooleanFalse(inI interface{}) bool
- func IsBooleanTrue(inI interface{}) bool
- func IsFloat(in interface{}) bool
- func IsInteger(in interface{}) bool
- func IsKind(in interface{}, kinds ...reflect.Kind) bool
- func IsNumeric(in interface{}) bool
- func IsTime(inI interface{}) bool
- func IsZero(value interface{}) bool
- func ParseDuration(in string) (time.Duration, error)
- func ResolveValue(in interface{}) interface{}
- func SliceEach(slice interface{}, iterFn IterationFunc, preserve ...reflect.Kind) error
- func ToString(in interface{}) (string, error)
- type ConvertType
- type IterationFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var BooleanFalseValues = []string{`false`, `no`, `off`}
View Source
var BooleanTrueValues = []string{`true`, `yes`, `on`}
View Source
var CompoundTypes = []reflect.Kind{ reflect.Invalid, reflect.Complex64, reflect.Complex128, reflect.Array, reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice, reflect.Struct, }
View Source
var NilStrings = []string{`null`, `NULL`, `<nil>`, `nil`, `Nil`, `None`, `undefined`, ``}
View Source
var Stop = fmt.Errorf("stop iterating")
View Source
var TimeFormats = []string{ time.RFC3339, time.RFC3339Nano, time.ANSIC, time.UnixDate, time.RubyDate, time.RFC850, time.RFC822, time.RFC822Z, time.RFC1123, time.RFC1123Z, time.Kitchen, `2006-01-02 15:04:05.000000000`, `2006-01-02 15:04:05.000000`, `2006-01-02 15:04:05.000`, `2006-01-02 15:04:05 -0700 MST`, `2006-01-02 15:04:05Z07:00`, `2006-01-02 15:04:05`, `2006-01-02 15:04`, `2006-01-02`, `2006-01-02T15:04:05.000000000`, `2006-01-02T15:04:05.000000`, `2006-01-02T15:04:05.000`, `2006-01-02T15:04:05 -0700 MST`, `2006-01-02T15:04:05Z07:00`, `2006-01-02T15:04:05`, `2006-01-02T15:04`, }
Functions ¶
func AppendError ¶
Appends on error to another, allowing for operations that return multiple errors to remain compatible within a single-valued context.
func ConvertTo ¶
func ConvertTo(toType ConvertType, inI interface{}) (interface{}, error)
func ConvertToBool ¶
func ConvertToBytes ¶
func ConvertToFloat ¶
func ConvertToInteger ¶
func ConvertToString ¶
func ConvertToTime ¶
func DetectTimeFormat ¶
func GenericMarshalJSON ¶
func IsBooleanFalse ¶
func IsBooleanFalse(inI interface{}) bool
func IsBooleanTrue ¶
func IsBooleanTrue(inI interface{}) bool
func IsKind ¶
Dectect whether the concrete underlying value of the given input is one or more Kinds of value.
func IsZero ¶
func IsZero(value interface{}) bool
Returns whether the given value represents the underlying type's zero value
func ResolveValue ¶
func ResolveValue(in interface{}) interface{}
Types ¶
type ConvertType ¶
type ConvertType int
const ( Invalid ConvertType = iota Nil String Boolean Float Integer Time Bytes )
func DetectConvertType ¶
func DetectConvertType(in interface{}) ConvertType
func (ConvertType) String ¶
func (self ConvertType) String() string
type IterationFunc ¶
Click to show internal directories.
Click to hide internal directories.