types

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 10 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(b []byte) string

BytesToString converts byte slice to a string without memory allocation.

Note it may break if the implementation of string or slice header changes in the future go versions.

func CutLast

func CutLast(key string, n int) string

CutLast 移除最后 n 个字符

func CutString

func CutString(s, sep string) (found bool, s1, s2 string)

CutString 以 sep 作为分隔符切割字符串

func FirstWord

func FirstWord(key string, n int) string

FirstWord 开始 n 个字符

func GetBool

func GetBool(v map[string]interface{}, key string) (ret bool, exist bool)

func GetBytes

func GetBytes(v map[string]interface{}, key string) (ret []byte, exist bool)

func GetFloat64

func GetFloat64(v map[string]interface{}, key string) (ret float64, exist bool, err error)

func GetFloat64Array

func GetFloat64Array(v map[string]interface{}, key string) ([]float64, bool, error)

func GetInt

func GetInt(v map[string]interface{}, key string) (ret int, exist bool, err error)

func GetInt16

func GetInt16(v map[string]interface{}, key string) (ret int16, exist bool, err error)

func GetInt32

func GetInt32(v map[string]interface{}, key string) (ret int32, exist bool, err error)

func GetInt64

func GetInt64(v map[string]interface{}, key string) (ret int64, exist bool, err error)

func GetInt64Array

func GetInt64Array(v map[string]interface{}, key string) ([]int64, bool, error)

func GetInt8

func GetInt8(v map[string]interface{}, key string) (ret int8, exist bool, err error)

func GetString

func GetString(v map[string]interface{}, key string) (ret string, exist bool)

func GetStringArray

func GetStringArray(v map[string]interface{}, key string) ([]string, bool, error)

func GetTime

func GetTime(v map[string]interface{}, key, layout string,
	loc ...*time.Location) (ret time.Time, exist bool, err error)

func GetUint

func GetUint(v map[string]interface{}, key string) (ret uint, exist bool, err error)

func GetUint16

func GetUint16(v map[string]interface{}, key string) (ret uint16, exist bool, err error)

func GetUint32

func GetUint32(v map[string]interface{}, key string) (ret uint32, exist bool, err error)

func GetUint64

func GetUint64(v map[string]interface{}, key string) (ret uint64, exist bool, err error)

func GetUint64Array

func GetUint64Array(v map[string]interface{}, key string) ([]uint64, bool, error)

func GetUint8

func GetUint8(v map[string]interface{}, key string) (ret uint8, exist bool, err error)

func HasBytes

func HasBytes(arr []interface{}) bool

HasBytes 数组中是否有 bytes

func Interface

func Interface(v reflect.Value) interface{}

Interface returns v's current value as an interface{}.

func InterfaceToArray

func InterfaceToArray(value interface{}) (ret []interface{}, err error)

InterfaceToArray 接口转数组

func InterfaceToBool

func InterfaceToBool(value interface{}) bool

func InterfaceToBytes

func InterfaceToBytes(value interface{}) []byte

InterfaceToBytes 接口转字节码

func InterfaceToFloat64

func InterfaceToFloat64(value interface{}) (float64, error)

func InterfaceToFloat64Array

func InterfaceToFloat64Array(value interface{}) (ret []float64, err error)

InterfaceToFloat64Array 接口转 float64 数组

func InterfaceToInt

func InterfaceToInt(value interface{}) (int, error)

func InterfaceToInt16

func InterfaceToInt16(value interface{}) (int16, error)

func InterfaceToInt32

func InterfaceToInt32(value interface{}) (int32, error)

func InterfaceToInt64

func InterfaceToInt64(value interface{}) (int64, error)

func InterfaceToInt64Array

func InterfaceToInt64Array(value interface{}) (ret []int64, err error)

InterfaceToInt64Array 接口转int64数组

func InterfaceToInt8

func InterfaceToInt8(value interface{}) (int8, error)

func InterfaceToMap

func InterfaceToMap(value interface{}) (map[string]interface{}, error)

InterfaceToMap 接口转 map

func InterfaceToString

func InterfaceToString(value interface{}) string

InterfaceToString 接口转字符串

func InterfaceToStringArray

func InterfaceToStringArray(value interface{}) ([]string, error)

InterfaceToStringArray 接口转字符串数组

func InterfaceToTime

func InterfaceToTime(value interface{}, layout string, loc ...*time.Location) (time.Time, error)

func InterfaceToUint

func InterfaceToUint(value interface{}) (uint, error)

func InterfaceToUint16

