utils

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToString

func BytesToString(data []byte) string

func Hash

func Hash(data []byte) common.Hash

func IsValidSignature

func IsValidSignature(signer string, hash []byte, signature []byte) (bool, error)

func JsonPretty

func JsonPretty(in interface{}) error

func MergeMaps

func MergeMaps(maps ...map[string]interface{}) map[string]interface{}

func RandStringBytes

func RandStringBytes(n int) string

func Remarshal

func Remarshal(in interface{}, out interface{}) error

func StringToBytes

func StringToBytes(data string) ([]byte, error)

func Template

func Template(content string, params map[string]interface{}) (string, error)

Types

type ApiError

type ApiError struct {
	Code  int
	Error string
}

func NewApiError

func NewApiError(code int, err error) (int, ApiError)

type Duration

type Duration time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (Duration) ToMinute

func (d Duration) ToMinute() int64

func (*Duration) UnmarshalJSON

func (duration *Duration) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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