ginterface

package
v0.0.0-...-047dcd9 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 8 Imported by: 1

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
)

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

Jump to

Keyboard shortcuts

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