Documentation ¶
Index ¶
- Constants
- Variables
- func ByteToMB(bytes uint64) uint64
- func BytesTrimRight(src []byte, trim []byte) []byte
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (errOut error)
- func EnableDebugLog()
- func FailOnError(err error, msg string)
- func GetEnv(env, def string) string
- func GetType(v interface{}) reflect.Type
- func GetValue(v interface{}) reflect.Value
- func HasError(err error) bool
- func HasString(s string) bool
- func IndexOfFirstSpace(str string) int
- func IsByteStartWith(src []byte, start []byte) bool
- func IsEmptyString(s string) bool
- func IsFileExists(path string) bool
- func IsFileExistsAndReturnFileInfo(path string) (os.FileInfo, bool)
- func IsLinux() bool
- func IsMac() bool
- func IsPointerType(v interface{}) bool
- func IsWindows() bool
- func LogDebug(format string, a ...interface{})
- func LogIfError(err error) bool
- func LogInfo(format string, a ...interface{})
- func LogInit()
- func LogWarn(format string, a ...interface{})
- func OS() string
- func PanicIfErr(err error)
- func PanicIfNil(obj interface{}, msg string)
- func ParseString(src string) string
- func ParseStringWithSource(src string, source map[string]string) string
- func PointerBoolean(val bool) *bool
- func RecoverPanic(handler func(e error))
- func TrimLeftString(src, trim string) string
- func UTF16BytesToString(b []byte, o binary.ByteOrder) string
- func Unzip(src string, dest string) (out error)
- func Wait(group *sync.WaitGroup, timeout time.Duration) bool
- func Zip(src, dest, separator string) (out error)
- type ZkCallbacks
- type ZkClient
- func (client *ZkClient) Close()
- func (client *ZkClient) Connect(host string) error
- func (client *ZkClient) Create(path string, nodeType int32, data string) (string, error)
- func (client *ZkClient) Data(path string) (string, error)
- func (client *ZkClient) Delete(path string) error
- func (client *ZkClient) Exist(path string) (bool, error)
Constants ¶
View Source
const ( UnixNewLine = "\n" UnixPathSeparator = "/" WinNewLine = "\r\n" WinPathSeparator = "\\" LineBreak = '\n' EmptyStr = "" OSWin = "windows" OSLinux = "linux" OSMac = "darwin" )
View Source
const ( HttpMimeJson = "application/json" HttpHeaderContentType = "Content-Type" HttpHeaderAgentToken = "AGENT-TOKEN" )
View Source
const ( ZkNodeTypePersistent = int32(0) ZkNodeTypeEphemeral = int32(zk.FlagEphemeral) )
Variables ¶
View Source
var (
HomeDir = ""
)
Functions ¶
func BytesTrimRight ¶
func CopyFile ¶
CopyFile The file will be created if it does not already exist. If the destination file exists, the contents will be replaced
func EnableDebugLog ¶
func EnableDebugLog()
func IndexOfFirstSpace ¶
func IsByteStartWith ¶
func IsFileExists ¶
func IsPointerType ¶
func IsPointerType(v interface{}) bool
IsPointerType to check the input v is pointer type
func LogIfError ¶
func PanicIfErr ¶
func PanicIfErr(err error)
func PanicIfNil ¶
func PanicIfNil(obj interface{}, msg string)
func ParseString ¶
ParseString parse string which include system env variable
func ParseStringWithSource ¶
func PointerBoolean ¶
func RecoverPanic ¶
func RecoverPanic(handler func(e error))
func TrimLeftString ¶
Types ¶
type ZkCallbacks ¶
type ZkCallbacks struct {
OnDisconnected func()
}
type ZkClient ¶
type ZkClient struct { Callbacks *ZkCallbacks // contains filtered or unexported fields }
func NewZkClient ¶
func NewZkClient() *ZkClient
Click to show internal directories.
Click to hide internal directories.