Skip to content

postgres ​

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

Package postgres implements doctor profile persistence.

Index ​

func NewProfileRepository ​

go
func NewProfileRepository(db *pgxpool.Pool) ports.ProfileRepository

NewProfileRepository constructs a PostgreSQL profile reader.

type Catalogs ​

Catalogs persists professional reference data owned by Doctor.

go
type Catalogs struct{ DB *pgxpool.Pool }

func (*Catalogs) Create ​

go
func (r *Catalogs) Create(ctx context.Context, kind p.CatalogKind, values p.CatalogValues) (*p.CatalogEntry, error)

Create validates and inserts a reference term.

func (*Catalogs) Delete ​

go
func (r *Catalogs) Delete(ctx context.Context, kind p.CatalogKind, id string) error

Delete removes an unreferenced term; foreign keys protect dependencies.

func (*Catalogs) Get ​

go
func (r *Catalogs) Get(ctx context.Context, kind p.CatalogKind, id string) (*p.CatalogEntry, error)

Get loads one catalog entry.

func (*Catalogs) List ​

go
func (r *Catalogs) List(ctx context.Context, kind p.CatalogKind, options p.CatalogListOptions) ([]p.CatalogEntry, error)

List returns entries in stable alphabetical order.

func (*Catalogs) Update ​

go
func (r *Catalogs) Update(ctx context.Context, kind p.CatalogKind, id string, values p.CatalogValues) (*p.CatalogEntry, error)

Update replaces editable fields while preserving reference IDs.

type FinalPrescriptionProfiles ​

FinalPrescriptionProfiles exposes transaction-bound patient/profile checks to Prescription through shared ports.

go
type FinalPrescriptionProfiles struct{ DB *pgxpool.Pool }

func (FinalPrescriptionProfiles) FinalPrescriptionPatientMRN ​

go
func (p FinalPrescriptionProfiles) FinalPrescriptionPatientMRN(ctx context.Context, tx pgx.Tx, id, org string) (string, error)

FinalPrescriptionPatientMRN reads only an existing patient in the captured organization.

func (FinalPrescriptionProfiles) VerifyFinalDoctorSnapshot ​

go
func (p FinalPrescriptionProfiles) VerifyFinalDoctorSnapshot(ctx context.Context, tx pgx.Tx, s c.FinalDoctorSnapshot) error

VerifyFinalDoctorSnapshot locks the profile and compares its current professional display fields.

type PadSettings ​

PadSettings stores one account-scoped design per Doctor account.

go
type PadSettings struct{ DB *pgxpool.Pool }

func (PadSettings) Get ​

go
func (r PadSettings) Get(ctx context.Context, userID string) (*domain.PadSettings, error)

Get returns nil without an error when the account has no saved design.

func (PadSettings) Save ​

go
func (r PadSettings) Save(ctx context.Context, doctorID, userID string, expected *int64, resourceVersion int, value domain.PadSettingsValue) (*domain.PadSettings, error)

Save uses one conditional statement, so concurrent writers cannot both win the same revision.

type PatientRepository ​

PatientRepository persists Patient-owned records and retry state.

go
type PatientRepository struct {
    // contains filtered or unexported fields
}

func NewPatientRepository ​

go
func NewPatientRepository(db *pgxpool.Pool) *PatientRepository

NewPatientRepository creates a PostgreSQL patient repository and fails closed without a database.

func (*PatientRepository) Create ​

go
func (r *PatientRepository) Create(ctx context.Context, x *types.PatientProfile) error

Create inserts a patient profile.

func (*PatientRepository) FindRequest ​

go
func (r *PatientRepository) FindRequest(ctx context.Context, user, org, key string) (string, string, error)

FindRequest looks up a scoped create retry fingerprint and result.

func (*PatientRepository) Get ​

go
func (r *PatientRepository) Get(ctx context.Context, id, org string, lock bool) (*types.PatientProfile, error)

Get reads a profile constrained to its authorized organization.

func (*PatientRepository) List ​

go
func (r *PatientRepository) List(ctx context.Context, q ports.ListQuery) (*ports.ListPage, error)

List counts and queries authorized rows before applying the keyset boundary.

func (*PatientRepository) NextMRN ​

go
func (r *PatientRepository) NextMRN(ctx context.Context, org string) (string, error)

NextMRN atomically allocates the next organization-local number.

func (*PatientRepository) SaveRequest ​

go
func (r *PatientRepository) SaveRequest(ctx context.Context, user, org, key, f, id string, now time.Time) error

SaveRequest records the committed create result in the business transaction.

func (*PatientRepository) Scope ​

go
func (r *PatientRepository) Scope(ctx context.Context, id string) (ports.Scope, error)

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

func (*PatientRepository) Update ​

go
func (r *PatientRepository) Update(ctx context.Context, x *types.PatientProfile, expected int64) error

Update persists an effective patch at the expected version.

type PatientUnitOfWork ​

PatientUnitOfWork commits patient business changes and provider effects atomically.

go
type PatientUnitOfWork struct{ DB *pgxpool.Pool }

func (PatientUnitOfWork) WithinTransaction ​

go
func (w PatientUnitOfWork) WithinTransaction(ctx context.Context, fn func(ports.PatientTransaction) error) error

WithinTransaction runs patient persistence and provider effects on one transaction.

type ProfessionalSelections ​

ProfessionalSelections owns the atomic profile-to-catalog relationship write.

go
type ProfessionalSelections struct{ DB *pgxpool.Pool }

func (ProfessionalSelections) ReplaceProfessionalSelections ​

go
func (r ProfessionalSelections) ReplaceProfessionalSelections(ctx context.Context, doctorID string, input usecase.ProfessionalSelections) error

ReplaceProfessionalSelections serializes edits and atomically replaces relationships.

type ProfilePatches ​

ProfilePatches serializes partial edits with other professional selection writes.

go
type ProfilePatches struct{ DB *pgxpool.Pool }

func (ProfilePatches) PatchProfile ​

go
func (r ProfilePatches) PatchProfile(ctx context.Context, doctorID, userID string, p usecase.PatchMyDoctorProfileParams) (*domain.Profile, error)

PatchProfile preserves omissions against the locked current profile. A failed license or hierarchy constraint rolls back all supplied fields together.

type Registration ​

Registration coordinates one transaction using each service's owned capability.

go
type Registration struct {
    DB          *pgxpool.Pool
    Identity    identity.TransactionalRegistration
    Invitations organization.DoctorInvitationRedeemer
}

func (Registration) Register ​

go
func (r Registration) Register(ctx context.Context, input usecase.RegistrationParams) (*usecase.RegistrationResult, error)

Register commits identity, profile, and optional invitation/affiliation together.

Generated by gomarkdoc

Documentation follows the source. Planned contracts are marked explicitly.