Documentation
¶
Overview ¶
Package operationpostgres provides a supported Postgres-backed operation repository.
Index ¶
- Variables
- func TenantIDFromContext(ctx context.Context) (string, bool)
- func WithTenantID(ctx context.Context, tenantID string) context.Context
- type Options
- type Store
- func (s *Store[T]) CreateOperation(ctx context.Context, operation operations.Operation[T]) error
- func (s *Store[T]) GetOperation(ctx context.Context, id string) (operations.Operation[T], bool, error)
- func (s *Store[T]) HealthChecker() ports.HealthChecker
- func (s *Store[T]) UpdateOperation(ctx context.Context, operation operations.Operation[T]) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidTable reports that a configured table name is not a safe SQL identifier. ErrInvalidTable = errors.New("invalid operation table") // ErrOperationNotFound reports that an operation row was not found for the tenant. ErrOperationNotFound = errors.New("operation not found") // ErrStoreNotConfigured reports that the store or pool was not configured. ErrStoreNotConfigured = errors.New("operation postgres store not configured") // ErrTenantRequired reports that an operation write/read was attempted without tenant context. ErrTenantRequired = errors.New("operation tenant id is required") )
Functions ¶
func TenantIDFromContext ¶
TenantIDFromContext returns the tenant ID stored by WithTenantID.
Types ¶
type Store ¶
type Store[T any] struct { Pool ports.DatabasePool // contains filtered or unexported fields }
Store persists pollable operation resources in Postgres.
func New ¶
func New[T any](pool ports.DatabasePool, opts Options) *Store[T]
New creates a Postgres-backed operation repository.
func (*Store[T]) CreateOperation ¶
CreateOperation inserts an operation resource for the tenant in ctx.
func (*Store[T]) GetOperation ¶
func (s *Store[T]) GetOperation(ctx context.Context, id string) (operations.Operation[T], bool, error)
GetOperation loads an operation resource for the tenant in ctx.
func (*Store[T]) HealthChecker ¶
func (s *Store[T]) HealthChecker() ports.HealthChecker
HealthChecker returns a Postgres operation dependency health checker.
func (*Store[T]) UpdateOperation ¶
UpdateOperation updates an operation resource for the tenant in ctx.
Click to show internal directories.
Click to hide internal directories.