patientdb

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CollectionName = "patients"

Variables

View Source
var ErrNotFound = errors.New("patient not found")

Functions

func RecordHash

func RecordHash(r v1alpha.PatientRecord) string

RecordHash returns a hash that represents the record and may be used for change detection.

Types

type Database

type Database interface {
	CreatePatient(ctx context.Context, record *v1alpha.PatientRecord) error
	Search(ctx context.Context, opts *SearchOptions) ([]v1alpha.PatientRecord, error)
	UpdatePatient(ctx context.Context, record *v1alpha.PatientRecord) error
	DeletePatient(ctx context.Context, id string) error
	ByCustomerAndAnimalID(ctx context.Context, source string, cid string, aid string) (*v1alpha.PatientRecord, error)
	Stats() *dbutils.Stats
}

func NewWithClient

func NewWithClient(ctx context.Context, dbName string, cli *mongo.Client) (Database, error)

type SearchOptions

type SearchOptions struct {
	dbutils.SimpleQueryBuilder
}

func (*SearchOptions) ByAnimalNumber

func (opts *SearchOptions) ByAnimalNumber(id string) *SearchOptions

func (*SearchOptions) ByCustomer

func (opts *SearchOptions) ByCustomer(source string, id string) *SearchOptions

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL