internal

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cfg = struct {
	MaxObj      uint8
	MaxRetryDur time.Duration
}{
	MaxObj:      15,
	MaxRetryDur: time.Hour * 24,
}

default config

View Source
var IsDebug = GetOkOnce(func() bool {
	debug := os.Getenv("debug")
	return debug == "true" || debug == "t" || debug == "1" || debug == "ok"
})
View Source
var IsSkipErrorFile = GetOkOnce(func() bool {
	skipErrorFile := os.Getenv("skip_error_file")
	return skipErrorFile == "true" || skipErrorFile == "t" || skipErrorFile == "1" || skipErrorFile == "ok"
})

Functions

func AssertFn

func AssertFn(fn reflect.Value) error

func Blue

func Blue(s string) string

func Cyan

func Cyan(s string) string

func Debug

func Debug()

func ErrHandle

func ErrHandle(err interface{}, fn ...func(err *Err))

func ErrLog

func ErrLog(err interface{})

func ErrTagRegistry

func ErrTagRegistry(tags ...interface{})

func ErrTags

func ErrTags() map[string]bool

func ErrTagsMatch

func ErrTagsMatch(tag string) bool

func FuncCaller

func FuncCaller(callDepth int) string

func GetCallerFromFn

func GetCallerFromFn(fn reflect.Value) string

func GetOkOnce added in v0.3.5

func GetOkOnce(fn func() bool) func() bool

func Green

func Green(s string) string

func If

func If(b bool, t, f interface{}) interface{}

func InitDebug added in v0.3.3

func InitDebug()

func InitSkipErrorFile added in v0.3.5

func InitSkipErrorFile()

func IsNone

func IsNone(val interface{}) bool

func IsZero

func IsZero(val reflect.Value) bool

func LoadEnvFile added in v0.3.7

func LoadEnvFile(envPath string) (err error)

func Magenta

func Magenta(s string) string

func P

func P(s string, d ...interface{})

func Panic

func Panic(err interface{})

func Red

func Red(s string) string

func Retry

func Retry(num int, fn func()) (err error)

func RetryAt

func RetryAt(t time.Duration, fn func(at time.Duration))

func T

func T(b bool, msg string, args ...interface{})

func TT

func TT(b bool, fn func(err *Err))

func Throw

func Throw(fn interface{})

func Ticker

func Ticker(fn func(dur time.Time) time.Duration)

func Try

func Try(fn interface{}) func(...interface{}) func(...interface{}) (err error)

func TryRaw

func TryRaw(fn reflect.Value) func(...reflect.Value) func(...reflect.Value) (err error)

func White

func White(s string) string

func Wrap

func Wrap(err interface{}, msg string, args ...interface{})

func WrapM

func WrapM(err interface{}, fn func(err *Err))

func Yellow

func Yellow(s string) string

Types

type Err

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

func (*Err) Caller

func (t *Err) Caller(caller string)

func (*Err) Err

func (t *Err) Err() error

func (*Err) Error

func (t *Err) Error() string

func (*Err) M

func (t *Err) M(k string, v interface{})

func (*Err) Msg added in v0.3.6

func (t *Err) Msg(msg string, args ...interface{})

func (*Err) P

func (t *Err) P() string

func (*Err) SetTag

func (t *Err) SetTag(tag string)

func (*Err) StackTrace

func (t *Err) StackTrace() *_Err

func (*Err) Tag

func (t *Err) Tag() string

type Result added in v0.3.12

type Result func(ret func(interface{})) error

Jump to

Keyboard shortcuts

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