minami58

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(raw []byte) ([]byte, error)

Decode something

func DecodeWithDesc

func DecodeWithDesc(raw []byte) (desc string, payload []byte, err error)

DecodeWithDesc decode and return desc

func Encode

func Encode(payload []byte) []byte

Encode something

func EncodeWithDesc

func EncodeWithDesc(raw []byte, desc string, delim Delim) ([]byte, error)

EncodeWithDesc add some desc into payload

func FormatTime

func FormatTime(ts time.Time) string

FormatTime encode time in minami58, mill-seconds will be ignored.

func ParseTime

func ParseTime(ts string) (time.Time, error)

ParseTime parse a minami58 encoded time, return a UTC location time.

Types

type Delim

type Delim interface {
	// contains filtered or unexported methods
}

Delim delimiter

var (
	// ErrDescContainsDelim desc can't contains delim
	ErrDescContainsDelim = errors.New("desc contains delim")

	// Non no delim
	Non Delim = &delim{value: ""}

	// CR \r
	CR Delim = &delim{value: "\r"}

	// LF \n
	LF Delim = &delim{value: "\n"}

	// CRLF \r\n
	CRLF Delim = &delim{value: "\r\n"}
)

Jump to

Keyboard shortcuts

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