Documentation ¶
Overview ¶
Package utils implements some utility functions.
Index ¶
- func ConvertIdentifier(s string) string
- func CreateDir(dir string) error
- func Decrypt(encoded string, key []byte) ([]byte, error)
- func Encrypt(plaintext, key []byte) (string, error)
- func GormErrorWithLogger(ctx context.Context) func(err error, formatWithArgs ...interface{}) error
- func IsDigit(b byte) bool
- func IsHexDigit(b byte) bool
- func IsInteger(s string) bool
- func IsUnsignedInteger(s string) bool
- func PathExists(path string) bool
- func ReadPartFile(path string) ([]string, error)
- func RelativePathBaseOn(basePath, filePath string) string
- func Zip(srcFile string, destZip string) error
- type GormErrorWrapper
- type WaitGroupMap
- type WithErrorMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertIdentifier ¶
func Decrypt ¶ added in v1.1.55
Decrypt decrypts a base64-encoded ciphertext using AES encryption with a given key. It returns the plaintext.
func Encrypt ¶ added in v1.1.55
Encrypt encrypts plaintext using AES encryption with a given key. It returns a base64-encoded ciphertext.
func GormErrorWithLogger ¶ added in v1.1.55
func IsHexDigit ¶
func IsUnsignedInteger ¶
func PathExists ¶ added in v1.1.55
func ReadPartFile ¶ added in v1.1.55
ReadPartFile read part of file: top 50 lines and bottom 50 lines
func RelativePathBaseOn ¶
RelativePathBaseOn changes relative path base on the basePath
Types ¶
type GormErrorWrapper ¶ added in v1.1.55
type WaitGroupMap ¶
type WaitGroupMap struct {
// contains filtered or unexported fields
}
func NewWaitGroups ¶
func NewWaitGroups() *WaitGroupMap
func (*WaitGroupMap) Add ¶
func (w *WaitGroupMap) Add(delta int, key string)
func (*WaitGroupMap) AddMany ¶
func (w *WaitGroupMap) AddMany(delta int, keys ...string)
func (*WaitGroupMap) Done ¶
func (w *WaitGroupMap) Done(key string)
func (*WaitGroupMap) DoneMany ¶
func (w *WaitGroupMap) DoneMany(keys ...string)
func (*WaitGroupMap) Wait ¶
func (w *WaitGroupMap) Wait(key string)
func (*WaitGroupMap) WaitMany ¶
func (w *WaitGroupMap) WaitMany(keys ...string)
type WithErrorMessage ¶ added in v1.1.55
func ErrMsgWithLogger ¶ added in v1.1.55
func ErrMsgWithLogger(ctx context.Context) WithErrorMessage
Click to show internal directories.
Click to hide internal directories.