utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CallerFile

func CallerFile(deep int) (path string, line int)

CallerFile returns caller file path and line

func CallerFileName

func CallerFileName(deep int) string

CallerFileName returns name of caller file

func CallerFilePath

func CallerFilePath(deep int) string

CallerFilePath returns path to caller file

func ConstantTimeCompareStrings

func ConstantTimeCompareStrings(a, b string) bool

ConstantTimeCompareStrings uses zero alloc converting to bytes

func GeneratePEMCert

func GeneratePEMCert(bits int, organization string, maxAge time.Duration) (cert, key []byte, err error)

GeneratePEMCert self-signed

func GenerateTLSCert

func GenerateTLSCert(bits int, organization string, maxAge time.Duration) (*tls.Certificate, error)

GenerateTLSCert self-signed

func ImageJPGThumbnail

func ImageJPGThumbnail(src io.Reader, filename string, maxWidth, maxHeight uint) ([]byte, error)

ImageJPGThumbnail converter

func ImageJPGThumbnailTo

func ImageJPGThumbnailTo(src io.Reader, dst io.Writer, filename string, maxWidth, maxHeight uint) error

ImageJPGThumbnailTo converter

func ImagePNGThumbnail

func ImagePNGThumbnail(src io.Reader, filename string, maxWidth, maxHeight uint) ([]byte, error)

ImagePNGThumbnail converter

func ImagePNGThumbnailTo

func ImagePNGThumbnailTo(src io.Reader, dst io.Writer, filename string, maxWidth, maxHeight uint) error

ImagePNGThumbnailTo converter

func ImageRead

func ImageRead(filename string, src io.Reader) (image.Image, error)

ImageRead to GO image.Image interface

func NewDiscardLogger

func NewDiscardLogger() *log.Logger

NewDiscardLogger std

func Perm

func Perm(s []string, f func([]string))

Perm calls f with each permutation of s.

func RandBytes

func RandBytes(n int) []byte

RandBytes - fast token generator

func RandBytesTo

func RandBytesTo(buf []byte)

RandBytesTo - fast token generator

func RandInit

func RandInit()

RandInit for init rand seed from time

func RandString

func RandString(n int) string

RandString - fast token generator

func RuntimePkgFileLineByPC

func RuntimePkgFileLineByPC(pc uintptr) (file string, line int)

RuntimePkgFileLineByPC caller

func RuntimePkgFileLineStrByPC

func RuntimePkgFileLineStrByPC(pc uintptr) string

RuntimePkgFileLineStrByPC caller

func RuntimePkgIndex

func RuntimePkgIndex(file, funcName string) int

RuntimePkgIndex by caller

func RuntimePkgPath

func RuntimePkgPath() string

RuntimePkgPath ...

func SwapFileExtension

func SwapFileExtension(filename, targetExt string) string

func ToSnakeCase

func ToSnakeCase(s string) string

ToSnakeCase convertion

func WaitForExit

func WaitForExit()

WaitForExit signal

func Workdir

func Workdir() string

Workdir returns executable working dir

func WorkdirDSN

func WorkdirDSN() string

WorkdirDSN returns executable working dir as DSN path

Example on windows: c/users/user/Desktop

func ZAtob

func ZAtob(s string) []byte

ZAtob - zero alloc convert string to bytes

func ZBtoa

func ZBtoa(b []byte) string

ZBtoa - zero alloc convert bytes to string

Types

This section is empty.

Jump to

Keyboard shortcuts

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