common

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HashMd5        = "md5"
	HashSha1       = "sha1"
	HashSha224     = "sha224"
	HashSha256     = "sha256"
	HashSha384     = "sha384"
	HashSha512     = "sha512"
	HashSha512_224 = "sha512_224"
	HashSha512_256 = "sha512_256"
)

Variables

View Source
var (
	Context = context.Background()
	TimeNow = time.Now().Local()
)

Functions

func Config

func Config(config string, t ConfigBlock) (map[string]interface{}, error)

Get secret token from config.

func Examples

func Examples(s string) string

Print examples with color.

func HTTPRequestContent

func HTTPRequestContent(url string, body io.Reader, methods ...string) ([]byte, error)

HttpRequestContent make a simple request to url, and return response body, default request method is get.

func HashAlgorithm

func HashAlgorithm(alg string) hash.Hash

Types

type ByteSize

type ByteSize float64
const (
	KB ByteSize = 1 << (10 * iota)
	MB
	GB
	TB
	PB
	EB
	ZB
	YB
)

func (ByteSize) String

func (b ByteSize) String() string

type ConfigBlock

type ConfigBlock string

Read config.toml.

const (
	Discord  ConfigBlock = "discord"
	ICP      ConfigBlock = "west"
	LINE     ConfigBlock = "line"
	Slack    ConfigBlock = "slack"
	Telegram ConfigBlock = "telegram"
)

func (ConfigBlock) String

func (c ConfigBlock) String() string

Jump to

Keyboard shortcuts

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