zutil

package
v1.1.17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2021 License: MIT Imports: 10 Imported by: 31

Documentation

Overview

Package zutil daily development helper functions

Index

Constants

This section is empty.

Variables

View Source
var (
	BuffSize = bufTypes[3]
)

Functions

func CanExpand

func CanExpand(t reflect.Type) bool

func CanInline

func CanInline(t reflect.Type) bool

func CheckErr

func CheckErr(err error, exit ...bool)

CheckErr CheckErr

func GetAllMethod added in v0.1.42

func GetAllMethod(st interface{}, fn func(numMethod int, m reflect.Method) error) error

GetAllMethod get all methods of struct

func GetBuff

func GetBuff(ss ...int) *bytes.Buffer

func GetField

func GetField(v reflect.Value, i int) reflect.Value

func GetGid added in v1.1.17

func GetGid() uint64

GetGid Get coroutine id

func GetOs added in v0.1.59

func GetOs() string

func GetParentProcessName added in v1.1.15

func GetParentProcessName() (string, error)

func Getenv added in v0.1.59

func Getenv(name string, def ...string) string

Getenv get ENV value by key name

func IfVal

func IfVal(condition bool, trueVal, falseVal interface{}) interface{}

IfVal Simulate ternary calculations, pay attention to handling no variables or indexing problems

func IsDoubleClickStartUp added in v1.1.15

func IsDoubleClickStartUp() bool

func IsLinux added in v0.1.59

func IsLinux() bool

IsLinux system

func IsMac added in v0.1.59

func IsMac() bool

IsMac system

func IsWin added in v0.1.59

func IsWin() bool

IsWin system. linux windows darwin

func LabelType

func LabelType(t reflect.Type) bool

func Nonzero

func Nonzero(v reflect.Value) bool

func PutBuff

func PutBuff(buffer *bytes.Buffer)

func ReflectForNumField

func ReflectForNumField(v reflect.Value, fn func(fieldName, fieldTag string,
	kind reflect.Kind, field reflect.Value) error, tag ...string) error

func ReflectStructField added in v0.1.43

func ReflectStructField(v reflect.Type, fn func(
	numField int, fieldTag string, field reflect.StructField) error, tag ...string) error

func RunAllMethod added in v0.0.26

func RunAllMethod(st interface{}, args ...interface{}) (err error)

RunAllMethod run all methods of struct

func RunAssignMethod added in v0.1.48

func RunAssignMethod(st interface{}, filter func(methodName string) bool, args ...interface{}) (err error)

RunAssignMethod run assign methods of struct

func SetValue

func SetValue(vTypeOf reflect.Kind, vValueOf reflect.Value, value interface{}) (err error)

func Try deprecated

func Try(fn func(), catch func(e interface{}), finally ...func())

Deprecated: please use TryCatch Try exception capture

func TryCatch added in v1.1.12

func TryCatch(fn func() error) (err error)

TryCatch exception capture

func WithLockContext

func WithLockContext(mu *sync.Mutex, fn func())

func WithRunMemContext added in v0.1.61

func WithRunMemContext(handler func()) uint64

func WithRunTimeContext

func WithRunTimeContext(handler func()) time.Duration

Types

This section is empty.

Directories

Path Synopsis
Package daemon program is installed as a system service to achieve process daemon
Package daemon program is installed as a system service to achieve process daemon

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL