util

package
v0.0.0-...-4155a33 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 9 Imported by: 23

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(typename string, o interface{}) interface{}

func AsBool

func AsBool(o interface{}, defaultval bool) (r bool)

func AsBoolErr

func AsBoolErr(o interface{}, err error) (bool, error)

func AsError

func AsError(o interface{}) error

func AsFloat32

func AsFloat32(o interface{}, defaultval float32) (r float32)

func AsFloat32Err

func AsFloat32Err(o interface{}, err error) (float32, error)

func AsFloat64

func AsFloat64(o interface{}, defaultval float64) (r float64)

func AsFloat64Err

func AsFloat64Err(o interface{}, err error) (float64, error)

func AsInt

func AsInt(o interface{}, defaultval int) (r int)

func AsInt64

func AsInt64(o interface{}, defaultval int64) (r int64)

func AsInt64Err

func AsInt64Err(o interface{}, err error) (int64, error)

func AsIntErr

func AsIntErr(o interface{}, err error) (int, error)

func AsMap

func AsMap(o interface{}, createIfNot bool) map[string]interface{}

func AsMapErr

func AsMapErr(o interface{}, err error) (map[string]interface{}, error)

func AsSlice

func AsSlice(o interface{}, createIfNotLen int) []interface{}

func AsSliceErr

func AsSliceErr(o interface{}, err error) ([]interface{}, error)

func AsStr

func AsStr(o interface{}, defaultval string) (r string)

func AsStrErr

func AsStrErr(o interface{}, err error) (string, error)

func AsStringArrayErr

func AsStringArrayErr(o interface{}, err error) ([]string, error)

func AsStringMap

func AsStringMap(o interface{}, createIfNot bool) map[string]string

func AsStringMapErr

func AsStringMapErr(o interface{}, err error) (map[string]string, error)

func AsStringSlice

func AsStringSlice(o interface{}, createIfNotLen int) []string

func AsTime

func AsTime(o interface{}, def *time.Time) (t *time.Time)

func AsUInt32

func AsUInt32(o interface{}, defaultval uint32) (r uint32)

func AsUInt64

func AsUInt64(o interface{}, defaultval uint64) (r uint64)

func AsWithErr

func AsWithErr(typename string, o interface{}) (interface{}, error)

func CastComplex

func CastComplex(o interface{}, t reflect.Type) interface{}

func CastSimple

func CastSimple(o interface{}, t reflect.Type) interface{}

func CastSimpleV

func CastSimpleV(oval reflect.Value, t reflect.Type) reflect.Value

func ColRowToMaps

func ColRowToMaps(cols []string, rows []interface{}) ([]interface{}, error)

func Get

func Get(o interface{}, defaultval interface{}, keys ...interface{}) (r interface{})

func GetBool

func GetBool(o interface{}, defaultval bool, keys ...interface{}) (val bool)

func GetFloat64

func GetFloat64(o interface{}, defaultval float64, keys ...interface{}) (val float64)

func GetInt

func GetInt(o interface{}, defaultval int, keys ...interface{}) (val int)

func GetInt64

func GetInt64(o interface{}, defaultval int64, keys ...interface{}) (val int64)

func GetMap

func GetMap(o interface{}, createifnil bool, keys ...interface{}) (val map[string]interface{})

func GetSlice

func GetSlice(o interface{}, keys ...interface{}) (val []interface{})

func GetStr

func GetStr(o interface{}, defaultval string, keys ...interface{}) (val string)

func GetStringMap

func GetStringMap(o interface{}, createifnil bool, keys ...interface{}) (val map[string]string)

func GetStringSlice

func GetStringSlice(o interface{}, keys ...interface{}) (val []string)

func GetUInt64

func GetUInt64(o interface{}, defaultval uint64, keys ...interface{}) (val uint64)

func MapClone

func MapClone(src map[string]interface{}, depth int) map[string]interface{}

func MapCloneShallow

func MapCloneShallow(src map[string]interface{}) map[string]interface{}

func MapMerge

func MapMerge(des interface{}, src interface{}, override bool) interface{}

func MapStringToFloat64

func MapStringToFloat64(o interface{}) map[string]interface{}

func NumberAsInt

func NumberAsInt(o interface{}) (int, error)

func SimpleNumberAsInt

func SimpleNumberAsInt(o interface{}) (int, error)

func SliceClone

func SliceClone(src []interface{}, depth int) []interface{}

func SliceCloneShallow

func SliceCloneShallow(src []interface{}) []interface{}

func SliceConcat

func SliceConcat(src ...[]interface{}) []interface{}

func SliceJoin

func SliceJoin(slice []interface{}, prefix string, inter string, suffix string) string

func SliceToString

func SliceToString(seperator string, v ...interface{}) string

func StringSliceJoin

func StringSliceJoin(slice []string, prefix string, inter string, suffix string) string

Types

type LazyData

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

func (*LazyData) GetData

func (o *LazyData) GetData(key string) (val interface{})

func (*LazyData) RemoveData

func (o *LazyData) RemoveData(key string) LazyDataKind

func (*LazyData) SetData

func (o *LazyData) SetData(key string, val interface{}) LazyDataKind

type LazyDataKind

type LazyDataKind interface {
	GetData(key string) (val interface{})
	SetData(key string, val interface{}) LazyDataKind
	RemoveData(key string) LazyDataKind
}

Jump to

Keyboard shortcuts

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