utils

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2020 License: MIT Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const (
	KB int64
	MB
	GB
)

FileSize util

Variables

This section is empty.

Functions

func CallerFile

func CallerFile(skipStack int) string

CallerFile returns path to caller file

func CallerFileName

func CallerFileName(skipStack int) string

CallerFileName returns name of caller file

func Env

func Env(key, fallback string) string

Env returns env variable, fallback when no there

func EnvBool added in v1.1.11

func EnvBool(key string, fallback bool) bool

EnvBool variable or fallback

func EnvInt

func EnvInt(key string, fallback int) int

EnvInt is Env + convert to int

func EnvLookup

func EnvLookup(key string) (string, bool)

EnvLookup alias os.LookupEnv + .env

func EnvUint

func EnvUint(key string, fallback uint) uint

EnvUint is Env + convert to uint

func FitImageFile added in v1.2.0

func FitImageFile(filename string, maxWidth, maxHeight uint, file io.Reader) (*bytes.Buffer, error)

FitImageFile thumbnail

func OnExit

func OnExit(handlers ...func(os.Signal))

OnExit program

func RandInit

func RandInit()

RandInit for init rand seed from time

func RandLetterBytes

func RandLetterBytes(n int) []byte

RandLetterBytes fast generator

func RandString

func RandString(n int) string

RandString fast generator

func Workdir

func Workdir() string

Workdir returns executable working dir

Types

This section is empty.

Jump to

Keyboard shortcuts

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