Documentation
¶
Overview ¶
Package postgres provides the PostgreSQL-backed implementation of the document.Repository port, built on native pgx.
Index ¶
- type Repository
- func (r *Repository) ExistsForCase(ctx context.Context, db pgxtx.DBTX, caseID uuid.UUID, templateName string) (bool, error)
- func (r *Repository) GetByID(ctx context.Context, db pgxtx.DBTX, id uuid.UUID) (*document.Document, error)
- func (r *Repository) GetBySourceKey(ctx context.Context, db pgxtx.DBTX, key string) (*document.Document, error)
- func (r *Repository) GetByVerificationKey(ctx context.Context, db pgxtx.DBTX, key string) (*document.Document, error)
- func (r *Repository) Insert(ctx context.Context, db pgxtx.DBTX, d *document.Document) error
- func (r *Repository) ListByCase(ctx context.Context, db pgxtx.DBTX, caseID uuid.UUID) ([]document.Document, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository struct{}
Repository implements document.Repository using pgx. It is stateless: every method receives the pgxtx.DBTX to run against, so the caller decides whether to use a plain pool connection or an existing transaction.
func NewRepository ¶
func NewRepository() *Repository
NewRepository creates a stateless PostgreSQL-backed document repository.
func (*Repository) ExistsForCase ¶
func (r *Repository) ExistsForCase(ctx context.Context, db pgxtx.DBTX, caseID uuid.UUID, templateName string) (bool, error)
ExistsForCase reports whether caseID has a document of templateName.
func (*Repository) GetByID ¶
func (r *Repository) GetByID(ctx context.Context, db pgxtx.DBTX, id uuid.UUID) (*document.Document, error)
GetByID retrieves a single document by its primary key.
func (*Repository) GetBySourceKey ¶
func (r *Repository) GetBySourceKey(ctx context.Context, db pgxtx.DBTX, key string) (*document.Document, error)
GetBySourceKey retrieves the document whose source key is key. An empty key never matches: documents stored without one have a NULL source_key.
func (*Repository) GetByVerificationKey ¶
func (r *Repository) GetByVerificationKey(ctx context.Context, db pgxtx.DBTX, key string) (*document.Document, error)
GetByVerificationKey retrieves the document whose verification key is key.