zutil

package
v0.1.49 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 License: MIT Imports: 8 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 IfVal

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

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

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(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(fn func())

func WithRunTimeContext

func WithRunTimeContext(closer 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