Documentation ¶
Overview ¶
Package gvar provides an universal variable type, like generics.
Index ¶
- type Var
- func (v *Var) Bool() bool
- func (v *Var) Bytes() []byte
- func (v *Var) Duration() time.Duration
- func (v *Var) Float32() float32
- func (v *Var) Float64() float64
- func (v *Var) Floats() []float64
- func (v *Var) GTime(format ...string) *gtime.Time
- func (v *Var) Int() int
- func (v *Var) Int16() int16
- func (v *Var) Int32() int32
- func (v *Var) Int64() int64
- func (v *Var) Int8() int8
- func (v *Var) Interface() interface{}
- func (v *Var) Interfaces() []interface{}
- func (v *Var) Ints() []int
- func (v *Var) IsNil() bool
- func (v *Var) Set(value interface{}) (old interface{})
- func (v *Var) String() string
- func (v *Var) Strings() []string
- func (v *Var) Struct(objPointer interface{}, attrMapping ...map[string]string) error
- func (v *Var) Time(format ...string) time.Time
- func (v *Var) Uint() uint
- func (v *Var) Uint16() uint16
- func (v *Var) Uint32() uint32
- func (v *Var) Uint64() uint64
- func (v *Var) Uint8() uint8
- func (v *Var) Val() interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Var ¶
type Var struct {
// contains filtered or unexported fields
}
func New ¶
New returns a new Var with given <value>. The param <unsafe> used to specify whether using Var in un-concurrent-safety, which is false in default, means concurrent-safe.
func (*Var) Duration ¶
TimeDuration converts and returns <v> as time.Duration. If value of <v> is string, then it uses time.ParseDuration for conversion.
func (*Var) GTime ¶
GTime converts and returns <v> as *gtime.Time. The param <format> specifies the format of the time string using gtime, eg: Y-m-d H:i:s.
func (*Var) Interfaces ¶
func (v *Var) Interfaces() []interface{}
func (*Var) Set ¶
func (v *Var) Set(value interface{}) (old interface{})
Set sets <value> to <v>, and returns the old value.
func (*Var) Struct ¶
Struct maps value of <v> to <objPointer>. The param <objPointer> should be a pointer to a struct instance. The param <attrMapping> is used to specify the key-to-attribute mapping rules.