internal

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Green   = string([]byte{27, 91, 57, 55, 59, 52, 50, 109})
	White   = string([]byte{27, 91, 57, 48, 59, 52, 55, 109})
	Yellow  = string([]byte{27, 91, 57, 48, 59, 52, 51, 109})
	Red     = string([]byte{27, 91, 57, 55, 59, 52, 49, 109})
	Blue    = string([]byte{27, 91, 57, 55, 59, 52, 52, 109})
	Magenta = string([]byte{27, 91, 57, 55, 59, 52, 53, 109})
	Cyan    = string([]byte{27, 91, 57, 55, 59, 52, 54, 109})
	Reset   = string([]byte{27, 91, 48, 109})
)

terminal color define

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

default config

Functions

func Assert

func Assert()

func AssertFn

func AssertFn(fn reflect.Value) error

func Debug

func Debug()

func ErrHandle

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

func ErrLog

func ErrLog(err interface{})

func ErrTagRegistry

func ErrTagRegistry(tag string)

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 If

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

func IsNone

func IsNone(val interface{}) bool

func IsZero

func IsZero(val reflect.Value) bool

func P

func P(d ...interface{})

func Panic

func Panic(err interface{})

func Resp

func Resp(fn func(err *Err))

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 TestRun

func TestRun(fn interface{}, desc func(desc func(string) *Test))

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 Wrap

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

Types

type Err

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

func TT

func TT(b bool, msg string, args ...interface{}) *Err

func WrapM

func WrapM(err interface{}, msg string, args ...interface{}) *Err

func (*Err) Caller

func (t *Err) Caller(caller string) *Err

func (*Err) Done

func (t *Err) Done()

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{}) *Err

func (*Err) P

func (t *Err) P() string

func (*Err) SetTag

func (t *Err) SetTag(tag string) *Err

func (*Err) StackTrace

func (t *Err) StackTrace() *_Err

func (*Err) Tag

func (t *Err) Tag() string

type Test

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

func (*Test) In

func (t *Test) In(args ...interface{}) *Test

func (*Test) IsErr

func (t *Test) IsErr(fn ...interface{})

func (*Test) IsNil

func (t *Test) IsNil(fn ...interface{})

Jump to

Keyboard shortcuts

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