gvar

package
v1.6.16 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 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

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) Bool

func (v *Var) Bool() bool

func (*Var) Bytes

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

func (*Var) Duration

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

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

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

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

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) 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{}

See 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) Set

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

Set sets <value> to <v>, and returns the old value.

func (*Var) String

func (v *Var) String() string

func (*Var) Strings

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

func (*Var) Struct

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

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

func (*Var) Time

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

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

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{}

Val returns the current value of <v>.

Jump to

Keyboard shortcuts

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