t

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: MIT Imports: 4 Imported by: 14

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnyType = reflect.TypeOf((interface{})(nil))
View Source
var BoolType = reflect.TypeOf(Bool(false))
View Source
var Complex128Type = reflect.TypeOf(complex128(0))
View Source
var Complex64Type = reflect.TypeOf(complex64(0))
View Source
var Float32Type = reflect.TypeOf(Float32(0))
View Source
var Float64Type = reflect.ValueOf(Float64(0))
View Source
var Int16Type = reflect.TypeOf(int16(0))
View Source
var Int32Type = reflect.TypeOf(int32(0))
View Source
var Int64Type = reflect.TypeOf(int64(0))
View Source
var Int8Type = reflect.TypeOf(int8(0))
View Source
var IntType = reflect.TypeOf(int(0))
View Source
var SliceAnyType = reflect.TypeOf([]interface{}{})

基础slice数据类型

View Source
var SliceBoolType = reflect.TypeOf([]bool{})
View Source
var SliceComplex128Type = reflect.TypeOf([]complex128{})
View Source
var SliceComplex64Type = reflect.TypeOf([]complex64{})
View Source
var SliceFloat32Type = reflect.TypeOf([]float32{})
View Source
var SliceFloat64Type = reflect.TypeOf([]float64{})
View Source
var SliceInt16Type = reflect.TypeOf([]int16{})
View Source
var SliceInt32Type = reflect.TypeOf([]int32{})
View Source
var SliceInt64Type = reflect.TypeOf([]int64{})
View Source
var SliceInt8Type = reflect.TypeOf([]int8{})
View Source
var SliceIntType = reflect.TypeOf([]int{})
View Source
var SliceStringType = reflect.TypeOf([]string{})
View Source
var SliceUint16Type = reflect.TypeOf([]uint16{})
View Source
var SliceUint32Type = reflect.TypeOf([]uint32{})
View Source
var SliceUint64Type = reflect.TypeOf([]uint64{})
View Source
var SliceUint8Type = reflect.TypeOf([]uint8{})
View Source
var SliceUintType = reflect.TypeOf([]uint{})
View Source
var StringType = reflect.TypeOf(string(""))
View Source
var Uint16Type = reflect.TypeOf(uint16(0))
View Source
var Uint32Type = reflect.TypeOf(uint32(0))
View Source
var Uint64Type = reflect.TypeOf(uint64(0))
View Source
var Uint8Type = reflect.TypeOf(uint8(0))
View Source
var UintType = reflect.TypeOf(uint(0))

Functions

func Bool

func Bool(i interface{}, def ...bool) bool

func Byte

func Byte(i interface{}) byte

Byte converts <i> to byte.

func Bytes

func Bytes(i interface{}) []byte

Bytes converts <i> to []byte.

func Convert

func Convert(i interface{}, t string, params ...interface{}) interface{}

Convert converts the variable <i> to the type <t>, the type <t> is specified by string. The unnecessary parameter <params> is used for additional parameter passing.

func Duration

func Duration(i interface{}) time.Duration

字符串或时间戳转换成time.Duration

func Float

func Float(i interface{}, def ...float32) float32

func Float32

func Float32(i interface{}, def ...float32) float32

Float32 converts <i> to float32.

func Float64

func Float64(i interface{}, def ...float64) float64

Float64 converts <i> to float64.

func Floats

func Floats(i interface{}) []float64

Strings converts <i> to []float64.

func InArray

func InArray(needle, arr interface{}) bool

func Int

func Int(i interface{}, def ...int) int

Int converts <i> to int.

func Int16

func Int16(i interface{}, def ...int16) int16

Int16 converts <i> to int16.

func Int32

func Int32(i interface{}, def ...int32) int32

Int32 converts <i> to int32.

func Int64

func Int64(v interface{}, def ...int64) int64

func Int8

func Int8(i interface{}, def ...int8) int8

Int8 converts <i> to int8.

func Interfaces

func Interfaces(i interface{}) []interface{}

Interfaces converts <i> to []interface{}.

func Ints

func Ints(i interface{}) []int

Ints converts <i> to []int.

func Map

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

func MapDeep

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

func Maps

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

Maps converts <i> to []map[string]interface{}.

func MapsDeep

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

MapsDeep converts <i> to []map[string]interface{} recursively.

func Rune

func Rune(i interface{}) rune

Rune converts <i> to rune.

func Runes

func Runes(i interface{}) []rune

Runes converts <i> to []rune.

func SliceAny

func SliceAny(i interface{}) []interface{}

SliceAny is alias of Interfaces.

func SliceFloat

func SliceFloat(i interface{}) []float64

SliceFloat is alias of Floats.

func SliceInt

func SliceInt(i interface{}) []int

SliceInt is alias of Ints.

func SliceMap

func SliceMap(i interface{}) []map[string]interface{}

SliceMap is alias of Maps.

func SliceMapDeep

func SliceMapDeep(i interface{}) []map[string]interface{}

SliceMapDeep is alias of MapsDeep.

func SliceStr

func SliceStr(i interface{}) []string

SliceStr is alias of Strings.

func SliceStruct

func SliceStruct(params interface{}, pointer interface{}, mapping ...map[string]string) (err error)

SliceStruct is alias of Structs.

func SliceStructDeep

func SliceStructDeep(params interface{}, pointer interface{}, mapping ...map[string]string) (err error)

