40 lines
1.4 KiB
Go
40 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
|
||
|
|
}
|