Documentation ¶
Index ¶
- Constants
- Variables
- func CurrentProcessName() (string, error)
- func DebugPrintInfo(v reflect.Value)
- func DeepCopy(dst, src interface{}) error
- func DefaultDataDir(dirs ...string) string
- func EmptyDir(dir string) bool
- func EnsureDir(dir string, mode os.FileMode) error
- func Exit(s string)
- func FileExist(path string) bool
- func FileNotExist(path string) bool
- func GetCurrentPath() string
- func HomeDir() string
- func If(condition bool, trueVal, falseVal interface{}) interface{}
- func Inject(obj interface{}, key string, val interface{}) error
- func IsStartLower(s string) bool
- func IsStartUpper(s string) bool
- func LockPIDFile(pidfile string) error
- func Mac() string
- func MergeSliceByte(ss ...[]byte) []byte
- func MustWriteFile(filePath string, contents []byte, mode os.FileMode)
- func NonEmptyDir(dir string) bool
- func ReverseByte(arr []byte) []byte
- func Rootify(path string, roots ...string) string
- func StartLower(s string) string
- func StartUpper(s string) string
- func TimeParse(value string) (time.Time, error)
- func TimeParseInLocation(value string) (time.Time, error)
- func TimeParseToUTC(value string) (time.Time, error)
- func TrapSignal(cb func())
- func URLJoin(urls ...string) string
- func UUID() (string, error)
- func UnlockPIDFile(pidfile string) error
- func WindowsAppData() string
- func WriteFile(filePath string, contents []byte, mode os.FileMode) error
- func WritePIDFile(filepath string) error
- type DiskSize
- type FileLock
- type Message
Constants ¶
View Source
const ( B = 1 K = 1024 * B M = 1024 * K G = 1024 * M T = 1024 * G P = 1024 * T E = 1024 * P )
View Source
const URLSeparator = '/'
Variables ¶
View Source
var ( Validate = validator.Validate RegisterCustomValidateType = validator.RegisterCustomValidateType )
View Source
var DefaultTimeFormart = "2006-01-02 15:04:05"
View Source
var Fmt = fmt.Sprintf
Fmt shorthand, XXX DEPRECATED
Functions ¶
func CurrentProcessName ¶ added in v0.0.6
func DebugPrintInfo ¶ added in v0.0.4
func DefaultDataDir ¶ added in v0.0.4
DefaultDataDir is the default data directory
func GetCurrentPath ¶ added in v0.0.8
func GetCurrentPath() string
返回当前可执行文件的路径 os.Getwd() 返回当前的 work dir 工作目录
func If ¶ added in v0.0.6
func If(condition bool, trueVal, falseVal interface{}) interface{}
实现三元表达式的功能
func LockPIDFile ¶ added in v0.0.6
func MergeSliceByte ¶ added in v0.0.7
func MustWriteFile ¶ added in v0.0.4
func ReverseByte ¶ added in v0.0.7
func TimeParseInLocation ¶ added in v0.0.8
func TrapSignal ¶ added in v0.0.4
func TrapSignal(cb func())
TrapSignal catches the SIGTERM and executes cb function. After that it exits with code 1.
func UnlockPIDFile ¶ added in v0.0.8
func WindowsAppData ¶ added in v0.0.8
func WindowsAppData() string
func WritePIDFile ¶ added in v0.0.6
Types ¶
type FileLock ¶ added in v0.0.6
type FileLock struct {
// contains filtered or unexported fields
}
func NewFileLock ¶ added in v0.0.6
type Message ¶ added in v0.0.4
type Message struct { Code int `json:"code"` //状态码 Msg string `json:"msg,omitempty"` //消息 Data interface{} `json:"data,omitempty"` //结果数据 }
func NewErrorMessage ¶ added in v0.0.5
func NewMessage ¶ added in v0.0.4
func NewSuccessMessage ¶ added in v0.0.5
func NewSuccessMessage(datas ...interface{}) *Message
Source Files ¶
Click to show internal directories.
Click to hide internal directories.