Skip to content

public ​

go
import "github.com/prescriptoo/prescriptoo-api/services/medicine/public"

Package public defines medicine-owned catalog contracts and curated capabilities.

Index ​

Variables ​

Catalog errors are shared across the medicine capability boundary.

go
var (
    ErrNotFound     = errors.New("medicine catalog entry not found")
    ErrInvalidInput = errors.New("invalid medicine catalog input")
    ErrConflict     = errors.New("medicine catalog conflict")
    ErrUnavailable  = errors.New("medicine catalog is unavailable")
)

type Brand ​

Brand is a medicine-owned catalog record.

go
type Brand struct {
    Metadata
    Name           string `json:"name"`
    ManufacturerID string `json:"manufacturer_id"`
    GenericID      string `json:"generic_id"`
}

type CatalogEmpty ​

CatalogEmpty represents the bodyless intended deletion response.

go
type CatalogEmpty struct{}

type CatalogSummary ​

CatalogSummary supplies catalog display data without an extra lookup.

go
type CatalogSummary struct {
    ID   string `json:"id"`
    Name string `json:"name"`
}

type CreateBrandCapability ​

CreateBrandCapability exposes only the CreateBrand operation.

go
type CreateBrandCapability interface {
    CreateBrand(context.Context, CreateBrandInput) (*Brand, error)
}

type CreateBrandInput ​

CreateBrandInput carries credentials and editable parameters.

go
type CreateBrandInput struct {
    Authorization string
    Params        CreateBrandParams
}

type CreateBrandParams ​

CreateBrandParams contains client-editable catalog fields.

go
type CreateBrandParams struct {
    Name           string  `json:"name" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    ManufacturerID string  `json:"manufacturer_id" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    GenericID      string  `json:"generic_id" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Description    *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
    Status         string  `json:"status,omitempty" nullable:"false" enum:"active,inactive" default:"active"`
}

type CreateDrugCapability ​

CreateDrugCapability exposes only the CreateDrug operation.

go
type CreateDrugCapability interface {
    CreateDrug(context.Context, CreateDrugInput) (*Drug, error)
}

type CreateDrugInput ​

CreateDrugInput carries credentials and editable parameters.

go
type CreateDrugInput struct {
    Authorization string
    Params        CreateDrugParams
}

type CreateDrugParams ​

CreateDrugParams contains client-editable catalog fields.

go
type CreateDrugParams struct {
    Route              string   `json:"route,omitempty" nullable:"false" maxLength:"255"`
    TherapeuticClassID string   `json:"therapeutic_class_id,omitempty" nullable:"false" maxLength:"255"`
    Aliases            []string `json:"aliases,omitempty" nullable:"false" maxItems:"50"`
    IngredientIDs      []string `json:"ingredient_ids,omitempty" nullable:"false" maxItems:"20"`
    BrandID            string   `json:"brand_id" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Form               string   `json:"form" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Strength           string   `json:"strength" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Description        *string  `json:"description,omitempty" nullable:"true" maxLength:"2000"`
    Status             string   `json:"status,omitempty" nullable:"false" enum:"active,inactive" default:"active"`
}

type CreateGenericCapability ​

CreateGenericCapability exposes only the CreateGeneric operation.

go
type CreateGenericCapability interface {
    CreateGeneric(context.Context, CreateGenericInput) (*Generic, error)
}

type CreateGenericInput ​

CreateGenericInput carries credentials and editable parameters.

go
type CreateGenericInput struct {
    Authorization string
    Params        CreateGenericParams
}

type CreateGenericParams ​

CreateGenericParams contains client-editable catalog fields.

go
type CreateGenericParams struct {
    Name        string  `json:"name" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
    Status      string  `json:"status,omitempty" nullable:"false" enum:"active,inactive" default:"active"`
}

type CreateManufacturerCapability ​

CreateManufacturerCapability exposes only the CreateManufacturer operation.

go
type CreateManufacturerCapability interface {
    CreateManufacturer(context.Context, CreateManufacturerInput) (*Manufacturer, error)
}

type CreateManufacturerInput ​

CreateManufacturerInput carries credentials and editable parameters.

go
type CreateManufacturerInput struct {
    Authorization string
    Params        CreateManufacturerParams
}

type CreateManufacturerParams ​

CreateManufacturerParams contains client-editable catalog fields.

go
type CreateManufacturerParams struct {
    Name        string  `json:"name" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Description *string `json:"description,omitempty" nullable:"true" maxLength:"2000"`
    Status      string  `json:"status,omitempty" nullable:"false" enum:"active,inactive" default:"active"`
}

type DeleteBrandCapability ​

DeleteBrandCapability exposes only the DeleteBrand operation.

