ProofedMesh/services/admin-api/internal/store/postgres.go
CTO Agent 65514559dc
Some checks failed
validate / Rego (opa fmt + opa test) (push) Successful in 12s
validate / JSON Schema (ajv) (push) Has been cancelled
services: add admin-api Go service (per-diem rates CRUD, in-memory + Postgres stub store, HTML templates, 13/13 go tests pass, go vet clean)
2026-10-25 17:28:14 +00:00

39 lines
1.4 KiB
Go

package store
import (
"context"
"errors"
"time"
"basicstack.de/proofedmesh/services/admin-api/internal/model"
)
// Postgres is the production RateStore. **Skeleton:** methods return
// errPGUnimplemented. When wiring, swap this struct's internals for a
// pgxpool.Pool and real queries. The SQL is already in db/trust/migrations/
// and the schema enforces every invariant that Memory enforces.
type Postgres struct {
// pool *pgxpool.Pool // kept out of go.mod in the skeleton
}
var errPGUnimplemented = errors.New("postgres store is a skeleton; use NewMemory for now")
func NewPostgres( /* conn string, logger */ ) (*Postgres, error) {
return &Postgres{}, nil
}
func (p *Postgres) List(ctx context.Context, f ListFilter) ([]model.Rate, error) {
return nil, errPGUnimplemented
}
func (p *Postgres) Get(ctx context.Context, rateID string) (model.Rate, error) {
return model.Rate{}, errPGUnimplemented
}
func (p *Postgres) Create(ctx context.Context, in model.NewRateInput, createdBy string, now time.Time) (model.Rate, error) {
return model.Rate{}, errPGUnimplemented
}
func (p *Postgres) Retire(ctx context.Context, rateID string, validTo time.Time, performedBy string, now time.Time) (model.Rate, error) {
return model.Rate{}, errPGUnimplemented
}
func (p *Postgres) AttachAttestation(ctx context.Context, rateID string, attestationRef string) error {
return errPGUnimplemented
}