postgres
go
import "github.com/prescriptoo/prescriptoo-api/services/authorization/internal/adapters/postgres"1
Package postgres persists authorization in normalized, scope-constrained tables.
Index
- func New(db *pgxpool.Pool, supplied ...audit.TransactionalRecorderFactory) ports.Repository
- type Repository
- func (r *Repository) Read(ctx context.Context, scope p.Scope, fn func(*domain.State) error) error
- func (r *Repository) ReadTransaction(ctx context.Context, tx pgx.Tx, scope p.Scope) (*domain.State, error)
- func (r *Repository) Write(ctx context.Context, scope p.Scope, fn func(*domain.State, sub.SubscriptionService) error) error
func New
go
func New(db *pgxpool.Pool, supplied ...audit.TransactionalRecorderFactory) ports.Repository1
New constructs the service with its required persistence and membership capabilities.
type Repository
Repository stores scoped authorization state in PostgreSQL.
go
type Repository struct {
Subscriptions sub.TransactionServices
Organizations org.BillingOrganizations
// contains filtered or unexported fields
}1
2
3
4
5
2
3
4
5
func (*Repository) Read
go
func (r *Repository) Read(ctx context.Context, scope p.Scope, fn func(*domain.State) error) error1
Read evaluates a callback against a consistent read-only scope snapshot.
func (*Repository) ReadTransaction
go
func (r *Repository) ReadTransaction(ctx context.Context, tx pgx.Tx, scope p.Scope) (*domain.State, error)1
ReadTransaction reads grants on the connection holding the organization lock.
func (*Repository) Write
go
func (r *Repository) Write(ctx context.Context, scope p.Scope, fn func(*domain.State, sub.SubscriptionService) error) error1
Write serializes and atomically persists a scope mutation.
Generated by gomarkdoc