dvar

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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 Create

func Create(value interface{}, safe ...bool) Var

Create 创建var对象

func New

func New(value interface{}, safe ...bool) *Var

New 创建var的对象指针

func (*Var) Array added in v0.0.9

func (that *Var) Array() []interface{}

Array is alias of Interfaces.

func (*Var) Bool

func (that *Var) Bool() bool

func (*Var) Bytes

func (that *Var) Bytes() []byte

func (*Var) Clone

func (that *Var) Clone() *Var

func (*Var) Duration added in v0.0.3

func (that *Var) Duration() time.Duration

Duration converts and returns <v> as time.Duration. If value of <v> is string, then it uses time.ParseDuration for conversion.

func (*Var) Float32

func (that *Var) Float32() float32

Float32 converts and returns <v> as float32.

func (*Var) Float32s added in v0.0.9

func (that *Var) Float32s() []float32

Float32s converts and returns <v> as []float32.

func (*Var) Float64

func (that *Var) Float64() float64

Float64 converts and returns <v> as float64.

func (*Var) Float64s added in v0.0.9

func (that *Var) Float64s() []float64

Float64s converts and returns <v> as []float64.

func (*Var) Floats added in v0.0.9

func (that *Var) Floats() []float64

Floats is alias of Float64s.

func (*Var) GTime added in v0.0.9

func (that *Var) GTime(format ...string) *dtime.Time

GTime converts and returns <v> as *gtime.Time. The parameter <format> specifies the format of the time string using gtime, eg: Y-m-d H:i:s.

func (*Var) Int

func (that *Var) Int() int

func (*Var) Int16

func (that *Var) Int16() int16

Int16 converts and returns <v> as int16.

func (*Var) Int32

func (that *Var) Int32() int32

Int32 converts and returns <v> as int32.

func (*Var) Int64

func (that *Var) Int64() int64

Int64 converts and returns <v> as int64.

func (*Var) Int64s added in v0.0.9

func (that *Var) Int64s() []int64

Int64s 转换并返回Int64s数组

func (*Var) Int8

func (that *Var) Int8() int8

Int8 converts and returns <v> as int8.

func (*Var) Interface

func (that *Var) Interface() interface{}

Interface 返回var的值

func (*Var) Interfaces added in v0.0.9

func (that *Var) Interfaces() []interface{}

Interfaces converts and returns <v> as []interfaces{}.

func (*Var) Ints added in v0.0.9

func (that *Var) Ints() []int

Ints 转换并返回int数组

func (*Var) IsEmpty added in v0.0.7

func (that *Var) IsEmpty() bool

IsEmpty 是否为空

func (*Var) IsFloat added in v0.0.7

func (that *Var) IsFloat() bool

IsFloat 是否为float类型

func (*Var) IsInt added in v0.0.7

func (that *Var) IsInt() bool

IsInt 是否是int类型

func (*Var) IsMap added in v0.0.7

func (that *Var) IsMap() bool

IsMap 是否为map类型

func (*Var) IsNil added in v0.0.7

func (that *Var) IsNil() bool

IsNil 检查只是否为nil

func (*Var) IsSlice added in v0.0.7

func (that *Var) IsSlice() bool

IsSlice 是否为slice类型

func (*Var) IsStruct added in v0.0.7

func (that *Var) IsStruct() bool

IsStruct 是否为struct类型

func (*Var) IsUint added in v0.0.7

func (that *Var) IsUint() bool

IsUint 是否是uint类型

func (*Var) ListItemValues added in v0.0.9

func (that *Var) ListItemValues(key interface{}) (values []interface{})

ListItemValues 检索并返回键值为<键值>的所有item struct/map的元素。 注意,参数应该是包含map或struct元素的slice类型,否则返回一个空的slice。

func (*Var) ListItemValuesUnique added in v0.0.9

func (that *Var) ListItemValuesUnique(key string) []interface{}

ListItemValuesUnique 检索并返回所有struct/map中key 的唯一元素。 注意参数应该是包含map或struct元素的slice类型,否则返回一个空的slice。

func (*Var) Map added in v0.0.9

func (that *Var) Map(tags ...string) map[string]interface{}

Map 返回一个map

func (*Var) MapDeep added in v0.0.9

func (that *Var) MapDeep(tags ...string) map[string]interface{}

MapDeep 返回var转换成map[string]interface{}

func (*Var) MapStrAny added in v0.0.9

func (that *Var) MapStrAny() map[string]interface{}

MapStrAny 返回map[string]interface{}格式

func (*Var) MapStrStr added in v0.0.9

func (that *Var) MapStrStr(tags ...string) map[string]string

MapStrStr 返回字符串map

func (*Var) MapStrStrDeep added in v0.0.9

func (that *Var) MapStrStrDeep(tags ...string) map[string]string

MapStrStrDeep 返回var转换成map[string]string

func (*Var) MapStrVar added in v0.0.9

func (that *Var) MapStrVar(tags ...string) map[string]*Var

MapStrVar 返回一个字符串为key,Var为值的map

func (*Var) MapStrVarDeep added in v0.0.9

