lib

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: MIT Imports: 34 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 Camel added in v1.7.3

func Camel(s string) string

Camel converts a string to a string with the separators denoted by having the next letter capitalized

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 Hashtag added in v1.7.3

func Hashtag(s string) string

Hashtag converts a string to a space separated string with hashtag symbols

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 Pascal added in v1.7.3

func Pascal(s string) string

Pascal converts a string to pascal case

func SHA1

func SHA1(input string) string

func SHA256

func SHA256(input string) string

func SHA512

func SHA512(input string) string

func Sentence added in v1.7.3

func Sentence(s string) string

Sentence converts a string to a lower case, space separated string with the first character upper case

func TimeDuration added in v1.5.0

func TimeDuration(diff time.Duration) string

Types

type Case added in v1.7.3

type Case struct {
	// contains filtered or unexported fields
}

func NewCase added in v1.7.3

func NewCase(fn ChangeCaseFn, sub string) *Case

func (*Case) Fn added in v1.7.3

func (c *Case) Fn(str string) string

func (*Case) Subtitle added in v1.7.3

func (c *Case) Subtitle() string

type ChangeCase added in v1.7.3

type ChangeCase struct {
	Camel    ChangeCaser
	Pascal   ChangeCaser
	Constant ChangeCaser
	Dot      ChangeCaser
	Lower    ChangeCaser
	Lcfirst  ChangeCaser
	No       ChangeCaser
	Param    ChangeCaser
	Path     ChangeCaser
	Sentence ChangeCaser
	Snake    ChangeCaser
	Swap     ChangeCaser
	Title    ChangeCaser
	Upper    ChangeCaser
	Ucfirst  ChangeCaser
	Hashtag  ChangeCaser
}

func NewChangeCase added in v1.7.3

func NewChangeCase() *ChangeCase

func (*ChangeCase) Get added in v1.7.3

func (c *ChangeCase) Get(input string) ChangeCaser

Get returns the ChangeCaser for the given input name

type ChangeCaseFn added in v1.7.3

type ChangeCaseFn func(string) string

type ChangeCaser added in v1.7.3

type ChangeCaser interface {
	Fn(string) string
	Subtitle() string
}

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