gany

package
v0.0.0-...-04ff805 Latest Latest
Warning

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

Go to latest
Published: May 22, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Any initialized interface's type is no longer interface, but the type of init value,
	// var itfc interface{}
	// Now type of 'itfc' is 'nil'
	// var itfc interface{} = interface{}("str")
	// Now type of 'itfc' becomes string, not type of uninitialized interface anymore.
	UnInitIF interface{} = nil
)
View Source
var (
	ValNil = NewVal(nil)
)

Functions

func Cmp

func Cmp(x, y interface{}) (int, error)

-1 if x < y

0 if x == y

+1 if x > y

func ConvertJsonNumberToFloat64Array

func ConvertJsonNumberToFloat64Array(s []interface{}) ([]float64, error)

func ConvertToFloatNum

func ConvertToFloatNum(x interface{}) (*big.Float, error)

func ConvertToIntNum

func ConvertToIntNum(x interface{}) (*big.Int, error)

func IsFloatNum

func IsFloatNum(x interface{}) bool

func IsIntNum

func IsIntNum(x interface{}) bool

func IsMap

func IsMap(x interface{}) bool

func IsSlice

func IsSlice(x interface{}) bool

func Merge

func Merge(s ...[]interface{}) (result []interface{})

func Parse

func Parse(x interface{}) (typeName string, isPointer bool)

func ReCallItfc

func ReCallItfc(retry int, method interface{}, params ...interface{}) interface{}

*

@retry  重试次数
@method 调用的函数,比如: api.GetTicker ,注意:不是api.GetTicker(...)
@params 参数,顺序一定要按照实际调用函数入参顺序一样
@return 返回

func SplitByBlockCount

func SplitByBlockCount(all []interface{}, blockCount int) [][]interface{}

split all interfaces to multiple []interface that count is blockCount sample: SplitByBlockCount([1, 2, 3, 4, 5], 2) = [ [1, 2, 3], [4, 5] ]

func SplitByBlockSize

func SplitByBlockSize(all []interface{}, blockSize int) [][]interface{}

split all interfaces to multiple []interface that each size <= blockSize sample: SplitByBlockSize([1, 2, 3, 4, 5], 2) = [ [1, 2], [3, 4], [5] ]

func Type

func Type(x interface{}) string

func TypeEqualValueEqual

func TypeEqualValueEqual(x, y interface{}) bool

func TypeEqualValueGreater

func TypeEqualValueGreater(x, y interface{}) bool

func TypeEqualValueGreaterOrEqual

func TypeEqualValueGreaterOrEqual(x, y interface{}) bool

func TypeEqualValueLess

func TypeEqualValueLess(x, y interface{}) bool

func TypeEqualValueLessOrEqual

func TypeEqualValueLessOrEqual(x, y interface{}) bool

func TypeEx

func TypeEx(x interface{}) (string, error)

Try to detect slice member type if x is a slice.

Types

type CommonFunc

type CommonFunc struct{}

func (*CommonFunc) Merge2

func (c *CommonFunc) Merge2(s ...[]interface{}) (result []interface{})

type TypeInfo

type TypeInfo struct {
	TypeName  string
	IsNil     bool
	IsPointer bool
	IsSlice   bool
	IsMap     bool
}

type Val

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

func NewVal

func NewVal(v any) Val

func (Val) Any

func (v Val) Any() any

func (Val) IsMap

func (v Val) IsMap() bool

func (Val) IsNil

func (v Val) IsNil() bool

func (Val) IsPointer

func (v Val) IsPointer() bool

func (Val) IsSlice

func (v Val) IsSlice() bool

func (Val) String

func (v Val) String() string

func (Val) TypeInfo

func (v Val) TypeInfo() TypeInfo

func (Val) TypeName

func (v Val) TypeName() string

func (Val) TypeReflect

func (v Val) TypeReflect() reflect.Type

func (Val) Value

func (v Val) Value() reflect.Value

Jump to

Keyboard shortcuts

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