go
type DeleteBrandCapability interface {
    DeleteBrand(context.Context, RecordInput) (*CatalogEmpty, error)
}

type DeleteDrugCapability ​

DeleteDrugCapability exposes only the DeleteDrug operation.

go
type DeleteDrugCapability interface {
    DeleteDrug(context.Context, RecordInput) (*CatalogEmpty, error)
}

type DeleteGenericCapability ​

DeleteGenericCapability exposes only the DeleteGeneric operation.

go
type DeleteGenericCapability interface {
    DeleteGeneric(context.Context, RecordInput) (*CatalogEmpty, error)
}

type DeleteManufacturerCapability ​

DeleteManufacturerCapability exposes only the DeleteManufacturer operation.

go
type DeleteManufacturerCapability interface {
    DeleteManufacturer(context.Context, RecordInput) (*CatalogEmpty, error)
}

type Drug ​

Drug is a medicine-owned catalog record.

go
type Drug struct {
    Route              string         `json:"route"`
    TherapeuticClassID string         `json:"therapeutic_class_id"`
    CatalogueVersion   string         `json:"catalogue_version"`
    Aliases            []string       `json:"aliases" nullable:"false"`
    IngredientIDs      []string       `json:"ingredient_ids" nullable:"false"`
    QuickSigs          []DrugQuickSig `json:"quick_sigs" nullable:"false"`
    Metadata
    BrandID      string         `json:"brand_id"`
    Form         string         `json:"form"`
    Strength     string         `json:"strength"`
    Brand        CatalogSummary `json:"brand"`
    Generic      CatalogSummary `json:"generic"`
    Manufacturer CatalogSummary `json:"manufacturer"`
}

type DrugQuickSig ​

DrugQuickSig describes a curated clinician-selected preset; no patient-specific dose validation is implied.

go
type DrugQuickSig struct {
    ID           string `json:"id"`
    Label        string `json:"label"`
    Dose         string `json:"dose"`
    Frequency    string `json:"frequency"`
    Timing       string `json:"timing"`
    MealRelation string `json:"meal_relation"`
    Duration     string `json:"duration"`
}

type Generic ​

Generic is a medicine-owned catalog record.

go
type Generic struct {
    Metadata
    Name string `json:"name"`
}

type GetAdminBrandCapability ​

GetAdminBrandCapability exposes only the GetAdminBrand operation.

go
type GetAdminBrandCapability interface {
    GetAdminBrand(context.Context, RecordInput) (*Brand, error)
}

type GetAdminDrugCapability ​

GetAdminDrugCapability exposes only the GetAdminDrug operation.

go
type GetAdminDrugCapability interface {
    GetAdminDrug(context.Context, RecordInput) (*Drug, error)
}

type GetAdminGenericCapability ​

GetAdminGenericCapability exposes only the GetAdminGeneric operation.

go
type GetAdminGenericCapability interface {
    GetAdminGeneric(context.Context, RecordInput) (*Generic, error)
}

type GetAdminManufacturerCapability ​

GetAdminManufacturerCapability exposes only the GetAdminManufacturer operation.

go
type GetAdminManufacturerCapability interface {
    GetAdminManufacturer(context.Context, RecordInput) (*Manufacturer, error)
}

type GetBrandCapability ​

GetBrandCapability exposes only the GetBrand operation.

go
type GetBrandCapability interface {
    GetBrand(context.Context, RecordInput) (*Brand, error)
}

type GetDrugCapability ​

GetDrugCapability exposes only the GetDrug operation.

go
type GetDrugCapability interface {
    GetDrug(context.Context, RecordInput) (*Drug, error)
}

type GetGenericCapability ​

GetGenericCapability exposes only the GetGeneric operation.

go
type GetGenericCapability interface {
    GetGeneric(context.Context, RecordInput) (*Generic, error)
}

type GetManufacturerCapability ​

GetManufacturerCapability exposes only the GetManufacturer operation.

go
type GetManufacturerCapability interface {
    GetManufacturer(context.Context, RecordInput) (*Manufacturer, error)
}

type ListAdminBrandsCapability ​

ListAdminBrandsCapability exposes only the ListAdminBrands operation.

go
type ListAdminBrandsCapability interface {
    ListAdminBrands(context.Context, ListInput) (*Page[Brand], error)
}

type ListAdminDrugsCapability ​

ListAdminDrugsCapability exposes only the ListAdminDrugs operation.

go
type ListAdminDrugsCapability interface {
    ListAdminDrugs(context.Context, ListInput) (*Page[Drug], error)
}

type ListAdminGenericsCapability ​

ListAdminGenericsCapability exposes only the ListAdminGenerics operation.

