gvar

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package gvar provides an universal variable type, like generics.

通用动态变量.

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 New

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

创建一个动态变量,value参数可以为nil

func (*Var) Bool

func (v *Var) Bool() bool

func (*Var) Bytes

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

func (*Var) Float32

func (v *Var) Float32() float32

func (*Var) Float64

func (v *Var) Float64() float64

func (*Var) Floats

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

func (*Var) GTime added in v1.3.8

func (v *Var) GTime(format ...string) *gtime.Time

func (*Var) Int

func (v *Var) Int() int

func (*Var) Int16

func (v *Var) Int16() int16

func (*Var) Int32

func (v *Var) Int32() int32

func (*Var) Int64

func (v *Var) Int64() int64

func (*Var) Int8

func (v *Var) Int8() int8

func (*Var) Interface

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

Val() 别名

func (*Var) Interfaces

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

func (*Var) Ints

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

func (*Var) IsNil

func (v *Var) IsNil() bool

func (*Var) ReadOnly added in v1.2.11

func (v *Var) ReadOnly() VarRead

返回动态变量的只读接口

func (*Var) Set

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

func (*Var) String

func (v *Var) String() string

func (*Var) Strings

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

func (*Var) Struct

func (v *Var) Struct(objPointer interface{}, attrMapping ...map[string]string) error

将变量转换为对象,注意 objPointer 参数必须为struct指针

func (*Var) Time

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

func (*Var) TimeDuration

func (v *Var) TimeDuration() time.Duration

func (*Var) Uint

func (v *Var) Uint() uint

func (*Var) Uint16

func (v *Var) Uint16() uint16

func (*Var) Uint32

func (v *Var) Uint32() uint32

func (*Var) Uint64

func (v *Var) Uint64() uint64

func (*Var) Uint8

func (v *Var) Uint8() uint8

func (*Var) Val

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

type VarRead added in v1.2.11

type VarRead interface {
	Val() interface{}
	IsNil() bool
	Bytes() []byte
	String() string
	Bool() bool
	Int() int
	Int8() int8
	Int16() int16
	Int32() int32
	Int64() int64
	Uint() uint
	Uint8() uint8
	Uint16() uint16
	Uint32() uint32
	Uint64() uint64
	Float32() float32
	Float64() float64
	Interface() interface{}
	Ints() []int
	Floats() []float64
	Strings() []string
	Interfaces() []interface{}
	Time(format ...string) time.Time
	TimeDuration() time.Duration
	GTime(format ...string) *gtime.Time
	Struct(objPointer interface{}, attrMapping ...map[string]string) error
}

只读变量接口

func NewRead added in v1.2.11

func NewRead(value interface{}, unsafe ...bool) VarRead

创建一个只读动态变量,value参数可以为nil

Jump to

Keyboard shortcuts

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