formatting

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: BSD-3-Clause Imports: 8 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func 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

func EncodeWithChecksum

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

EncodeWithChecksum 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. This function includes a checksum in the encoded string.

func EncodeWithoutChecksum

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

EncodeWithoutChecksum 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. Unlike EncodeWithChecksum, this function does not include a checksum in the encoded string.

func IntFormat

func IntFormat(maxValue int) string

Types

type DumpBytes

type DumpBytes []byte

func (DumpBytes) String

func (db DumpBytes) String() string

type Encoding

type Encoding uint8

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

const (
	// CB58 specifies the CB58 encoding format
	CB58 Encoding = iota
	// Hex specifies a hex plus 4 byte checksum encoding format
	Hex
	// JSON specifies the JSON encoding format
	JSON
)

func (Encoding) MarshalJSON

func (enc Encoding) MarshalJSON() ([]byte, error)

func (Encoding) String

func (enc Encoding) String() string

func (*Encoding) UnmarshalJSON

func (enc *Encoding) UnmarshalJSON(b []byte) error

type PrefixedStringer

type PrefixedStringer interface {
	fmt.Stringer

	PrefixedString(prefix string) string
}

PrefixedStringer extends a stringer that adds a prefix

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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