zutil

package
v0.1.62 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 9 Imported by: 32

Documentation

Overview

Package zutil daily development helper functions

Index

Constants

View Source
const BuffSize = 10 * 1024

Variables

This section is empty.

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() *bytes.Buffer

func GetField

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

func GetOs added in v0.1.59

func GetOs() string

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 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

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

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(), callback func(time.Duration))

Types

This section is empty.

Directories

Path Synopsis
Package daemon program is installed as a system service to achieve process daemon * @Author: seekwe * @Date: 2020-06-06 17:03:53 * @Last Modified by:: seekwe * @Last Modified time: 2020-06-09 16:39:23
Package daemon program is installed as a system service to achieve process daemon * @Author: seekwe * @Date: 2020-06-06 17:03:53 * @Last Modified by:: seekwe * @Last Modified time: 2020-06-09 16:39:23

Jump to

Keyboard shortcuts

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