Documentation ¶
Index ¶
- Constants
- Variables
- func CloneValue(src interface{}) interface{}
- func CloneValueTo(dst interface{}, src interface{})
- func CoalesceFloat32(values ...float32) float32
- func CoalesceFloat64(values ...float64) float64
- func CoalesceInt(values ...int) int
- func CoalesceInt16(values ...int16) int16
- func CoalesceInt32(values ...int32) int32
- func CoalesceInt64(values ...int64) int64
- func CoalesceInt8(values ...int8) int8
- func CoalesceString(values ...string) string
- func CoalesceUint(values ...uint) uint
- func CoalesceUint16(values ...uint16) uint16
- func CoalesceUint32(values ...uint32) uint32
- func CoalesceUint64(values ...uint64) uint64
- func CoalesceUint8(values ...uint8) uint8
- func ConvertAssign(dest, src interface{}) error
- func ConvertToBoolean(val interface{}) (res bool, valid bool)
- func ConvertToFloat32(val interface{}) (res float32, valid bool)
- func ConvertToFloat64(val interface{}) (res float64, valid bool)
- func ConvertToInt(val interface{}) (res int, valid bool)
- func ConvertToInt16(val interface{}) (res int16, valid bool)
- func ConvertToInt32(val interface{}) (res int32, valid bool)
- func ConvertToInt64(val interface{}) (res int64, valid bool)
- func ConvertToInt8(val interface{}) (res int8, valid bool)
- func ConvertToString(val interface{}) (res string, valid bool)
- func ConvertToTime(val interface{}) (res time.Time, valid bool)
- func ConvertToUint(val interface{}) (res uint, valid bool)
- func ConvertToUint16(val interface{}) (res uint16, valid bool)
- func ConvertToUint32(val interface{}) (res uint32, valid bool)
- func ConvertToUint64(val interface{}) (res uint64, valid bool)
- func ConvertToUint8(val interface{}) (res uint8, valid bool)
- func ImplodeInt(list []int, delim string) string
- func ImplodeInt16(list []int16, delim string) string
- func ImplodeInt32(list []int32, delim string) string
- func ImplodeInt64(list []int64, delim string) string
- func ImplodeInt8(list []int8, delim string) string
- func ImplodeUint(list []uint, delim string) string
- func ImplodeUint16(list []uint16, delim string) string
- func ImplodeUint32(list []uint32, delim string) string
- func ImplodeUint64(list []uint64, delim string) string
- func ImplodeUint8(list []uint8, delim string) string
- func IsEmpty(value interface{}) bool
- func IsEqualMaps(a, b map[string]interface{}) bool
- func MakePointerTo(obj interface{}) interface{}
- func ResetFields(rec interface{}, fields []string)
- type Getter
- type GetterFunc
- type GetterSetter
- type Parameters
- type Params
- func (params Params) Get(ctx context.Context, key string, defValue interface{}) (interface{}, error)
- func (params Params) GetBoolean(ctx context.Context, key string, defValue bool) (bool, error)
- func (params Params) GetFloat32(ctx context.Context, key string, defValue float32) (float32, error)
- func (params Params) GetFloat64(ctx context.Context, key string, defValue float64) (float64, error)
- func (params Params) GetInt(ctx context.Context, key string, defValue int) (int, error)
- func (params Params) GetInt16(ctx context.Context, key string, defValue int16) (int16, error)
- func (params Params) GetInt32(ctx context.Context, key string, defValue int32) (int32, error)
- func (params Params) GetInt64(ctx context.Context, key string, defValue int64) (int64, error)
- func (params Params) GetInt8(ctx context.Context, key string, defValue int8) (int8, error)
- func (params Params) GetString(ctx context.Context, key string, defValue string) (string, error)
- func (params Params) GetTime(ctx context.Context, key string, defValue time.Time) (time.Time, error)
- func (params Params) GetUint(ctx context.Context, key string, defValue uint) (uint, error)
- func (params Params) GetUint16(ctx context.Context, key string, defValue uint16) (uint16, error)
- func (params Params) GetUint32(ctx context.Context, key string, defValue uint32) (uint32, error)
- func (params Params) GetUint64(ctx context.Context, key string, defValue uint64) (uint64, error)
- func (params Params) GetUint8(ctx context.Context, key string, defValue uint8) (uint8, error)
- func (params Params) JSON() string
- func (params Params) Set(ctx context.Context, key string, value interface{}) error
- func (params Params) SetBoolean(ctx context.Context, key string, value bool) error
- func (params Params) SetFloat32(ctx context.Context, key string, value float32) error
- func (params Params) SetFloat64(ctx context.Context, key string, value float64) error
- func (params Params) SetInt(ctx context.Context, key string, value int) error
- func (params Params) SetInt16(ctx context.Context, key string, value int16) error
- func (params Params) SetInt32(ctx context.Context, key string, value int32) error
- func (params Params) SetInt64(ctx context.Context, key string, value int64) error
- func (params Params) SetInt8(ctx context.Context, key string, value int8) error
- func (params Params) SetString(ctx context.Context, key string, value string) error
- func (params Params) SetTime(ctx context.Context, key string, value time.Time) error
- func (params Params) SetUint(ctx context.Context, key string, value uint) error
- func (params Params) SetUint16(ctx context.Context, key string, value uint16) error
- func (params Params) SetUint32(ctx context.Context, key string, value uint32) error
- func (params Params) SetUint64(ctx context.Context, key string, value uint64) error
- func (params Params) SetUint8(ctx context.Context, key string, value uint8) error
- type RawBytes
- type Reader
- type ReaderWriter
- type Scanner
- type Serializer
- type Setter
- type Writer
Constants ¶
View Source
const ( DateFormat = "2006-01-02" TimeFormat = "15:04:05" DateTimeFormat = "2006-01-02 15:04:05" )
Variables ¶
View Source
var ErrNoMatch = errors.New("no rows")
Functions ¶
func CloneValue ¶
func CloneValue(src interface{}) interface{}
func CloneValueTo ¶
func CloneValueTo(dst interface{}, src interface{})
Deep copy value Usage^
type data struct { a string b string c []string } src := &data{ "works1", "works2", []string{"a", "b"}, } var dst data CloneValueTo(&dst, src) src.c = append(src.c, "c") fmt.Println(src) fmt.Println(dst)
So you can pass any type at run time as long as you're sure that source and destin are both of the same type, (and destin is a pointer to that type).
func CoalesceFloat32 ¶
func CoalesceFloat64 ¶
func CoalesceInt ¶
func CoalesceInt16 ¶
func CoalesceInt32 ¶
func CoalesceInt64 ¶
func CoalesceInt8 ¶
func CoalesceString ¶
func CoalesceUint ¶
func CoalesceUint16 ¶
func CoalesceUint32 ¶
func CoalesceUint64 ¶
func CoalesceUint8 ¶
func ConvertAssign ¶
func ConvertAssign(dest, src interface{}) error
func ConvertToBoolean ¶
func ConvertToFloat32 ¶
func ConvertToFloat64 ¶
func ConvertToInt ¶
func ConvertToInt16 ¶
func ConvertToInt32 ¶
func ConvertToInt64 ¶
func ConvertToInt8 ¶
func ConvertToString ¶
func ConvertToTime ¶
func ConvertToUint ¶
func ConvertToUint16 ¶
func ConvertToUint32 ¶
func ConvertToUint64 ¶
func ConvertToUint8 ¶
func ImplodeInt ¶
func ImplodeInt16 ¶
func ImplodeInt32 ¶
func ImplodeInt64 ¶
func ImplodeInt8 ¶
func ImplodeUint ¶
func ImplodeUint16 ¶
func ImplodeUint32 ¶
func ImplodeUint64 ¶
func ImplodeUint8 ¶
func IsEqualMaps ¶
func MakePointerTo ¶
func MakePointerTo(obj interface{}) interface{}
func ResetFields ¶
func ResetFields(rec interface{}, fields []string)
Types ¶
type GetterFunc ¶
type GetterSetter ¶
type Parameters ¶
type Parameters interface { ReaderWriter JSON() string }
type Params ¶
type Params map[string]interface{}
List of various named parameters
func (Params) GetBoolean ¶
func (Params) GetFloat32 ¶
func (Params) GetFloat64 ¶
func (Params) SetBoolean ¶
func (Params) SetFloat32 ¶
func (Params) SetFloat64 ¶
type Reader ¶
type Reader interface { Get(ctx context.Context, key string, defValue interface{}) (interface{}, error) GetInt(ctx context.Context, key string, defValue int) (int, error) GetInt8(ctx context.Context, key string, defValue int8) (int8, error) GetInt16(ctx context.Context, key string, defValue int16) (int16, error) GetInt32(ctx context.Context, key string, defValue int32) (int32, error) GetInt64(ctx context.Context, key string, defValue int64) (int64, error) GetUint(ctx context.Context, key string, defValue uint) (uint, error) GetUint8(ctx context.Context, key string, defValue uint8) (uint8, error) GetUint16(ctx context.Context, key string, defValue uint16) (uint16, error) GetUint32(ctx context.Context, key string, defValue uint32) (uint32, error) GetUint64(ctx context.Context, key string, defValue uint64) (uint64, error) GetFloat32(ctx context.Context, key string, defValue float32) (float32, error) GetFloat64(ctx context.Context, key string, defValue float64) (float64, error) GetString(ctx context.Context, key string, defValue string) (string, error) GetBoolean(ctx context.Context, key string, defValue bool) (bool, error) GetTime(ctx context.Context, key string, defValue time.Time) (time.Time, error) }
type ReaderWriter ¶
func NewReaderWriter ¶
func NewReaderWriter(manager GetterSetter) ReaderWriter
type Scanner ¶
type Scanner interface {
Scan(src interface{}) error
}
Data scanner (see standard package database/sql)
type Serializer ¶
type Serializer interface { Serialize(src interface{}) (string, error) Unserialize(src string, dst interface{}) error }
func NewSerializer ¶
func NewSerializer() Serializer
type Writer ¶
type Writer interface { Set(ctx context.Context, key string, value interface{}) error SetInt(ctx context.Context, key string, value int) error SetInt8(ctx context.Context, key string, value int8) error SetInt16(ctx context.Context, key string, value int16) error SetInt32(ctx context.Context, key string, value int32) error SetInt64(ctx context.Context, key string, value int64) error SetUint(ctx context.Context, key string, value uint) error SetUint8(ctx context.Context, key string, value uint8) error SetUint16(ctx context.Context, key string, value uint16) error SetUint32(ctx context.Context, key string, value uint32) error SetUint64(ctx context.Context, key string, value uint64) error SetFloat32(ctx context.Context, key string, value float32) error SetFloat64(ctx context.Context, key string, value float64) error SetString(ctx context.Context, key string, value string) error SetBoolean(ctx context.Context, key string, value bool) error SetTime(ctx context.Context, key string, value time.Time) error }
Click to show internal directories.
Click to hide internal directories.