Skip to content

ports ​

go
import "github.com/prescriptoo/prescriptoo-api/services/patient/internal/ports"

Package ports defines patient persistence transaction boundaries.

Index ​

type ListPage ​

ListPage includes the authorized total before the cursor boundary is applied.

go
type ListPage struct {
    Items      []domain.Profile
    TotalItems int
}

type ListQuery ​

ListQuery contains trusted access predicates and a keyset boundary.

go
type ListQuery struct {
    OrganizationID, ActorID, Query string
    ReadOwn, ReadOthers            bool
    Limit                          int
    BeforeTime                     time.Time
    BeforeID                       string
}

type Repository ​

Repository persists Patient-owned records and retry state.

go
type Repository interface {
    Scope(context.Context, string) (Scope, error)
    Get(context.Context, string, string, bool) (*domain.Profile, error)
    List(context.Context, ListQuery) (*ListPage, error)
    Create(context.Context, *domain.Profile) error
    Update(context.Context, *domain.Profile, int64) error
    NextMRN(context.Context, string) (string, error)
    FindRequest(context.Context, string, string, string) (string, string, error)
    SaveRequest(context.Context, string, string, string, string, string, time.Time) error
}

type Scope ​

Scope contains only the stored facts needed to establish patient access.

go
type Scope struct{ OrganizationID, CreatedByUserID string }

type Transaction ​

Transaction binds patient persistence to a caller-owned provider transaction.

go
type Transaction struct {
    Repository Repository
    Tx         pgx.Tx
}

type UnitOfWork ​

UnitOfWork commits patient business changes and provider effects atomically.

go
type UnitOfWork interface {
    WithinTransaction(context.Context, func(Transaction) error) error
}

Generated by gomarkdoc

Documentation follows the source. Planned contracts are marked explicitly.