Skip to content

postgres ​

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

Package postgres provides PostgreSQL database driven adapter implementations.

Index ​

func NewPgAccountRepository ​

go
func NewPgAccountRepository(db *pgxpool.Pool) ports.AccountRepository

NewPgAccountRepository provides transactional account and email-token operations.

func NewPgSessionRepository ​

go
func NewPgSessionRepository(db *pgxpool.Pool) ports.SessionRepository

NewPgSessionRepository persists sessions and refresh-token history in PostgreSQL.

func NewPgUserRepository ​

go
func NewPgUserRepository(db sqlc.DBTX) ports.UserRepository

NewPgUserRepository returns a PostgreSQL implementation of ports.UserRepository.

type AccountStatusManager ​

AccountStatusManager owns the account lock, status mutation, session revocation and audit commit.

go
type AccountStatusManager struct {
    DB    *pgxpool.Pool
    Audit audit.TransactionalRecorderFactory
}

func (AccountStatusManager) ChangeAccountStatus ​

go
func (w AccountStatusManager) ChangeAccountStatus(ctx context.Context, input identitypublic.ChangeAccountStatusInput) (*identitypublic.Account, error)

ChangeAccountStatus commits account status, disabled-session revocation and audit recording together.

func (AccountStatusManager) LockActiveAccounts ​

go
func (w AccountStatusManager) LockActiveAccounts(ctx context.Context, tx pgx.Tx, ids []string) error

LockActiveAccounts validates active Identity accounts while holding their row locks in the caller-owned transaction. It neither starts nor commits a transaction; Organization retains these locks until affiliation and audit writes complete.

A concurrent suspension uses the same account lock, so the assignment either commits before suspension or observes the committed inactive state and fails. Verification does not participate in this account eligibility check.

type Provisioner ​

Provisioner atomically creates an Identity account and its initiating audit entry.

go
type Provisioner struct {
    DB    *pgxpool.Pool
    Audit audit.TransactionalRecorderFactory
}

func (Provisioner) Create ​

go
func (w Provisioner) Create(ctx context.Context, op audit.OperationContext, u *domain.User) error

Create commits account provisioning and its audit entry in one transaction.

Generated by gomarkdoc

Documentation follows the source. Planned contracts are marked explicitly.