ztype

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 8 Imported by: 29

Documentation

Overview

Package ztype provides Variable Type Related Operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyToDecimal added in v1.1.11

func AnyToDecimal(value string, base int) (v int)

AnyToDecimal Convert arbitrary decimal values to decimal

func DecimalToAny added in v1.1.11

func DecimalToAny(value, base int) (newNumStr string)

DecimalToAny Convert decimal to arbitrary decimal values

func GetType

func GetType(s interface{}) string

GetType Get variable type

func InArray added in v0.0.19

func InArray(needle, hystack interface{}) bool

func IsBool

func IsBool(v interface{}) bool

IsBool Is Bool

func IsByte

func IsByte(v interface{}) bool

IsByte Is []byte

func IsEmpty added in v0.0.19

func IsEmpty(value interface{}) bool

func IsFloat32

func IsFloat32(v interface{}) bool

IsFloat32 Is float32

func IsFloat64

func IsFloat64(v interface{}) bool

IsFloat64 Is float64

func IsInt

func IsInt(v interface{}) bool

IsInt Is int

func IsInt16

func IsInt16(v interface{}) bool

IsInt16 Is int16

func IsInt32

func IsInt32(v interface{}) bool

IsInt32 Is int32

func IsInt64

func IsInt64(v interface{}) bool

IsInt64 Is int64

func IsInt8

func IsInt8(v interface{}) bool

IsInt8 Is int8

func IsInterface

func IsInterface(v interface{}) bool

IsInterface Is interface{}

func IsString

func IsString(v interface{}) bool

IsString Is String

func IsStruct

func IsStruct(v interface{}) bool

IsStruct Is Struct

func IsUint

func IsUint(v interface{}) bool

IsUint Is uint

func IsUint16

func IsUint16(v interface{}) bool

IsUint16 Is uint16

func IsUint32

func IsUint32(v interface{}) bool

IsUint32 Is uint32

func IsUint64

func IsUint64(v interface{}) bool

IsUint64 Is uint64

func IsUint8

func IsUint8(v interface{}) bool

IsUint8 Is uint8

func MapKeyExists

func MapKeyExists(key interface{}, m map[interface{}]interface{}) bool

MapKeyExists Whether the dictionary key exists

func ReflectPtr added in v0.0.19

func ReflectPtr(r reflect.Value) reflect.Value

func Slice deprecated added in v0.0.19

func Slice(value interface{}) []interface{}

Deprecated: please use ToSlice

func SliceStrToIface added in v1.3.0

func SliceStrToIface(slice []string) []interface{}

SliceStrToIface []string to []interface{}

func ToBool

func ToBool(i interface{}) bool

ToBool to Bool

func ToByte

func ToByte(i interface{}) []byte

ToByte to []byte

func ToFloat32

func ToFloat32(i interface{}) float32

ToFloat32 to float32

func ToFloat64

func ToFloat64(i interface{}) float64

ToFloat64 to float64

func ToInt

func ToInt(i interface{}) int

ToInt to int

func ToInt16

func ToInt16(i interface{}) int16

ToInt16 to int16

func ToInt32

func ToInt32(i interface{}) int32

ToInt32 to int32

func ToInt64

func ToInt64(i interface{}) int64

ToInt64 to int64

func ToInt8

func ToInt8(i interface{}) int8

ToInt8 to int8

func ToMapString added in v0.0.19

func ToMapString(value interface{}, tags ...string) map[string]interface{}

ToMapString ToMapString

func ToMapStringDeep added in v0.0.19

func ToMapStringDeep(value interface{}, tags ...string) map[string]interface{}

func ToSlice added in v1.3.6

func ToSlice(value interface{}) (s []interface{})

func ToSliceMapString added in v0.0.19

func ToSliceMapString(value interface{}) []map[string]interface{}

ToSliceMapString to SliceMapString

func ToString

func ToString(i interface{}) string

ToString to String

func ToTime added in v1.3.8

func ToTime(i interface{}) (time.Time, error)

ToTime to time.Time

func ToUint

func ToUint(i interface{}) uint

