Documentation
¶
Index ¶
- Variables
- func Assert()
- func AssertFn(fn reflect.Value) error
- func Blue(s string) string
- func Cyan(s string) string
- func Debug()
- func ErrHandle(err interface{}, fn ...func(err *Err))
- func ErrLog(err interface{})
- func ErrTagRegistry(tag string)
- func ErrTags() map[string]bool
- func ErrTagsMatch(tag string) bool
- func FuncCaller(callDepth int) string
- func GetCallerFromFn(fn reflect.Value) string
- func GetOkOnce(fn func() bool) func() bool
- func Green(s string) string
- func If(b bool, t, f interface{}) interface{}
- func InitDebug()
- func InitSkipErrorFile()
- func IsNone(val interface{}) bool
- func IsZero(val reflect.Value) bool
- func LoadEnvFile(envPath string)
- func Magenta(s string) string
- func P(s string, d ...interface{})
- func Panic(err interface{})
- func Red(s string) string
- func Resp(fn func(err *Err))
- func RespErr(err error)
- func Retry(num int, fn func()) (err error)
- func RetryAt(t time.Duration, fn func(at time.Duration))
- func T(b bool, msg string, args ...interface{})
- func TT(b bool, fn func(err *Err))
- func TestRun(fn interface{}, desc func(desc func(string) *Test))
- func Throw(fn interface{})
- func Ticker(fn func(dur time.Time) time.Duration)
- func Try(fn interface{}) func(...interface{}) func(...interface{}) (err error)
- func TryRaw(fn reflect.Value) func(...reflect.Value) func(...reflect.Value) (err error)
- func White(s string) string
- func Wrap(err interface{}, msg string, args ...interface{})
- func WrapM(err interface{}, fn func(err *Err))
- func Yellow(s string) string
- type Err
- func (t *Err) Caller(caller string)
- func (t *Err) Err() error
- func (t *Err) Error() string
- func (t *Err) M(k string, v interface{})
- func (t *Err) Msg(msg string, args ...interface{})
- func (t *Err) P() string
- func (t *Err) SetTag(tag string)
- func (t *Err) StackTrace() *_Err
- func (t *Err) Tag() string
- type Test
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 ErrTagRegistry ¶
func ErrTagRegistry(tag string)
func ErrTagsMatch ¶
func FuncCaller ¶
func GetCallerFromFn ¶
func InitSkipErrorFile ¶ added in v0.3.5
func InitSkipErrorFile()
func LoadEnvFile ¶ added in v0.3.7
func LoadEnvFile(envPath string)
Types ¶
type Err ¶
type Err struct {
// contains filtered or unexported fields
}
func (*Err) StackTrace ¶
func (t *Err) StackTrace() *_Err
Click to show internal directories.
Click to hide internal directories.