bntp

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TupleToAOS2

func TupleToAOS2[T1 any, T2 any](soa tuple.T2[[]T1, []T2]) (res []tuple.T2[T1, T2])

func TupleToSOA2

func TupleToSOA2[T1 any, T2 any](aos []tuple.T2[T1, T2]) (res tuple.T2[[]T1, []T2])

Types

type BadHookPointError

type BadHookPointError struct{}

func (BadHookPointError) As added in v0.6.0

func (err BadHookPointError) As(target any) bool

func (BadHookPointError) Error added in v0.6.0

func (err BadHookPointError) Error() string

func (BadHookPointError) Is added in v0.6.0

func (err BadHookPointError) Is(other error) bool

type HookExecutionError

type HookExecutionError struct {
	Inner error
}

func (HookExecutionError) Error

func (err HookExecutionError) Error() string

func (HookExecutionError) Unwrap

func (err HookExecutionError) Unwrap() error

type HookPoint

type HookPoint int
const (
	BeforeAddHook HookPoint = 1 << iota
	AfterAddHook

	BeforeSelectHook
	AfterSelectHook

	BeforeUpdateHook
	AfterUpdateHook

	BeforeDeleteHook
	AfterDeleteHook

	BeforeUpsertHook
	AfterUpsertHook

	BeforeAnyHook
	AfterAnyHook

	// TODO: Handle these hooks in managers.
	AfterErrorHook
	AfterDeadlineHook
	AfterTimeoutHook
	AfterCancelHook
)

type Hooks

type Hooks[TEntity any] struct {
	// contains filtered or unexported fields
}

func NewHooks

func NewHooks[TEntity any]() *Hooks[TEntity]

func (*Hooks[TEntity]) AddHook

func (hooks *Hooks[TEntity]) AddHook(point HookPoint, hook func(context.Context, *TEntity) error) error

func (*Hooks[TEntity]) ClearHooks

func (hooks *Hooks[TEntity]) ClearHooks(point HookPoint) error

func (*Hooks[TEntity]) ExecuteHooks

func (hooks *Hooks[TEntity]) ExecuteHooks(ctx context.Context, point HookPoint, entity *TEntity) error

func (*Hooks[TEntity]) PartiallySpecializeExecuteHooks

func (hooks *Hooks[TEntity]) PartiallySpecializeExecuteHooks(ctx context.Context, point HookPoint) func(entity *TEntity) error

func (*Hooks[TEntity]) PartiallySpecializeExecuteHooksForNoPointer

func (hooks *Hooks[TEntity]) PartiallySpecializeExecuteHooksForNoPointer(ctx context.Context, point HookPoint) func(entity TEntity) error

NOTE: This is not great but finding a better solution is hard with this language.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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