ToUint to uint

func ToUint16

func ToUint16(i interface{}) uint16

ToUint16 to uint16

func ToUint32

func ToUint32(i interface{}) uint32

ToUint32 to uint32

func ToUint64

func ToUint64(i interface{}) uint64

ToUint64 to uint64

func ToUint8

func ToUint8(i interface{}) uint8

ToUint8 to uint8

Types

type Map added in v1.3.7

type Map map[string]interface{}

func (Map) Get added in v1.3.7

func (m Map) Get(key string) *Type

type StruBuilder added in v1.3.3

type StruBuilder struct {
	// contains filtered or unexported fields
}

func NewMapStruct added in v1.3.1

func NewMapStruct(key interface{}) *StruBuilder

func NewSliceStruct added in v1.3.3

func NewSliceStruct() *StruBuilder

func NewStruct added in v1.3.1

func NewStruct() *StruBuilder

func (*StruBuilder) AddField added in v1.3.3

func (b *StruBuilder) AddField(name string, fieldType interface{}, tag ...string) *StruBuilder

func (*StruBuilder) Copy added in v1.3.3

func (b *StruBuilder) Copy(v *StruBuilder) *StruBuilder

func (*StruBuilder) GetField added in v1.3.3

func (b *StruBuilder) GetField(name string) *StruField

func (*StruBuilder) HasField added in v1.3.3

func (b *StruBuilder) HasField(name string) bool

func (*StruBuilder) Interface added in v1.3.3

func (b *StruBuilder) Interface() interface{}

func (*StruBuilder) Merge added in v1.3.3

func (b *StruBuilder) Merge(values ...interface{}) *StruBuilder

func (*StruBuilder) RemoveField added in v1.3.3

func (b *StruBuilder) RemoveField(name string) *StruBuilder

func (*StruBuilder) Type added in v1.3.3

func (b *StruBuilder) Type() reflect.Type

func (*StruBuilder) Value added in v1.3.3

func (b *StruBuilder) Value() reflect.Value

type StruField added in v1.3.3

type StruField struct {
	// contains filtered or unexported fields
}

func (*StruField) SetTag added in v1.3.3

func (f *StruField) SetTag(tag string) *StruField

func (*StruField) SetType added in v1.3.3

func (f *StruField) SetType(typ interface{}) *StruField

type Type added in v1.3.6

type Type struct {
	// contains filtered or unexported fields
}

func New added in v1.3.6

func New(v interface{}) Type

func (Type) Bool added in v1.3.6

func (t Type) Bool() bool

func (Type) Exists added in v1.3.6

func (t Type) Exists() bool

func (Type) Float32 added in v1.3.6

func (t Type) Float32() float32

func (Type) Float64 added in v1.3.6

func (t Type) Float64() float64

func (Type) Int added in v1.3.6

func (t Type) Int() int

func (Type) Int16 added in v1.3.6

func (t Type) Int16() int16

func (Type) Int32 added in v1.3.6

func (t Type) Int32() int32

func (Type) Int64 added in v1.3.6

func (t Type) Int64() int64

func (Type) Int8 added in v1.3.6

func (t Type) Int8() int8

func (Type) MapString added in v1.3.6

func (t Type) MapString() map[string]interface{}

func (Type) Slice added in v1.3.6

func (t Type) Slice() []interface{}

func (Type) String added in v1.3.6

func (t Type) String() string

func (Type) Time added in v1.3.8

func (t Type) Time() (time.Time, error)

func (Type) ToByte added in v1.3.6

func (t Type) ToByte() []byte

func (Type) Uint added in v1.3.6

func (t Type) Uint() uint

func (Type) Uint16 added in v1.3.6

func (t Type) Uint16() uint16

func (Type) Uint32 added in v1.3.6

func (t Type) Uint32() uint32

func (Type) Uint64 added in v1.3.6

func (t Type) Uint64() uint64

func (Type) Uint8 added in v1.3.6

func (t Type) Uint8() uint8

func (Type) Value added in v1.3.6

func (t Type) Value() interface{}

Jump to

Keyboard shortcuts

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