Skip to content

postgres ​

go
import "github.com/prescriptoo/prescriptoo-api/services/authorization/internal/adapters/postgres"

Package postgres persists authorization in normalized, scope-constrained tables.

Index ​

func New ​

go
func New(db *pgxpool.Pool, supplied ...audit.TransactionalRecorderFactory) ports.Repository

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
}

func (*Repository) Read ​

go
func (r *Repository) Read(ctx context.Context, scope p.Scope, fn func(*domain.State) error) error

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)

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) error

Write serializes and atomically persists a scope mutation.

Generated by gomarkdoc

Documentation follows the source. Planned contracts are marked explicitly.