stdutil

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuncName added in v0.4.2

func FuncName(f interface{}) string

FuncName get func name

func GetCallStacks added in v0.4.2

func GetCallStacks(all bool) []byte

GetCallStacks stacks is a wrapper for runtime. Stack that attempts to recover the data for all goroutines. from glog package

func GetCallersInfo added in v0.4.2

func GetCallersInfo(skip, max int) (callers []string)

GetCallersInfo returns an array of strings containing the file and line number of each stack frame leading

func Go added in v0.4.2

func Go(f func() error) error

Go is a basic promise implementation: it wraps calls a function in a goroutine and returns a channel which will later return the function's return value.

func MustString

func MustString(v interface{}) string

MustString convert value(basic type) to string, will panic on convert a complex type.

func PanicIf

func PanicIf(err error)

PanicIf if error is not empty

func PanicIfErr

func PanicIfErr(err error)

PanicIfErr if error is not empty

func Panicf

func Panicf(format string, v ...interface{})

Panicf format panic message use fmt.Sprintf

func PkgName added in v0.4.2

func PkgName(funcName string) string

PkgName get current package name

Usage:

funcName := stdutil.FuncName(fn)
pgkName := stdutil.PkgName(funcName)

func ToString

func ToString(v interface{}) string

ToString always convert value to string

func TryString

func TryString(v interface{}) (string, error)

TryString try to convert a value to string

func WaitCloseSignals added in v0.4.2

func WaitCloseSignals(closer io.Closer) error

WaitCloseSignals for some huang program.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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