Documentation
¶
Overview ¶
用于处理字节的帮助程序
*
- @Author : xingnan
- @Email : 457415936@qq.com
- @Time : 16:40
- @File : conversion.go
- @Project : toolbox
- @Description : 计量单位
*
- @Author : xingnan
- @Email : 457415936@qq.com
- @Time : 16:45
- @File : daemonize.go
- @Project : toolbox
- @Description : 守护进程
*
- @Author : xingnan
- @Email : 457415936@qq.com
- @Time : 16:46
- @File : daemonize_posix.go
- @Project : toolbox
- @Description : GoLand
*
- @Author : xingnan
- @Email : 457415936@qq.com
- @Time : 16:52
- @File : env.go
- @Project : toolbox
- @Description : 环境变量
*
- @Author : xingnan
- @Email : 457415936@qq.com
- @Time : 16:58
- @File : fs.go
- @Project : toolbox
- @Description : 文件操作
*
- @Author: xing nan
- @Email:457415936@qq.com
- @Time: 2020/12/28 上午8:02
- @File : print
- @Software: GoLand
Index ¶
- Constants
- func AppDaemonizedEx(name, pidfile, stderr string) error
- func AppDir() string
- func AppExit(name string, pidfile string, force bool) error
- func AppImmobilized(pidfile string) error
- func AppIsRunningEx(pidfile string) (int, error)
- func AppRestart(name string, pidfile string, arg ...string) error
- func ByteCat(sv ...string) []byte
- func CountFileLine(name string) (int64, error)
- func CreateGUID() string
- func Cut(a []byte, from, to int) []byte
- func DelFile(file string) bool
- func EscapeNonBmpRune(s string) string
- func FileExist(filename string) bool
- func FileType(file string) string
- func Float64ToStr(str float64) string
- func GetInternetIp() string
- func GetLocalIPv4s() ([]string, error)
- func GetLocalIPv4sMacs() ([]string, error)
- func GetLocalMacs() ([]string, error)
- func GetLocalNetCount() int
- func GetUserHome() (string, error)
- func HasNonBmpRune(s string) bool
- func Hmac(key, data string) string
- func HmacSha256(secret string, data string) string
- func Insert(a []byte, i int, b []byte) []byte
- func Ip2long(ipstr string) uint32
- func Ipv4hexa2dec(addr string) (string, error)
- func Ipv6hexa2str(addr string) (string, error)
- func IsNil(i interface{}) bool
- func JsonDecode(data string) (interface{}, error)
- func JsonEncode(data interface{}) (string, error)
- func LocalIp() string
- func LocalMac() string
- func Long2ip(ipLong uint32) string
- func MakeGUID() string
- func MakeRandomInt(num int) string
- func MakeRandomStr() string
- func Maximum64(x, y int64) int64
- func Md5(value string) string
- func Minimum64(x, y int64) int64
- func Mkdir(path string) error
- func MkdirAll(path string) error
- func NewAppRestart(name, pidfile string) error
- func PathDirExists(p string) bool
- func PathExist(filename string) bool
- func PathExists(p string) bool
- func PathSplit(p string, suggestcap int) []string
- func Port4hexa2dec(port string) (string, error)
- func Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func RandString(n int) string
- func ReadFile(path string) string
- func ReadFileByte(path string) ([]byte, error)
- func ReadFileFirstLine(path string) (string, error)
- func ReadLineCounter(path string) (int64, error)
- func ReadLines(path string) ([]string, int, error)
- func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)
- func ReadStringForLine(path string, lineNumber int) string
- func Rename(file string, to string) bool
- func Replace(a []byte, from, to int, new []byte) []byte
- func ReverseByte(s []byte) []byte
- func SecSha1(pwd string) string
- func Sha1(s string) string
- func SliceToString(buf []byte) string
- func Sprint(args ...interface{}) string
- func Sprintf(format string, args ...interface{}) string
- func Sprintln(args ...interface{}) string
- func StrCat(sv ...string) string
- func StrLen(s string) int
- func StrSplitSkipEmpty(s string, sep byte, suggestcap int) []string
- func StrSplitSkipSpecNoEmpty(s, spec string, sep byte, suggestcap int) []string
- func StrToFloat64(str string) float64
- func Str_Pad(strs string, length int, pad string, up string) (str string)
- func Struct2Map(obj interface{}) map[string]interface{}
- func SubString(str string, begin, length int) (substr string)
- func TagSplit(keywords string) string
- func ToLower(str string) string
- func ToSha1(s string) string
- func ToUpper(str string) string
- func UrlDecode(urls string) string
- func UrlEncode(urls string) string
- func WriteAtFile(fullpath, str string) error
- func WriteByteAtFile(fullpath string, str []byte) error
- func WriteByteFile(fullpath string, data []byte) error
- func WriteFile(fullpath, str string) error
- type Derivator
- type Job
- type RoutinePool
Constants ¶
const ( Kilo int64 = 1024 KB int64 = Kilo MB int64 = KB * Kilo GB int64 = MB * Kilo TB int64 = GB * Kilo PB int64 = TB * Kilo EB int64 = PB * Kilo // MAX UINT64MAX uint64 = ^uint64(0) INT64MAX int64 = int64(^uint64(0) >> 1) INT64MIN int64 = -int64(^uint64(0) >> 1) UINT32MAX uint32 = ^uint32(0) INT32MAX int32 = int32(^uint32(0) >> 1) INT32MIN int32 = -int32(^uint32(0) >> 1) UINT16MAX uint16 = ^uint16(0) INT16MAX int16 = int16(^uint16(0) >> 1) INT16MIN int16 = -int16(^uint16(0) >> 1) UINT8MAX uint8 = ^uint8(0) INT8MAX int8 = int8(^uint8(0) >> 1) INT8MIN int8 = -int8(^uint8(0) >> 1) )
Conversion
Variables ¶
This section is empty.
Functions ¶
func AppDaemonizedEx ¶
AppDaemonizedEx todo
func AppIsRunningEx ¶
AppIsRunningEx daemon is running
func CountFileLine ¶
@name 计算文件行数 @param filepath string 文件路径 @return int64 行数 @return error 错误类型
func HasNonBmpRune ¶
HasNonBmpRune todo BMP -> U+0000 to U+FFFF https://www.sttmedia.com/unicode-basiclingualplane
func HmacSha256 ¶
func NewAppRestart ¶
new app restart only send SIGUSR2
func StrCat ¶
StrCat cat strings: You should know that StrCat gradually builds advantages only when the number of parameters is> 2.
func StrSplitSkipEmpty ¶
StrSplitSkipEmpty skip empty string suggestcap is suggest cap
func StrSplitSkipSpecNoEmpty ¶
StrSplitSkipSpecNoEmpty todo
Types ¶
type Derivator ¶
type Derivator struct {
// contains filtered or unexported fields
}
Derivator expand env engine
func (*Derivator) AddBashCompatible ¶
func (de *Derivator) AddBashCompatible()
AddBashCompatible $0~$9
type Job ¶
type Job func()
Job Represents user request, function which should be executed in some worker.
type RoutinePool ¶
type RoutinePool struct { JobQueue chan Job NumberWorkers int // contains filtered or unexported fields }
RoutinePool todo
func NewRoutinePool ¶
func NewRoutinePool(numWorkers int, jobQueueLen int) *RoutinePool
NewRoutinePool Will make pool of gorouting workers. numWorkers - how many workers will be created for this pool queueLen - how many jobs can we accept until we block
Returned object contains JobQueue reference, which you can use to send job to pool.
func (*RoutinePool) JobDone ¶
func (p *RoutinePool) JobDone()
JobDone In case you are using WaitAll fn, you should call this method every time your job is done.
If you are not using WaitAll then we assume you have your own way of synchronizing.
func (*RoutinePool) Release ¶
func (p *RoutinePool) Release()
Release Will release resources used by pool
func (*RoutinePool) WaitAll ¶
func (p *RoutinePool) WaitAll()
WaitAll Will wait for all jobs to finish.
func (*RoutinePool) WaitCount ¶
func (p *RoutinePool) WaitCount(count int)
WaitCount How many jobs we should wait when calling WaitAll. It is using WaitGroup Add/Done/Wait
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
Package cedar-go implements double-array trie.
|
Package cedar-go implements double-array trie. |
*
|
* |
* | |
common
*
|
* |
internal
*
|
* |
* | |
* | |
* | |
encry
|
|
Package geoip2 provides an easy-to-use API for the MaxMind GeoIP2 and GeoLite2 databases; this package does not support GeoIP Legacy databases.
|
Package geoip2 provides an easy-to-use API for the MaxMind GeoIP2 and GeoLite2 databases; this package does not support GeoIP Legacy databases. |
Package gjson provides searching for json strings.
|
Package gjson provides searching for json strings. |
grok
module
|
|
Package guid defines a type for globally unique identifiers.
|
Package guid defines a type for globally unique identifiers. |
*
|
* |
alils
Package alils implements the SDK(v0.5.0) of Simple Log Service(abbr.
|
Package alils implements the SDK(v0.5.0) of Simple Log Service(abbr. |
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner.
|
Package otp implements both HOTP and TOTP based one time passcodes in a Google Authenticator compatible manner. |
interop
Module
|
|
redis
module
|
|
rsc
|
|
qr
Package qr encodes QR codes.
|
Package qr encodes QR codes. |
qr/coding
Package coding implements low-level QR coding details.
|
Package coding implements low-level QR coding details. |
通过 SSH 复制文件
|
通过 SSH 复制文件 |
Go中文分词
|
Go中文分词 |
录像
|
录像 |
tcp
|
|
tencent
|
|
terminal
|
|
toml
module
|
|
yaml
module
|