Documentation ¶
Overview ¶
Package common contains various helper functions.
Index ¶
- Constants
- func Bytes2Hex(d []byte) string
- func Bytes2Uint(d []byte) uint64
- func CopyBytes(b []byte) (copiedBytes []byte)
- func FromHex(s string) []byte
- func GetLogger(namespace string) *logging.Logger
- func Hex(b []byte) []byte
- func Hex2Bytes(str string) []byte
- func Hex2BytesFixed(str string, flen int) []byte
- func LeftPadBytes(slice []byte, l int) []byte
- func RightPadBytes(slice []byte, l int) []byte
- func Uint2Bytes(v uint64) []byte
- type Address
- type Config
- func (c *Config) Get(key string) interface{}
- func (c *Config) GetBool(key string) bool
- func (c *Config) GetDuration(key string) time.Duration
- func (c *Config) GetInt(key string) int
- func (c *Config) GetInt64(key string) int64
- func (c *Config) GetSlice(key string) []string
- func (c *Config) GetString(key string) string
- type Hash
- type Logger
- type LoggerMgr
Constants ¶
View Source
const ( HashLength = 32 AddressLength = 20 )
Variables ¶
This section is empty.
Functions ¶
func Bytes2Uint ¶
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func Hex2BytesFixed ¶
Hex2BytesFixed returns bytes of a specified fixed length flen.
func LeftPadBytes ¶
LeftPadBytes zero-pads slice to the left up to length l.
func RightPadBytes ¶
RightPadBytes zero-pads slice to the right up to length l.
func Uint2Bytes ¶
Types ¶
type Address ¶
type Address [AddressLength]byte
func BigToAddress ¶
func BytesToAddress ¶
func CreateAddress ¶
func HashToAddr ¶
func HexToAddress ¶
Decode address in hex format to common.Address
type Hash ¶
type Hash [HashLength]byte
func BigToHash ¶
BigToHash sets byte representation of b to hash. If b is larger than len(h), b will be cropped from the left.
func BytesToHash ¶
func DecodeHash ¶
Decode hash string with "0x...." format to Hash type
type LoggerMgr ¶
type LoggerMgr struct {
// contains filtered or unexported fields
}
func NewLoggerMgr ¶
func NewLoggerMgr() *LoggerMgr
Click to show internal directories.
Click to hide internal directories.