func (that *Var) MapStrVarDeep(tags ...string) map[string]*Var

MapStrVarDeep 返回var转换成 map[string]*Var

func (*Var) MapToMap added in v0.0.9

func (that *Var) MapToMap(pointer interface{}, mapping ...map[string]string) (err error)

MapToMap converts any map type variable <params> to another map type variable <pointer>. See gconv.MapToMap.

func (*Var) MapToMaps added in v0.0.9

func (that *Var) MapToMaps(pointer interface{}, mapping ...map[string]string) (err error)

MapToMaps converts any map type variable <params> to another map type variable <pointer>. See gconv.MapToMaps.

func (*Var) MapToMapsDeep added in v0.0.9

func (that *Var) MapToMapsDeep(pointer interface{}, mapping ...map[string]string) (err error)

MapToMapsDeep converts any map type variable <params> to another map type variable <pointer> recursively. See gconv.MapToMapsDeep.

func (*Var) Maps added in v0.0.9

func (that *Var) Maps(tags ...string) []map[string]interface{}

Maps 以切片的形式返回多个map,

func (*Var) MarshalJSON

func (that *Var) MarshalJSON() ([]byte, error)

MarshalJSON implements the interface MarshalJSON for json.Marshal.

func (*Var) Scan added in v0.0.9

func (that *Var) Scan(pointer interface{}, mapping ...map[string]string) error

Scan automatically calls Struct or Structs function according to the type of parameter <pointer> to implement the converting. It calls function Struct if <pointer> is type of *struct/**struct to do the converting. It calls function Structs if <pointer> is type of *[]struct/*[]*struct to do the converting.

func (*Var) ScanDeep added in v0.0.9

func (that *Var) ScanDeep(pointer interface{}, mapping ...map[string]string) error

ScanDeep automatically calls StructDeep or StructsDeep function according to the type of parameter <pointer> to implement the converting. It calls function StructDeep if <pointer> is type of *struct/**struct to do the converting. It calls function StructsDeep if <pointer> is type of *[]struct/*[]*struct to do the converting.

func (*Var) Set

func (that *Var) Set(value interface{}) (old interface{})

Set 设置值

func (*Var) Slice added in v0.0.9

func (that *Var) Slice() []interface{}

Slice is alias of Interfaces.

func (*Var) String

func (that *Var) String() string

func (*Var) Strings added in v0.0.9

func (that *Var) Strings() []string

Strings converts and returns <v> as []string.

func (*Var) Struct added in v0.0.9

func (that *Var) Struct(pointer interface{}, mapping ...map[string]string) error

Struct maps value of <v> to <pointer>. The parameter <pointer> should be a pointer to a struct instance. The parameter <mapping> is used to specify the key-to-attribute mapping rules.

func (*Var) StructDeep added in v0.0.9

func (that *Var) StructDeep(pointer interface{}, mapping ...map[string]string) error

StructDeep maps value of <v> to <pointer> recursively. The parameter <pointer> should be a pointer to a struct instance. The parameter <mapping> is used to specify the key-to-attribute mapping rules. Deprecated, use Struct instead.

func (*Var) Structs added in v0.0.9

func (that *Var) Structs(pointer interface{}, mapping ...map[string]string) error

Structs converts and returns <v> as given struct slice.

func (*Var) StructsDeep added in v0.0.9

func (that *Var) StructsDeep(pointer interface{}, mapping ...map[string]string) error

StructsDeep converts and returns <v> as given struct slice recursively. Deprecated, use Struct instead.

func (*Var) Time added in v0.0.9

func (that *Var) Time(format ...string) time.Time

Time converts and returns <v> as time.Time. The parameter <format> specifies the format of the time string using gtime, eg: Y-m-d H:i:s.

func (*Var) Uint

func (that *Var) Uint() uint

Uint converts and returns <v> as uint.

func (*Var) Uint16

func (that *Var) Uint16() uint16

Uint16 converts and returns <v> as uint16.

func (*Var) Uint32

func (that *Var) Uint32() uint32

Uint32 converts and returns <v> as uint32.

func (*Var) Uint64

func (that *Var) Uint64() uint64

Uint64 converts and returns <v> as uint64.

func (*Var) Uint64s added in v0.0.9

func (that *Var) Uint64s() []uint64

Uint64s converts and returns <v> as []uint64.

func (*Var) Uint8

func (that *Var) Uint8() uint8

Uint8 converts and returns <v> as uint8.

func (*Var) Uints added in v0.0.9

func (that *Var) Uints() []uint

Uints 转换并返回uint数组

func (*Var) UnmarshalJSON

func (that *Var) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.

func (*Var) UnmarshalValue

func (that *Var) UnmarshalValue(value interface{}) error

UnmarshalValue is an interface implement which sets any type of value for Var.

func (*Var) Val

func (that *Var) Val() interface{}

Val 获取dvar的值

func (*Var) Vars added in v0.0.9

func (that *Var) Vars() []*Var

Vars converts and returns <v> as []Var.

Jump to

Keyboard shortcuts

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