hooks

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseOperationHooksInterface

type BaseOperationHooksInterface interface {
	BeforeInitOperation(ctx context.Context, req *operation.OperationRequest) *errors.AsyncError
	AfterInitOperation(ctx context.Context, op operation.ApiOperation, req *operation.OperationRequest, asyncError *errors.AsyncError) *errors.AsyncError

	BeforeGuardConcurrency(ctx context.Context, op operation.ApiOperation, e entity.Entity) *errors.AsyncError
	AfterGuardConcurrency(ctx context.Context, op operation.ApiOperation, asyncError *errors.AsyncError) *errors.AsyncError

	BeforeRun(ctx context.Context, op operation.ApiOperation) *errors.AsyncError
	AfterRun(ctx context.Context, op operation.ApiOperation, asyncError *errors.AsyncError) *errors.AsyncError
}

Hooks are used to extend the usability of the operations, and to let the user modify the behavior of the different methods we enforce in case they want to change the inputs or outputs.

type HookedApiOperation

type HookedApiOperation struct {
	OperationInstance operation.ApiOperation
	OperationHooks    []BaseOperationHooksInterface
}

func (*HookedApiOperation) AfterGuardConcurrency

func (h *HookedApiOperation) AfterGuardConcurrency(ctx context.Context, op operation.ApiOperation, asyncErr *errors.AsyncError) *errors.AsyncError

func (*HookedApiOperation) AfterInitOperation

func (*HookedApiOperation) AfterRun

func (*HookedApiOperation) BeforeGuardConcurrency

func (h *HookedApiOperation) BeforeGuardConcurrency(ctx context.Context, op operation.ApiOperation, e entity.Entity) *errors.AsyncError

func (*HookedApiOperation) BeforeInitOperation

func (h *HookedApiOperation) BeforeInitOperation(ctx context.Context, req *operation.OperationRequest) *errors.AsyncError

HookedApiOperation implements the methods of the BaseOperationHooksInterface to allow the user to implement only the hooks they need (e.g. only implement the Before/AfterRun hooks), instead of having to implement all of them.

func (*HookedApiOperation) BeforeRun

func (*HookedApiOperation) GuardConcurrency

func (h *HookedApiOperation) GuardConcurrency(ctx context.Context, e entity.Entity) *errors.AsyncError

func (*HookedApiOperation) InitOperation

func (*HookedApiOperation) Run

Jump to

Keyboard shortcuts

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