Skip to content

postgres ​

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

Package postgres provides PostgreSQL driven adapter implementations.

Index ​

func NewPrescriptionRepository ​

go
func NewPrescriptionRepository() ports.PrescriptionRepository

NewPrescriptionRepository returns an in-memory stub implementation.

func NewSuggestionAdviceRepository ​

go
func NewSuggestionAdviceRepository(db *pgxpool.Pool) ports.SuggestionAdviceRepository

NewSuggestionAdviceRepository creates the advice adapter; nil supports offline schemas.

func NewSuggestionDiagnosisRepository ​

go
func NewSuggestionDiagnosisRepository(db *pgxpool.Pool) ports.SuggestionDiagnosisRepository

NewSuggestionDiagnosisRepository creates the diagnosis adapter; nil supports offline schemas.

func NewSuggestionInvestigationRepository ​

go
func NewSuggestionInvestigationRepository(db *pgxpool.Pool) ports.SuggestionInvestigationRepository

NewSuggestionInvestigationRepository creates the investigation adapter; nil supports offline schemas.

type ChiefComplaintReads ​

ChiefComplaintReads supplies the chief complaint repository port.

go
type ChiefComplaintReads struct{ Store *ClinicalStore }

func (ChiefComplaintReads) Get ​

go
func (r ChiefComplaintReads) Get(ctx context.Context, id string) (c.ChiefComplaint, error)

Get includes deleted records for administrator visibility.

func (ChiefComplaintReads) List ​

go
func (r ChiefComplaintReads) List(ctx context.Context, q c.CatalogQuery) (c.Page[c.ChiefComplaint], error)

List returns the filtered management page.

func (ChiefComplaintReads) Suggest ​

go
func (r ChiefComplaintReads) Suggest(ctx context.Context, q c.SuggestionQuery) ([]c.ChiefComplaint, error)

Suggest returns active live choices in relevance/default order.

type ClinicalStore ​

ClinicalStore implements shared clinical storage ports and audited mutations. A nil database supports schema generation; writes require a real Audit provider.

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

func (*ClinicalStore) SuggestChiefComplaintsPage ​

go
func (s *ClinicalStore) SuggestChiefComplaintsPage(ctx context.Context, q c.ScopedSuggestionQuery) (c.Page[c.ChiefComplaint], error)

SuggestChiefComplaintsPage returns active vocabulary with relevance-ranked keyset paging.

func (*ClinicalStore) SuggestHistoryPage ​

go
func (s *ClinicalStore) SuggestHistoryPage(ctx context.Context, q c.ScopedSuggestionQuery) (c.Page[c.HistorySuggestion], error)

SuggestHistoryPage restricts active vocabulary to one required history category.

func (*ClinicalStore) WithinMutation ​

go
func (s *ClinicalStore) WithinMutation(ctx context.Context, actor c.MutationActor, fn func(ports.Mutation) error) error

WithinMutation serializes seed/catalog writes and commits audit with the business change.

type FinalPrescriptions ​

FinalPrescriptions is a real PostgreSQL immutable document repository and transaction runner.

go
type FinalPrescriptions struct {
    DB *pgxpool.Pool
    // contains filtered or unexported fields
}

func NewFinalPrescriptions ​

go
func NewFinalPrescriptions(db *pgxpool.Pool) *FinalPrescriptions

NewFinalPrescriptions configures reads and transaction composition; nil fails closed at runtime.

func (*FinalPrescriptions) Create ​

go
func (r *FinalPrescriptions) Create(ctx context.Context, in c.SaveFinalPrescriptionInput, m c.FinalPrescriptionMetadata, mrn string, products []c.FinalCanonicalProduct) error

Create stores the entire sanitized document and canonical product provenance together.

func (*FinalPrescriptions) FindRequest ​

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

FindRequest returns the original committed result; retry state is retained without automatic expiration.

func (*FinalPrescriptions) Get ​

go
func (r *FinalPrescriptions) Get(ctx context.Context, id, org string) (*c.FinalPrescriptionRecord, error)

Get reads one organization-bound document without joining mutable profiles/catalogues.

func (*FinalPrescriptions) List ​

go
func (r *FinalPrescriptions) List(ctx context.Context, q ports.FinalPrescriptionListQuery) ([]c.FinalPrescriptionSummary, error)

List applies literal search/date/patient predicates before newest-first keyset pagination.

func (*FinalPrescriptions) NextNumber ​

go
func (r *FinalPrescriptions) NextNumber(ctx context.Context, date string) (string, error)

NextNumber uses a database sequence; rollback may leave gaps but cannot reuse an allocated number.

func (*FinalPrescriptions) SaveRequest ​

go
func (r *FinalPrescriptions) SaveRequest(ctx context.Context, in c.SaveFinalPrescriptionInput, m c.FinalPrescriptionMetadata) error

SaveRequest records a successful save within the document transaction.

func (*FinalPrescriptions) WithinFinalPrescriptionTransaction ​

go
func (r *FinalPrescriptions) WithinFinalPrescriptionTransaction(ctx context.Context, fn func(ports.FinalPrescriptionTransaction) error) error

WithinFinalPrescriptionTransaction commits only after all provider and audit effects succeed.

type HistoryReads ​

HistoryReads supplies the history repository port.

go
type HistoryReads struct{ Store *ClinicalStore }

func (HistoryReads) Get ​

go
func (r HistoryReads) Get(ctx context.Context, id string) (c.HistorySuggestion, error)

Get includes deleted history records.

func (HistoryReads) List ​

go
func (r HistoryReads) List(ctx context.Context, q c.HistoryCatalogQuery) (c.Page[c.HistorySuggestion], error)

List permits all categories when Category is empty.

func (HistoryReads) Suggest ​

go
func (r HistoryReads) Suggest(ctx context.Context, q c.HistorySuggestionQuery) ([]c.HistorySuggestion, error)

Suggest restricts choices to the required category.

Generated by gomarkdoc

Documentation follows the source. Planned contracts are marked explicitly.