package app
import "github.com/go-arrower/arrower/app"
Package app provides common decorators for use cases in the application layer.
Index ¶
- Constants
- func PassedValidation(ctx context.Context) bool
- type Command
- func NewInstrumentedCommand[C any]( traceProvider trace.TracerProvider, meterProvider metric.MeterProvider, logger alog.Logger, cmd Command[C], ) Command[C]
- func NewLoggedCommand[C any](logger alog.Logger, cmd Command[C]) Command[C]
- func NewMeteredCommand[C any](meterProvider metric.MeterProvider, req Command[C]) Command[C]
- func NewTracedCommand[C any](traceProvider trace.TracerProvider, cmd Command[C]) Command[C]
- func NewTxCommand[C any](pgx *pgxpool.Pool, cmd Command[C]) Command[C]
- func NewValidatedCommand[C any](validate *validator.Validate, cmd Command[C]) Command[C]
- func TestCommandHandler[C any](handlerFunc unaryHandlerFunc[C]) Command[C]
- func TestFailureCommandHandler[C any]() Command[C]
- func TestSuccessCommandHandler[C any]() Command[C]
- type Job
- func NewInstrumentedJob[J any]( traceProvider trace.TracerProvider, meterProvider metric.MeterProvider, logger alog.Logger, job Job[J], ) Job[J]
- func NewLoggedJob[J any](logger alog.Logger, job Job[J]) Job[J]
- func NewMeteredJob[J any](meterProvider metric.MeterProvider, req Job[J]) Job[J]
- func NewTracedJob[J any](traceProvider trace.TracerProvider, job Job[J]) Job[J]
- func NewValidatedJob[J any](validate *validator.Validate, job Job[J]) Job[J]
- func TestFailureJobHandler[J any]() Job[J]
- func TestJobHandler[J any](handlerFunc unaryHandlerFunc[J]) Job[J]
- func TestSuccessJobHandler[J any]() Job[J]
- type Query
- func NewInstrumentedQuery[Q any, Res any]( traceProvider trace.TracerProvider, meterProvider metric.MeterProvider, logger alog.Logger, query Query[Q, Res], ) Query[Q, Res]
- func NewLoggedQuery[Q any, Res any](logger alog.Logger, query Query[Q, Res]) Query[Q, Res]
- func NewMeteredQuery[Q any, Res any](meterProvider metric.MeterProvider, query Query[Q, Res]) Query[Q, Res]
- func NewTracedQuery[Q any, Res any](traceProvider trace.TracerProvider, query Query[Q, Res]) Query[Q, Res]
- func NewValidatedQuery[Q any, Res any](validate *validator.Validate, query Query[Q, Res]) Query[Q, Res]
- func TestFailureQueryHandler[Q any, Res any]() Query[Q, Res]
- func TestQueryHandler[Q any, Res any](handlerFunc dualHandlerFunc[Q, Res]) Query[Q, Res]
- func TestSuccessQueryHandler[Q any, Res any]() Query[Q, Res]
- type Request
- func NewInstrumentedRequest[Req any, Res any]( traceProvider trace.TracerProvider, meterProvider metric.MeterProvider, logger alog.Logger, cmd Request[Req, Res], ) Request[Req, Res]
- func NewLoggedRequest[Req any, Res any](logger alog.Logger, req Request[Req, Res]) Request[Req, Res]
- func NewMeteredRequest[Req any, Res any](meterProvider metric.MeterProvider, req Request[Req, Res]) Request[Req, Res]
- func NewTracedRequest[Req any, Res any](traceProvider trace.TracerProvider, req Request[Req, Res]) Request[Req, Res]
- func NewTxRequest[Req any, Res any](pgx *pgxpool.Pool, req Request[Req, Res]) Request[Req, Res]
- func NewValidatedRequest[Req any, Res any](validate *validator.Validate, req Request[Req, Res]) Request[Req, Res]
- func TestFailureRequestHandler[Req any, Res any]() Request[Req, Res]
- func TestRequestHandler[Req any, Res any](handlerFunc dualHandlerFunc[Req, Res]) Request[Req, Res]
- func TestSuccessRequestHandler[Req any, Res any]() Request[Req, Res]
Constants ¶
Functions ¶
func PassedValidation ¶
PassedValidation is a helper giving you feedback, if a request passed validation of this middleware. Use it in case you want to ensure that this middleware was called before continuing with your business logic. It can help to reduce the amount of "magic" that this middleware introduces to your code and safe guard you from a potential wrong setup of dependencies.
Types ¶
type Command ¶
Command produces side effects, e.g. mutate state.
func NewInstrumentedCommand ¶
func NewInstrumentedCommand[C any]( traceProvider trace.TracerProvider, meterProvider metric.MeterProvider, logger alog.Logger, cmd Command[C], ) Command[C]
NewInstrumentedCommand is a convenience helper for easy dependency setup. The order of dependencies represents the order of calling.
func NewLoggedCommand ¶
func NewMeteredCommand ¶
func NewMeteredCommand[C any](meterProvider metric.MeterProvider, req Command[C]) Command[C]
func NewTracedCommand ¶
func NewTracedCommand[C any](traceProvider trace.TracerProvider, cmd Command[C]) Command[C]
func NewTxCommand ¶
func NewValidatedCommand ¶
func TestCommandHandler ¶
func TestFailureCommandHandler ¶
func TestSuccessCommandHandler ¶
type Job ¶
Job produces side effects.
func NewInstrumentedJob ¶
func NewInstrumentedJob[J any]( traceProvider trace.TracerProvider, meterProvider metric.MeterProvider, logger alog.Logger, job Job[J], ) Job[J]
NewInstrumentedJob is a convenience helper for easy dependency setup. The order of dependencies represents the order of calling.
func NewLoggedJob ¶
func NewMeteredJob ¶
func NewMeteredJob[J any](meterProvider metric.MeterProvider, req Job[J]) Job[J]
func NewTracedJob ¶
func NewTracedJob[J any](traceProvider trace.TracerProvider, job Job[J]) Job[J]
func NewValidatedJob ¶
func TestFailureJobHandler ¶
func TestJobHandler ¶
func TestSuccessJobHandler ¶
type Query ¶
Query does not produce side effects and returns data.
func NewInstrumentedQuery ¶
func NewInstrumentedQuery[Q any, Res any]( traceProvider trace.TracerProvider, meterProvider metric.MeterProvider, logger alog.Logger, query Query[Q, Res], ) Query[Q, Res]
NewInstrumentedQuery is a convenience helper for easy dependency setup. The order of dependencies represents the order of calling.
func NewLoggedQuery ¶
func NewMeteredQuery ¶
func NewMeteredQuery[Q any, Res any](meterProvider metric.MeterProvider, query Query[Q, Res]) Query[Q, Res]
func NewTracedQuery ¶
func NewTracedQuery[Q any, Res any](traceProvider trace.TracerProvider, query Query[Q, Res]) Query[Q, Res]
func NewValidatedQuery ¶
func NewValidatedQuery[Q any, Res any](validate *validator.Validate, query Query[Q, Res]) Query[Q, Res]
func TestFailureQueryHandler ¶
func TestQueryHandler ¶
func TestSuccessQueryHandler ¶
type Request ¶
Request can produce side effects and return data.
func NewInstrumentedRequest ¶
func NewInstrumentedRequest[Req any, Res any]( traceProvider trace.TracerProvider, meterProvider metric.MeterProvider, logger alog.Logger, cmd Request[Req, Res], ) Request[Req, Res]
NewInstrumentedRequest is a convenience helper for easy dependency setup. The order of dependencies represents the order of calling.
func NewLoggedRequest ¶
func NewLoggedRequest[Req any, Res any](logger alog.Logger, req Request[Req, Res]) Request[Req, Res]
func NewMeteredRequest ¶
func NewMeteredRequest[Req any, Res any](meterProvider metric.MeterProvider, req Request[Req, Res]) Request[Req, Res]
func NewTracedRequest ¶
func NewTracedRequest[Req any, Res any](traceProvider trace.TracerProvider, req Request[Req, Res]) Request[Req, Res]
func NewTxRequest ¶
func NewValidatedRequest ¶
func NewValidatedRequest[Req any, Res any](validate *validator.Validate, req Request[Req, Res]) Request[Req, Res]
func TestFailureRequestHandler ¶
func TestRequestHandler ¶
func TestSuccessRequestHandler ¶
Source Files ¶
handlers.go logger.decorator.go metric.decorator.go testing.go tracer.decorator.go tx.decorator.go validation.decorator.go
- Version
- v0.0.0-20250311203644-ab26c1152cb4 (latest)
- Published
- Mar 11, 2025
- Platform
- linux/amd64
- Imports
- 16 packages
- Last checked
- 1 week ago –
Tools for package owners.