utils

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(encoded string) ([]byte, error)

func Base64Encode

func Base64Encode(source []byte) string

func CompareVersion added in v0.2.0

func CompareVersion(versionA, versionB *Semver) bool

CompareVersion compares strings like "v1.1.1", returns true when versionA > versionB

func DESDecrypt

func DESDecrypt(encrypted []byte, secret []byte) (result []byte, err error)

func DESEncrypt

func DESEncrypt(source []byte, secret []byte) ([]byte, error)

func Decrypt

func Decrypt(encoded string, secret []byte) (string, error)

func Encrypt

func Encrypt(source []byte, secret []byte) (string, error)

func FileMustExist

func FileMustExist(path string) (err error)

func GetExecutablePathAndDir

func GetExecutablePathAndDir() (path, dir string, err error)

func GetHomeDir

func GetHomeDir() (string, error)

func IsFileExist

func IsFileExist(path string) bool

func IsNetworkError

func IsNetworkError(err error) bool

func MatchMultiple

func MatchMultiple(re *regexp.Regexp, content string) ([][]string, error)

func MatchSingle

func MatchSingle(re *regexp.Regexp, content string) (string, error)

func ReadBody

func ReadBody(resp *http.Response) (body string)

func Unzip

func Unzip(zipFile string, destDir string) error

Types

type Semver added in v0.2.0

type Semver struct {
	Major      int
	Minor      int
	Patch      int
	Prerelease string
}

func ParseVersion added in v0.2.0

func ParseVersion(version string) *Semver

Jump to

Keyboard shortcuts

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