util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: GPL-3.0 Imports: 19 Imported by: 5

Documentation

Index

Constants

View Source
const (
	CrabNetwork   = "darwinia-canary"
	KusamaNetwork = "kusama"
	Edgeware      = "edgeware"
	Acala         = "acala-test"
	Plasm         = "plasm"
)

Variables

View Source
var (
	ParamsError           = ecode.New(10001)
	InvalidAccountAddress = ecode.New(10002)
	RecordNotFound        = ecode.New(10004)
)
View Source
var (
	HostName    string
	Environment string
	WSEndPoint  string

	NetworkNode = GetEnv("NETWORK_NODE", KusamaNetwork)
	IsDarwinia  = StringInSlice(NetworkNode, []string{CrabNetwork})
)
View Source
var (
	SubPool        *redis.Pool
	SubScanChannel = fmt.Sprintf("%s_scan", NetworkNode)

	PubTopicMetadata = "metadata_update"
	PubNewFinalized  = "new_finalized"
)

Functions

func AddHex

func AddHex(s string) string

func BigIntFromInterface

func BigIntFromInterface(i interface{}) *big.Int

func BoolFromInterface

func BoolFromInterface(i interface{}) bool

Interface

func BytesToHex

func BytesToHex(b []byte) string

func CallerName

func CallerName() string

Func

func CamelString

func CamelString(s string) string

Camel String

func ContinuousSlice

func ContinuousSlice(start, count int, order string) (r []int)

func DecimalFromInterface

func DecimalFromInterface(i interface{}) decimal.Decimal

func GetEnv

func GetEnv(key, defaultValue string) string

func GetFuncName

func GetFuncName() string

func GetStringValueByFieldName

func GetStringValueByFieldName(n interface{}, fieldName string) (string, bool)

func HexToBytes

func HexToBytes(s string) []byte

func HexToNumStr

func HexToNumStr(v string) string

func HttpGet

func HttpGet(url string) ([]byte, error)

func InsertInts

func InsertInts(o []int, index int, new int) []int

func Int64FromInterface

func Int64FromInterface(i interface{}) int64

func IntFromInterface

func IntFromInterface(i interface{}) int

interface

func IntInSlice

func IntInSlice(a int, list []int) bool

func IntToHex

func IntToHex(i interface{}) string

func IntToString

func IntToString(i int) string

Int

func InterfaceToString

func InterfaceToString(i interface{}) string

func IsK8s

func IsK8s() bool

func IsProduction

func IsProduction() bool

func MapStringToSlice

func MapStringToSlice(m map[string]bool) []string

func PostWithJson

func PostWithJson(data []byte, url string) ([]byte, error)

func SetEndpointCache

func SetEndpointCache(endpoint string)

func StringInSlice

func StringInSlice(a string, list []string) bool

func StringToInt

func StringToInt(s string) int

func StringsExclude

func StringsExclude(a []string, b []string) []string

String

func StringsIntersection

func StringsIntersection(a []string, b []string) []string

func TrimHex

func TrimHex(s string) string

func U256

func U256(v string) *big.Int

func U32Encode

func U32Encode(i int) string

Big Int

func UnmarshalToAnything

func UnmarshalToAnything(r interface{}, raw interface{})

func UpperCamel

func UpperCamel(s string) string

func WsEndpointCache

func WsEndpointCache() string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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