go
type ListAdminGenericsCapability interface {
    ListAdminGenerics(context.Context, ListInput) (*Page[Generic], error)
}

type ListAdminManufacturersCapability ​

ListAdminManufacturersCapability exposes only the ListAdminManufacturers operation.

go
type ListAdminManufacturersCapability interface {
    ListAdminManufacturers(context.Context, ListInput) (*Page[Manufacturer], error)
}

type ListBrandsCapability ​

ListBrandsCapability exposes only the ListBrands operation.

go
type ListBrandsCapability interface {
    ListBrands(context.Context, ListInput) (*Page[Brand], error)
}

type ListDrugsCapability ​

ListDrugsCapability exposes only the ListDrugs operation.

go
type ListDrugsCapability interface {
    ListDrugs(context.Context, ListInput) (*Page[Drug], error)
}

type ListGenericsCapability ​

ListGenericsCapability exposes only the ListGenerics operation.

go
type ListGenericsCapability interface {
    ListGenerics(context.Context, ListInput) (*Page[Generic], error)
}

type ListInput ​

ListInput carries credentials separately from client-owned filters.

go
type ListInput struct {
    Authorization string
    Query         Query
}

type ListManufacturersCapability ​

ListManufacturersCapability exposes only the ListManufacturers operation.

go
type ListManufacturersCapability interface {
    ListManufacturers(context.Context, ListInput) (*Page[Manufacturer], error)
}

type Manufacturer ​

Manufacturer is a medicine-owned catalog record.

go
type Manufacturer struct {
    Metadata
    Name string `json:"name"`
}

type Metadata ​

Metadata contains server-owned identifiers and lifecycle timestamps.

go
type Metadata struct {
    ID          string     `json:"id"`
    Status      string     `json:"status" enum:"active,inactive"`
    Description *string    `json:"description,omitempty"`
    CreatedAt   time.Time  `json:"created_at"`
    UpdatedAt   time.Time  `json:"updated_at"`
    DeletedAt   *time.Time `json:"deleted_at,omitempty"`
}

type Page ​

Page is a newest-first cursor-paginated result.

go
type Page[T any] struct {
    Items       []T    `json:"items" nullable:"false"`
    NextCursor  string `json:"next_cursor,omitempty"`
    CurrentPage int    `json:"current_page"`
    PerPage     int    `json:"per_page"`
    TotalPages  int    `json:"total_pages"`
    TotalItems  int    `json:"total_items"`
}

type PatchBrandCapability ​

PatchBrandCapability exposes only the PatchBrand operation.

go
type PatchBrandCapability interface {
    PatchBrand(context.Context, PatchBrandInput) (*Brand, error)
}

type PatchBrandInput ​

PatchBrandInput carries credentials and editable parameters.

go
type PatchBrandInput struct {
    Authorization, ID string
    Params            PatchBrandParams
}

type PatchBrandParams ​

PatchBrandParams contains client-editable catalog fields.

go
type PatchBrandParams struct {
    Name           *string         `json:"name,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    ManufacturerID *string         `json:"manufacturer_id,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    GenericID      *string         `json:"generic_id,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Description    *string         `json:"description,omitempty" nullable:"true" maxLength:"2000"`
    Status         *string         `json:"status,omitempty" nullable:"false" enum:"active,inactive"`
    Supplied       map[string]bool `json:"-"`
}

func (*PatchBrandParams) UnmarshalJSON ​

go
func (p *PatchBrandParams) UnmarshalJSON(data []byte) error

UnmarshalJSON retains omission versus explicit description clearing.

type PatchDrugCapability ​

PatchDrugCapability exposes only the PatchDrug operation.

go
type PatchDrugCapability interface {
    PatchDrug(context.Context, PatchDrugInput) (*Drug, error)
}

type PatchDrugInput ​

PatchDrugInput carries credentials and editable parameters.

go
type PatchDrugInput struct {
    Authorization, ID string
    Params            PatchDrugParams
}

type PatchDrugParams ​

PatchDrugParams contains client-editable catalog fields.

go
type PatchDrugParams struct {
    Route              *string         `json:"route,omitempty" nullable:"false" maxLength:"255"`
    TherapeuticClassID *string         `json:"therapeutic_class_id,omitempty" nullable:"false" maxLength:"255"`
    Aliases            *[]string       `json:"aliases,omitempty" nullable:"false" maxItems:"50"`
    IngredientIDs      *[]string       `json:"ingredient_ids,omitempty" nullable:"false" maxItems:"20"`
    BrandID            *string         `json:"brand_id,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Form               *string         `json:"form,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Strength           *string         `json:"strength,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Description        *string         `json:"description,omitempty" nullable:"true" maxLength:"2000"`
    Status             *string         `json:"status,omitempty" nullable:"false" enum:"active,inactive"`
    Supplied           map[string]bool `json:"-"`
}