SliceStructDeep is alias of StructsDeep.

func String

func String(v interface{}, def ...string) string

func Strings

func Strings(i interface{}) []string

Strings converts <i> to []string.

func Struct

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

使用字典map设置struct字段值 params 设置struct字段值的数据字典, 字段名不区分大小写 mapping 字典键名key与struct字段名映射关系

func StructDeep

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

使用字典map设置struct字段值包括内嵌struct params 设置struct字段值的数据字典, 字段名不区分大小写 mapping 字典键名key与struct字段名映射关系

func Structs

func Structs(params interface{}, pointer interface{}, mapping ...map[string]string) (err error)

func StructsDeep

func StructsDeep(params interface{}, pointer interface{}, mapping ...map[string]string) (err error)

func Time

func Time(i interface{}, format ...string) time.Time

转换成time.Time

func Uint

func Uint(i interface{}, def ...uint) uint

Uint converts <i> to uint.

func Uint16

func Uint16(i interface{}, def ...uint16) uint16

Uint16 converts <i> to uint16.

func Uint32

func Uint32(i interface{}, def ...uint32) uint32

Uint32 converts <i> to uint32.

func Uint64

func Uint64(i interface{}, def ...uint64) uint64

Uint64 converts <i> to uint64.

func Uint8

func Uint8(i interface{}, def ...uint8) uint8

Uint8 converts <i> to uint8.

func XTime

func XTime(i interface{}, format ...string) *xtime.Time

转换成xtime

Types

type T

type T interface {
	Any(def ...interface{}) interface{}
	String(def ...string) string

	Float32(def ...float32) float32
	Float64(def ...float64) float64

	Int(def ...int) int
	Int8(def ...int8) int8
	Int16(def ...int16) int16
	Int32(def ...int32) int32
	Int64(def ...int64) int64

	Uint(def ...uint) uint
	Uint8(def ...uint8) uint8
	Uint16(def ...uint16) uint16
	Uint32(def ...uint32) uint32
	Uint64(def ...uint64) uint64

	Bool(def ...bool) bool

	Slice() TSlice
	SliceAny() []interface{}
	SliceMapStrAny() []map[string]interface{}
	SliceHash() []THash
	SliceString() []string
	SliceInt64() []int64
	ToSliceType(sliceType reflect.Type) interface{}

	Map() TMap
	MapAny() TMapAny
	MapString() TMapString
	MapInt64() TMapInt64
	MapStrAny() map[string]interface{}
	Hash() THash
	ToMapType(mapType reflect.Type) interface{}

	ToStructType(structType reflect.Type) interface{}

	ToType(typ reflect.Type) interface{}
}

type THash

type THash map[string]interface{}

type TMap

type TMap map[T]T

type TMapAny

type TMapAny map[interface{}]T

type TMapInt

type TMapInt map[int64]T

type TMapInt32

type TMapInt32 map[int32]T

type TMapInt64

type TMapInt64 map[int64]T

type TMapString

type TMapString map[string]T

type TSlice

type TSlice []T

type TSliceAny

type TSliceAny []interface{}

type TSliceInt64

type TSliceInt64 []int64

type TSliceString

type TSliceString []string

type Type

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

func New

func New(o interface{}) Type

func (Type) Any

func (t Type) Any(def ...interface{}) interface{}

func (Type) Bool

func (t Type) Bool(def ...bool) bool

func (Type) Float32

func (t Type) Float32(def ...float32) float32

func (Type) Float64

func (t Type) Float64(def ...float64) float64

func (Type) Hash

func (t Type) Hash() THash

func (Type) Int

func (t Type) Int(def ...int) int

func (Type) Int16

func (t Type) Int16(def ...int16) int16

func (Type) Int32

func (t Type) Int32(def ...int32) int32

func (Type) Int64

func (t Type) Int64(def ...int64) int64

func (Type) Int8

func (t Type) Int8(def ...int8) int8

func (Type) Map

func (t Type) Map() TMap

func (Type) MapAny

func (t Type) MapAny() TMapAny

func (Type) MapInt64

func (t Type) MapInt64() TMapInt64

func (Type) MapStrAny

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

func (Type) MapString

func (t Type) MapString() TMapString

func (Type) Slice

func (t Type) Slice() TSlice

func (Type) SliceAny

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

func (Type) SliceHash

func (t Type) SliceHash() []THash

func (Type) SliceInt64

func (t Type) SliceInt64() []int64

func (Type) SliceMapStrAny

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

func (Type) SliceString

func (t Type) SliceString() []string

func (Type) String

func (t Type) String(def ...string) string

func (Type) ToMapType

func (t Type) ToMapType(mapType reflect.Type) interface{}

func (Type) ToSliceType

func (t Type) ToSliceType(sliceType reflect.Type) interface{}

func (Type) ToStructType

func (t Type) ToStructType(structType reflect.Type) interface{}

func (Type) ToType

func (t Type) ToType(typ reflect.Type) interface{}

将数据转转换成其他类型

func (Type) Uint

func (t Type) Uint(def ...uint) uint

func (Type) Uint16

func (t Type) Uint16(def ...uint16) uint16

func (Type) Uint32

func (t Type) Uint32(def ...uint32) uint32

func (Type) Uint64

func (t Type) Uint64(def ...uint64) uint64

func (Type) Uint8

func (t Type) Uint8(def ...uint8) uint8

Jump to

Keyboard shortcuts

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