Run NodesReferenceutils

formatting

Package formatting

import "github.com/luxfi/node/utils/formatting"

Functions

Decode

func Decode(encoding Encoding, str string) ([]byte, error)

Decode [str] to bytes using the given encoding If [str] is the empty string, returns a nil byte slice and nil error

Encode

func Encode(encoding Encoding, bytes []byte) (string, error)

Encode [bytes] to a string using the given encoding format [bytes] may be nil, in which case it will be treated the same as an empty slice.

IntFormat

func IntFormat(maxValue int) string

Types

Encoding

Encoding defines how bytes are converted to a string and vice versa

func (enc Encoding) MarshalJSON() ([]byte, error)
func (enc Encoding) String() string
func (enc *Encoding) UnmarshalJSON(b []byte) error

PrefixedStringer

PrefixedStringer extends a stringer that adds a prefix