Documentation ¶
Index ¶
- func Bytes2String(u []byte) string
- func BytesToStringUnsafe(b []byte) string
- func CPUProf() func()
- func Concat(a string, b ...string) string
- func Decodebig5(s []byte) ([]byte, error)
- func Decodegbk(s []byte) ([]byte, error)
- func Detect(b []byte) (*chardet.Result, error)
- func Encodebig5(s []byte) ([]byte, error)
- func First(args ...interface{}) interface{}
- func GbkToUtf8(s []byte) ([]byte, error)
- func GetCurrentExecDir() (dir string, err error)
- func GetCurrentPath() (string, error)
- func GetFileSize(fullFilename string) int64
- func GetOutboundIP() (net.IP, error)
- func Last(args ...interface{}) interface{}
- func LogFatalError(err error)
- func Md5CheckSum(filePath string) (result string, err error)
- func MgoUuid() string
- func NewGuid() string
- func Pick(index int, args ...interface{}) interface{}
- func RequiredStrFatal(name, str string)
- func Slice(args ...interface{}) []interface{}
- func StrBuilder(args ...string) string
- func StrCrop(str string, length int) string
- func StringToBytesUnsafe(s string) []byte
- func SubString(str string, begin, length int) (substr string)
- func Trans(input []byte, log zerolog.Logger) (output []byte, err error)
- func Utf8ToGbk(s []byte) ([]byte, error)
- func Uuid4() string
- func Uuid4Base58() string
- type Guid
- type RWatcher
- type SyncPrinter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes2String ¶
func BytesToStringUnsafe ¶
BytesToStringUnsafe converts a byte slice to a string. It's fasthttpgx, but not safe. Use it only if you know what you're doing.
func CPUProf ¶
func CPUProf() func()
CPUProf runs the profiler and returns a function you need to defer
func First ¶
func First(args ...interface{}) interface{}
First returns first argument of a function return use it like
myutils.First(ab())
func GetCurrentExecDir ¶
func GetCurrentPath ¶
func GetFileSize ¶
func Last ¶
func Last(args ...interface{}) interface{}
Last returns first argument of a function return use it like
myutils.Last(ab())
func LogFatalError ¶
func LogFatalError(err error)
LogFatalError it's a snippet for
if err != nil { log.Fatalf("Error: %s", err) }
func Md5CheckSum ¶
func Pick ¶
func Pick(index int, args ...interface{}) interface{}
Pick returns picked argument of a function return use it like
myutils.Pick(1, ab())
func RequiredStrFatal ¶
func RequiredStrFatal(name, str string)
RequiredStrFatal it's a snippet for
if str == "" { log.Fatalf("Error: %s is empty", name) }
func Slice ¶
func Slice(args ...interface{}) []interface{}
Slice returns arguments of a function return as a slice use it like
myutils.Slice(ab())[1]
func StrBuilder ¶
func StringToBytesUnsafe ¶
StringToBytesUnsafe converts a string to a byte slice. It's fasthttpgx, but not safe. Use it only if you know what you're doing.
func Uuid4Base58 ¶
func Uuid4Base58() string
Types ¶
type RWatcher ¶
type RWatcher struct { Events chan fsnotify.Event Errors chan error // contains filtered or unexported fields }
RWatcher wraps fsnotify.Watcher. When fsnotify adds recursive watches, you should be able to switch your code to use fsnotify.Watcher
func NewWatcher ¶
NewWatcher establishes a new watcher with the underlying OS and begins waiting for events.
func (*RWatcher) AddRecursive ¶
AddRecursive starts watching the named directory and all sub-directories.
func (*RWatcher) RemoveRecursive ¶
RemoveRecursive stops watching the named directory and all sub-directories.
type SyncPrinter ¶
SyncPrinter is a thread-safe printer. It will output given queue without
func NewSyncPrinter ¶
func NewSyncPrinter() (*SyncPrinter, error)
NewSyncPrinter initialize a new SyncPrinter