datastore

package
v0.0.0-...-d8b21ba Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDocuments = errors.New("no results found")

Functions

func NewPage

func NewPage(format string) *api.Page

Types

type CategoryService

type CategoryService interface {
	All(ctx context.Context) ([]api.Category, error)
	Find(ctx context.Context, id string) (*api.Category, error)
	FindByPatient(ctx context.Context, id string) ([]api.Category, error)
	Add(ctx context.Context, category *api.Category) error
	Update(ctx context.Context, category *api.Category) error
}

type Counter

type Counter interface {
	Count(ctx context.Context, resource string) (int64, error)
}

type Cursor

type Cursor interface {
	Next(context.Context) bool
	Decodable

	// Close the cursor.
	Close(context.Context) error
}

type DatabaseConfig

type DatabaseConfig struct {
	Host string
	Port string
	Name string
}

func (DatabaseConfig) String

func (config DatabaseConfig) String() string

type Decodable

type Decodable interface {
	Decode(interface{}) error
	Err() error
}

type NotFoundError

type NotFoundError struct {
	Collection string
	Id         string
	Err        error
}

func NewNotFoundError

func NewNotFoundError(Id string, Collection string, Error error) *NotFoundError

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

func (*NotFoundError) Is

func (e *NotFoundError) Is(tgt error) bool

func (*NotFoundError) Unwrap

func (e *NotFoundError) Unwrap() error

type QueryOptions

type QueryOptions struct {
	Sort  map[string]int
	Skip  int64
	Limit int64
}

func NewQueryOptions

func NewQueryOptions() *QueryOptions

func (*QueryOptions) SetLimit

func (options *QueryOptions) SetLimit(value int64) *QueryOptions

func (*QueryOptions) SetSkip

func (options *QueryOptions) SetSkip(value int64) *QueryOptions

func (*QueryOptions) SetSort

func (options *QueryOptions) SetSort(key string) *QueryOptions

type Record

type Record struct {
	Id          primitive.ObjectID `bson:"_id"`
	*api.Record `bson:"inline"`
}

type RecordQuery

type RecordQuery bson.D

func NewRecordQuery

func NewRecordQuery(queryFuncs ...RecordQueryFunc) RecordQuery

type RecordQueryFunc

type RecordQueryFunc = func(query *RecordQuery)

func WithIds

func WithIds(queryIds []string) RecordQueryFunc

func WithNoContent

func WithNoContent() RecordQueryFunc

func WithPatientId

func WithPatientId(patientId string) RecordQueryFunc

func WithStatus

func WithStatus(status api.Status) RecordQueryFunc

type RecordService

type RecordService interface {
	All(ctx context.Context) ([]api.Record, error)
	Find(ctx context.Context, id string) (*api.Record, error)
	Query(ctx context.Context, query RecordQuery, queryOption ...*QueryOptions) ([]api.Record, error)
	Create(ctx context.Context, data api.CreateRecord, images []storage.Image, pdfData io.Reader) (*api.Record, error)
	Delete(ctx context.Context, id string) error
	Update(ctx context.Context, id string, record api.Record, updateOptions ...UpdateOption) (*api.Record, error)
	UpdatePages(ctx context.Context, id string, updates []api.PageUpdate) (*api.Record, error)
}

type TagService

type TagService interface {
	All(ctx context.Context) ([]string, error)
	ByPatient(ctx context.Context, id string) ([]string, error)
}

type UpdateOption

type UpdateOption = func(query bson.M)

func IfNotModifiedSince

func IfNotModifiedSince(modified time.Time) UpdateOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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