minami58

package
v1.9.9 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(raw []byte) []byte

func DecodeWithDesc

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

DecodeWithDesc decode and return desc

func Encode

func Encode(raw []byte) []byte

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.

func Shorten added in v1.5.11

func Shorten(url string) string

Shorten add some salt if in duplicated

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