Documentation
¶
Index ¶
- type BaseOperationHooksInterface
- type HookedApiOperation
- func (h *HookedApiOperation) AfterGuardConcurrency(ctx context.Context, op operation.ApiOperation, asyncErr *errors.AsyncError) *errors.AsyncError
- func (h *HookedApiOperation) AfterInitOperation(ctx context.Context, op operation.ApiOperation, ...) *errors.AsyncError
- func (h *HookedApiOperation) AfterRun(ctx context.Context, op operation.ApiOperation, err *errors.AsyncError) *errors.AsyncError
- func (h *HookedApiOperation) BeforeGuardConcurrency(ctx context.Context, op operation.ApiOperation, e entity.Entity) *errors.AsyncError
- func (h *HookedApiOperation) BeforeInitOperation(ctx context.Context, req *operation.OperationRequest) *errors.AsyncError
- func (h *HookedApiOperation) BeforeRun(ctx context.Context, op operation.ApiOperation) *errors.AsyncError
- func (h *HookedApiOperation) GuardConcurrency(ctx context.Context, e entity.Entity) *errors.AsyncError
- func (h *HookedApiOperation) InitOperation(ctx context.Context, opReq *operation.OperationRequest) (operation.ApiOperation, *errors.AsyncError)
- func (h *HookedApiOperation) Run(ctx context.Context) *errors.AsyncError
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 (h *HookedApiOperation) AfterInitOperation(ctx context.Context, op operation.ApiOperation, req *operation.OperationRequest, err *errors.AsyncError) *errors.AsyncError
func (*HookedApiOperation) AfterRun ¶
func (h *HookedApiOperation) AfterRun(ctx context.Context, op operation.ApiOperation, err *errors.AsyncError) *errors.AsyncError
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 (h *HookedApiOperation) BeforeRun(ctx context.Context, op operation.ApiOperation) *errors.AsyncError
func (*HookedApiOperation) GuardConcurrency ¶
func (h *HookedApiOperation) GuardConcurrency(ctx context.Context, e entity.Entity) *errors.AsyncError
func (*HookedApiOperation) InitOperation ¶
func (h *HookedApiOperation) InitOperation(ctx context.Context, opReq *operation.OperationRequest) (operation.ApiOperation, *errors.AsyncError)
func (*HookedApiOperation) Run ¶
func (h *HookedApiOperation) Run(ctx context.Context) *errors.AsyncError
Click to show internal directories.
Click to hide internal directories.