Documentation
¶
Index ¶
- func All(ops ...func() bool) (r bool)
- func Checkerr2Exit(tag string, err error)
- func Checkerr2Raise(tag string, err error)
- func Either(ops ...func() bool) (r bool)
- func RaiseCause(forward_trace *trace.Forwardtrace, first_backtrace_point *trace.BacktracePoint)
- type BacktraceDomainChain
- type CtxValueAccessor
- type Event
- func (e *Event) Catch(f func(e *Event)) *Event
- func (existing_event *Event) ContainAndWrap(added_backtrace_point *trace.BacktracePoint) *Event
- func (e *Event) Error() string
- func (e *Event) JSON() []byte
- func (e *Event) OK(f func()) *Event
- func (existing_event *Event) Reraise(added_backtrace_point *trace.BacktracePoint)
- func (e *Event) Serk() string
- func (e *Event) String() string
- func (existing_event *Event) Wrap(added_backtrace_point *trace.BacktracePoint) *Event
- type FullBacktrace
- type KeyedTable
- type MatchCase
- type MatchTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Checkerr2Exit ¶ added in v1.55.0
func Checkerr2Raise ¶ added in v1.55.0
The equivalent of !!! operator in Go2
func RaiseCause ¶ added in v1.81.0
func RaiseCause(forward_trace *trace.Forwardtrace, first_backtrace_point *trace.BacktracePoint)
Example usage:
controlflow.RaiseCause(tracer.GetForwardtrace(), trace.BacktracePointf("123123", "the cause"))
controlflow.RaiseCause(nil, trace.BacktracePointf("123123", "the cause"))
Sometimes, some function want to raise the cause, but it's too tedious to pass the tracer in it; in this case, the function may raise it with nil forwardtrace (and it's okay), and then the user of it will catch the event, and set actual forwardtrace directly. Example, inside such a function:
controlflow.RaiseCause(nil, trace.BacktracePointf("123123", err.Error()))
And then at first interception point:
event.Forwardtrace = tracer.GetForwardtrace()
Types ¶
type BacktraceDomainChain ¶ added in v1.81.0
type BacktraceDomainChain []*trace.BacktracePoint
First element is most specific, last ones are least specific - this is the inverse of forwardtrace tags;
func (*BacktraceDomainChain) GetIdsChainLVA ¶ added in v1.84.0
func (d *BacktraceDomainChain) GetIdsChainLVA() []byte
Used for efficient matching of Id sequences using bytes.Contains() and bytes.HasPrefix(). See also trace.EncodeLVA()
func (BacktraceDomainChain) Last ¶ added in v1.81.0
func (d BacktraceDomainChain) Last(neg_i int) *trace.BacktracePoint
E.g. to get the one before last, use Last(-2); The purpose is to easily get the last thing. Also used internally
type CtxValueAccessor ¶ added in v1.86.0
func (*CtxValueAccessor[T]) GetObjectFromCtx ¶ added in v1.86.0
func (a *CtxValueAccessor[T]) GetObjectFromCtx(ctx context.Context) (object T)
func (*CtxValueAccessor[T]) SetObjectToCtx ¶ added in v1.86.0
type Event ¶ added in v1.81.0
type Event struct {
RetryAttemptNb int `json:"-"`
Forwardtrace *trace.Forwardtrace
Backtrace FullBacktrace
}
func NewEvent ¶ added in v1.81.0
func NewEvent(forward_trace *trace.Forwardtrace, first_backtrace_point *trace.BacktracePoint) *Event
Example usage: controlflow.NewEvent(tracer.GetForwardtrace(), trace.BacktracePointf("123123", "the cause")) controlflow.NewEvent(nil, trace.BacktracePointf("123123", "the cause"))
func (*Event) ContainAndWrap ¶ added in v1.84.0
func (existing_event *Event) ContainAndWrap(added_backtrace_point *trace.BacktracePoint) *Event
Creates new domain chain on the backtrace
func (*Event) Reraise ¶ added in v1.81.0
func (existing_event *Event) Reraise(added_backtrace_point *trace.BacktracePoint)
type FullBacktrace ¶ added in v1.81.0
type FullBacktrace []*BacktraceDomainChain
First element is most specific, last ones are least specific - this is the inverse of forwardtrace tags;
func (FullBacktrace) GetIdsChainLVA ¶ added in v1.84.0
func (b FullBacktrace) GetIdsChainLVA() []byte
Used for efficient matching of Id sequences using bytes.Contains() and bytes.HasPrefix(). See also trace.EncodeLVA()
func (FullBacktrace) Last ¶ added in v1.81.0
func (b FullBacktrace) Last(neg_i int) *BacktraceDomainChain
E.g. to get the one before last, use Last(-2); The purpose is to easily get the last thing. Also used internally
type KeyedTable ¶
type KeyedTable[T comparable] map[T]func() int // -1 break/complete
func (KeyedTable[T]) Sequence ¶
func (t KeyedTable[T]) Sequence(keys ...T)
func (KeyedTable[T]) Switch ¶
func (t KeyedTable[T]) Switch(primary, default_ T)