kbutils

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

README

kbutils

自用学习库,仅支持自己学习

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TimeTp          = "2006-01-02 15:04:05"
	GetLocationName = func(zone int) string {
		switch zone {
		case 8:
			return "Asia/Shanghai"
		}
		return "UTC"
	}
)

time time time 东八区

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 FormatTime

func FormatTime(t time.Time, format ...string) string

FormatTime format time

func FormatTlp

func FormatTlp(format string) string

FormatTlp FormatTlp

func GetAllMethod

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 IfVal

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

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

func KillSignal

func KillSignal() bool

killChannel

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

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

func RunAllMethod

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

RunAllMethod run all methods of struct

func RunAssignMethod

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 ToString

func ToString(i interface{}) string

func Try deprecated

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

Deprecated: please use TryCatch Try exception capture

func TryCatch

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

TryCatch exception capture

func Zone

func Zone(zone ...int) *time.Location

Zone eastEightTimeZone

Types

type StringVariable

type StringVariable interface{ String() string }

/定义接口

type TimeEngine

type TimeEngine struct {
	// contains filtered or unexported fields
}

func New

func New(zone ...int) *TimeEngine

New new timeEngine

Directories

Path Synopsis
Package zjson json data read and write operations
Package zjson json data read and write operations
Package zlog provide daily log service
Package zlog provide daily log service
Package verify data verification
Package verify data verification

Jump to

Keyboard shortcuts

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