func (*PatchDrugParams) UnmarshalJSON ​

go
func (p *PatchDrugParams) UnmarshalJSON(data []byte) error

UnmarshalJSON retains omission versus explicit description clearing.

type PatchGenericCapability ​

PatchGenericCapability exposes only the PatchGeneric operation.

go
type PatchGenericCapability interface {
    PatchGeneric(context.Context, PatchGenericInput) (*Generic, error)
}

type PatchGenericInput ​

PatchGenericInput carries credentials and editable parameters.

go
type PatchGenericInput struct {
    Authorization, ID string
    Params            PatchGenericParams
}

type PatchGenericParams ​

PatchGenericParams contains client-editable catalog fields.

go
type PatchGenericParams struct {
    Name        *string         `json:"name,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Description *string         `json:"description,omitempty" nullable:"true" maxLength:"2000"`
    Status      *string         `json:"status,omitempty" nullable:"false" enum:"active,inactive"`
    Supplied    map[string]bool `json:"-"`
}

func (*PatchGenericParams) UnmarshalJSON ​

go
func (p *PatchGenericParams) UnmarshalJSON(data []byte) error

UnmarshalJSON retains omission versus explicit description clearing.

type PatchManufacturerCapability ​

PatchManufacturerCapability exposes only the PatchManufacturer operation.

go
type PatchManufacturerCapability interface {
    PatchManufacturer(context.Context, PatchManufacturerInput) (*Manufacturer, error)
}

type PatchManufacturerInput ​

PatchManufacturerInput carries credentials and editable parameters.

go
type PatchManufacturerInput struct {
    Authorization, ID string
    Params            PatchManufacturerParams
}

type PatchManufacturerParams ​

PatchManufacturerParams contains client-editable catalog fields.

go
type PatchManufacturerParams struct {
    Name        *string         `json:"name,omitempty" nullable:"false" minLength:"1" maxLength:"255" pattern:"\\S"`
    Description *string         `json:"description,omitempty" nullable:"true" maxLength:"2000"`
    Status      *string         `json:"status,omitempty" nullable:"false" enum:"active,inactive"`
    Supplied    map[string]bool `json:"-"`
}

func (*PatchManufacturerParams) UnmarshalJSON ​

go
func (p *PatchManufacturerParams) UnmarshalJSON(data []byte) error

UnmarshalJSON retains omission versus explicit description clearing.

Example

PATCH distinguishes an omitted field from explicit null. This example only decodes the public contract used by the catalog use cases.

go
package main

import (
	"encoding/json"
	"fmt"

	medicine "github.com/prescriptoo/prescriptoo-api/services/medicine/public"
)

func main() {
	var patch medicine.PatchManufacturerParams
	if err := json.Unmarshal([]byte(`{"description":null}`), &patch); err != nil {
		panic(err)
	}
	fmt.Println("description supplied:", patch.Supplied["description"])
	fmt.Println("description cleared:", patch.Description == nil)
	fmt.Println("name preserved:", !patch.Supplied["name"])
}

Output ​

description supplied: true
description cleared: true
name preserved: true

type Query ​

Query carries search, pagination and administrative visibility filters.

go
type Query struct {
    Q, Cursor, ManufacturerID, GenericID, BrandID, Form, Status, Deletion string
    Limit                                                                 int
}

type RecordInput ​

RecordInput carries credentials separately from the selected record.

go
type RecordInput struct{ Authorization, ID string }

type RestoreBrandCapability ​

RestoreBrandCapability exposes only the RestoreBrand operation.

go
type RestoreBrandCapability interface {
    RestoreBrand(context.Context, RecordInput) (*Brand, error)
}

type RestoreDrugCapability ​

RestoreDrugCapability exposes only the RestoreDrug operation.

go
type RestoreDrugCapability interface {
    RestoreDrug(context.Context, RecordInput) (*Drug, error)
}

type RestoreGenericCapability ​

RestoreGenericCapability exposes only the RestoreGeneric operation.

go
type RestoreGenericCapability interface {
    RestoreGeneric(context.Context, RecordInput) (*Generic, error)
}

type RestoreManufacturerCapability ​

RestoreManufacturerCapability exposes only the RestoreManufacturer operation.

go
type RestoreManufacturerCapability interface {
    RestoreManufacturer(context.Context, RecordInput) (*Manufacturer, error)
}

Generated by gomarkdoc

Documentation follows the source. Planned contracts are marked explicitly.