lib

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Minute = 60
	Hour   = 60 * Minute
	Day    = 24 * Hour
	Week   = 7 * Day
	// https://www.unixtimestamp.com
	// https://www.jotform.com/help/443-mastering-date-and-time-calculation/
	Month    = 2629743  // 30.44 days
	Year     = 31556926 // 365.24 days
	LongTime = 37 * Year
)

Variables

This section is empty.

Functions

func BinToDec

func BinToDec(b string) string

BinToDec

func BinToHex

func BinToHex(b string) string

BinToHex

func BinToOct

func BinToOct(b string) string

BinToOct

func DecToBin

func DecToBin(b string) string

DecToBin

func DecToHex

func DecToHex(b string) string

DecToHex

func DecToOct

func DecToOct(d string) string

DecToOct

func Download added in v1.4.0

func Download(url, dataDir string) (string, error)

func HexToBin

func HexToBin(b string) string

HexToBin

func HexToDec

func HexToDec(b string) string

HexToDec

func HexToOct

func HexToOct(b string) string

HexToOct

func ImageEncode added in v1.4.0

func ImageEncode(image string) (string, string, error)

func JWTdecode

func JWTdecode(tokenString string) (*jwt.Token, error)

func MD5

func MD5(input string) string

func OctToBin

func OctToBin(b string) string

OctToBin

func OctToDec

func OctToDec(b string) string

OctToDec

func OctToHex

func OctToHex(b string) string

OctToHex

func SHA1

func SHA1(input string) string

func SHA256

func SHA256(input string) string

func SHA512

func SHA512(input string) string

func TimeDuration added in v1.5.0

func TimeDuration(diff time.Duration) string

Types

type CheckSum

type CheckSum struct {
	Md5    string
	Sha1   string
	Sha256 string
	Sha512 string
}

func (*CheckSum) MD5

func (cm *CheckSum) MD5() string

func (*CheckSum) SHA1

func (cm *CheckSum) SHA1() string

func (*CheckSum) SHA256

func (cm *CheckSum) SHA256() string

func (*CheckSum) SHA512

func (cm *CheckSum) SHA512() string

type CheckSumer

type CheckSumer interface {
	MD5() string
	SHA1() string
	SHA256() string
	SHA512() string
}

func NewCheckSum

func NewCheckSum(file string) (CheckSumer, error)

type Decode

type Decode struct {
}

func (*Decode) Base64

func (e *Decode) Base64(input string) string

func (*Decode) HTML

func (e *Decode) HTML(input string) string

func (*Decode) URL

func (e *Decode) URL(input string) string

type Decoder

type Decoder interface {
	Base64(input string) string
	URL(input string) string
	HTML(input string) string
}

func NewDecoder

func NewDecoder() Decoder

type Encode

type Encode struct {
}

func (*Encode) Base64

func (e *Encode) Base64(input string) string

func (*Encode) HTML

func (e *Encode) HTML(input string) string

func (*Encode) URL

func (e *Encode) URL(input string) string

type Encoder

type Encoder interface {
	Base64(input string) string
	URL(input string) string
	HTML(input string) string
}

func NewEncoder

func NewEncoder() Encoder

type JSONFormat added in v1.2.0

type JSONFormat struct {
}

func (*JSONFormat) FourSpacesIndent added in v1.2.0

func (j *JSONFormat) FourSpacesIndent(s string) string

func (*JSONFormat) IsJSON added in v1.2.0

func (j *JSONFormat) IsJSON(s string) bool

func (*JSONFormat) Minify added in v1.2.0

func (j *JSONFormat) Minify(s string) string

func (*JSONFormat) TabIndent added in v1.2.0

func (j *JSONFormat) TabIndent(s string) string

func (*JSONFormat) TwoSpacesIndent added in v1.2.0

func (j *JSONFormat) TwoSpacesIndent(s string) string

type JSONFormater added in v1.2.0

type JSONFormater interface {
	TabIndent(string) string
	TwoSpacesIndent(string) string
	FourSpacesIndent(string) string
	Minify(string) string
	IsJSON(string) bool
}

func NewJSONFormat added in v1.2.0

func NewJSONFormat() JSONFormater

Jump to

Keyboard shortcuts

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