func InterfaceToUint16(value interface{}) (uint16, error)

func InterfaceToUint32

func InterfaceToUint32(value interface{}) (uint32, error)

func InterfaceToUint64

func InterfaceToUint64(value interface{}) (uint64, error)

func InterfaceToUint64Array

func InterfaceToUint64Array(value interface{}) (ret []uint64, err error)

InterfaceToUint64Array 接口转 uint64 数组

func InterfaceToUint8

func InterfaceToUint8(value interface{}) (uint8, error)

func IsArray

func IsArray(v reflect.Value) bool

IsArray 判断是否 Array 或 Slice

func IsEmptyValue

func IsEmptyValue(v reflect.Value) bool

IsEmptyValue 是否空值

func IsNil

func IsNil(v reflect.Value) bool

IsNil 判断变量是否为 nil

func JoinInt8

func JoinInt8(s []int8, sep string) string

func JoinUint64

func JoinUint64(s []uint64, sep string) string

func LastWord

func LastWord(key string, n int) string

LastWord 末尾 n 个字符

func QuickRemoveLFCR

func QuickRemoveLFCR(b []byte) string

QuickRemoveLFCR 去掉 \r(回车)、\n(换行)

func QuickReplaceLFCR

func QuickReplaceLFCR(b []byte) string

QuickReplaceLFCR 替换 \r(回车)、\n(换行) 为字符串 `\r`、`\n`

func QuickReplaceLFCR2Space

func QuickReplaceLFCR2Space(b []byte) string

QuickReplaceLFCR2Space 替换 \r(回车)、\n(换行) 为空格

func SplitInt

func SplitInt(s, sep string) []int

func SplitInt64

func SplitInt64(s, sep string) []int64

func SplitInt8

func SplitInt8(s, sep string) []int8

func SplitUint64

func SplitUint64(s, sep string) []uint64

func StringToBytes

func StringToBytes(s string) (b []byte)

StringToBytes converts string to a byte slice without memory allocation.

Note it may break if the implementation of string or slice header changes in the future go versions.

Types

type Map

type Map map[string]interface{}

func GetMap

func GetMap(v map[string]interface{}, key string) (Map, bool, error)

func GetMapArray

func GetMapArray(v map[string]interface{}, key string) ([]Map, bool, error)

func (Map) GetBool

func (m Map) GetBool(key string) (ret bool, exist bool)

func (Map) GetBytes

func (m Map) GetBytes(key string) (ret []byte, exist bool)

func (Map) GetFloat64

func (m Map) GetFloat64(key string) (ret float64, exist bool, err error)

func (Map) GetFloat64Array

func (m Map) GetFloat64Array(key string) (ret []float64, exist bool, err error)

func (Map) GetInt

func (m Map) GetInt(key string) (int, bool, error)

func (Map) GetInt16

func (m Map) GetInt16(key string) (int16, bool, error)

func (Map) GetInt32

func (m Map) GetInt32(key string) (int32, bool, error)

func (Map) GetInt64

func (m Map) GetInt64(key string) (ret int64, exist bool, err error)

func (Map) GetInt64Array

func (m Map) GetInt64Array(key string) (ret []int64, exist bool, err error)

func (Map) GetInt8

func (m Map) GetInt8(key string) (int8, bool, error)

func (Map) GetMap

func (m Map) GetMap(key string) (ret Map, exist bool, err error)

func (Map) GetMapArray

func (m Map) GetMapArray(key string) (ret []Map, exist bool, err error)

func (Map) GetString

func (m Map) GetString(key string) (ret string, exist bool)

func (Map) GetStringArray

func (m Map) GetStringArray(key string) (ret []string, exist bool, err error)

func (Map) GetTime

func (m Map) GetTime(key, layout string, loc ...*time.Location) (ret time.Time, exist bool, err error)

func (Map) GetUint

func (m Map) GetUint(key string) (uint, bool, error)

func (Map) GetUint16

func (m Map) GetUint16(key string) (uint16, bool, error)

func (Map) GetUint32

func (m Map) GetUint32(key string) (uint32, bool, error)

func (Map) GetUint64

func (m Map) GetUint64(key string) (ret uint64, exist bool, err error)

func (Map) GetUint64Array

func (m Map) GetUint64Array(key string) (ret []uint64, exist bool, err error)

func (Map) GetUint8

func (m Map) GetUint8(key string) (uint8, bool, error)

func (Map) Set

func (m Map) Set(key string, value interface{})

Jump to

Keyboard shortcuts

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