vetinf

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnimalDB added in v0.1.2

type AnimalDB struct {
	// contains filtered or unexported fields
}

func (*AnimalDB) StreamAll added in v0.1.2

func (db *AnimalDB) StreamAll(ctx context.Context) (<-chan SmallAnimalRecord, <-chan error, int)

type Customer

type Customer struct {
	Meta                Meta   `dbf:"-"`
	ID                  int    `dbf:"knr" json:"id,omitempty" bson:"id,omitempty"`
	Group               string `dbf:"gruppe" json:"group,omitempty" bson:"group,omitempty"`
	Name                string `dbf:"name" json:"name,omitempty" bson:"name:omitempty"`
	Firstname           string `dbf:"vorname" json:"firstname,omitempty" bson:"firstname,omitempty"`
	Titel               string `dbf:"titel" json:"title,omitempty" bson:"title,omitempty"`
	Street              string `dbf:"strasse" json:"street,omitempty" bson:"street,omitempty"`
	CityCode            int    `dbf:"plz" json:"cityCode,omitempty" bson:"cityCode,omitempty"`
	City                string `dbf:"ort" json:"city,omitempty" bson:"city,omitempty"`
	Phone               string `dbf:"telefon" json:"phone,omitempty" bson:"phone,omitempty"`
	Extra               string `dbf:"zusatz" json:"extra,omitempty" bson:"extra,omitempty"`
	Salutation          string `dbf:"anrede" json:"salutation,omitempty" bson:"salutation,omitempty"`
	MobilePhone1        string `dbf:"handyx1" json:"mobilePhone1,omitempty" bson:"mobilePhone1,omitempty"`
	MobilePhone2        string `dbf:"handyx2" json:"mobilePhone2,omitempty" bson:"mobilePhone2,omitempty"`
	Phone2              string `dbf:"telefonx1" json:"phone2,omitempty" bson:"phone2,omitempty"`
	Mail                string `dbf:"emailx1" json:"mail,omitempty" bson:"mail,omitempty"`
	SecondaryID         string `dbf:"knr2" json:"secondaryId,omitempty" bson:"secondaryId,omitempty"`
	VaccinationReminder string `dbf:"impfung" json:"vaccinationReminder,omitempty" bson:"vaccinationReminder,omitempty"`
}

Customer represents customer data stored in the vetkldat.dbf file

func (Customer) String

func (c Customer) String() string

func (Customer) WantsVaccinationReminder added in v0.1.5

func (customer Customer) WantsVaccinationReminder() bool

type CustomerDB

type CustomerDB struct {
	// contains filtered or unexported fields
}

CustomerDB wraps the vetkldat.dbf file

func (*CustomerDB) All

func (db *CustomerDB) All() ([]Customer, error)

All loads all customers stored in vetkldat.dbf

func (*CustomerDB) ByID

func (db *CustomerDB) ByID(id int) (*Customer, error)

ByID loads a customer entry by it's ID

func (*CustomerDB) PrintFields

func (db *CustomerDB) PrintFields()

PrintFields prints all supported fields to stdout

func (*CustomerDB) StreamAll

func (db *CustomerDB) StreamAll(ctx context.Context) (<-chan Customer, <-chan error, int)

StreamAll streams all customers found in db.

type Infdat

type Infdat struct {
	// Fs provides access to the file-system on which the Infdat
	// directory is stored
	afero.Fs

	// RootPath is the path to the Infdat directory stored on Fs
	RootPath string
}

Infdat represents the Infdat folder of a VetInf installation. If VetInf is used with multiple hosts, make sure to use the shared Infdat directory instead of per-host one. Infdat also implements the afero.Fs interface but bound to the actual installation directory

func OpenCachedFs

func OpenCachedFs(root string, cacheTime time.Duration, base afero.Fs) *Infdat

OpenCachedFs is like OpenReadonlyFs but provides a file cache where each file accessed is pulled into an overlay FS (memory mapped) and subsequent reads are performed on the cached file (as long as the file does not exceed cacheTime). See afero.NewCacheOnReadFs for more information

func OpenFs

func OpenFs(root string, fs afero.Fs) *Infdat

OpenFs opens an VetInf installation directory located at root on fs

func OpenReadonlyFs

func OpenReadonlyFs(root string, fs afero.Fs) *Infdat

OpenReadonlyFs is like OpenFs but denies any write operations

func (*Infdat) AnimalDB added in v0.1.2

func (inf *Infdat) AnimalDB(encoding string) (*AnimalDB, error)

func (*Infdat) CustomerDB

func (inf *Infdat) CustomerDB(encoding string) (*CustomerDB, error)

CustomerDB opens the customer DBase file (vetkldat.dbf)

type Meta added in v0.1.2

type Meta struct {
	Deleted bool
}

type SmallAnimalRecord added in v0.1.2

type SmallAnimalRecord struct {
	Meta Meta `dbf:"-"`

	CustomerID    int    `dbf:"knr" json:"knr" bson:"knr"`
	Size          string `dbf:"grossklein" json:"size" bson:"size"`
	Species       string `dbf:"tierart" json:"species" bson:"species"`
	Breed         string `dbf:"rasse" json:"breed" bson:"breed"`
	Gender        string `dbf:"geschlecht" json:"gender" bson:"gender"`
	Name          string `dbf:"name" json:"name" bson:"name"`
	Birthday      string `dbf:"gebdat" json:"birthday" bson:"birthday"`
	SpecialDetail string `dbf:"besonderes" json:"specialDetail" bson:"specialDetail"`
	AnimalID      string `dbf:"tilfdnr" json:"animalId" bson:"animalId"`
	Extra1        string `dbf:"mehr1" json:"extra1" bson:"extra1"`
	Extra2        string `dbf:"mehr2" json:"extra2" bson:"extra2"`
	Extra3        string `dbf:"mehr3" json:"extra3" bson:"extra3"`
	Extra4        string `dbf:"mehr4" json:"extra4" bson:"extra4"`
	Extra5        string `dbf:"mehr5" json:"extra5" bson:"extra5"`
	Extra6        string `dbf:"mehr6" json:"extra6" bson:"extra6"`
	Extra7        string `dbf:"mehr7" json:"extra7" bson:"extra7"`
	Extra8        string `dbf:"mehr8" json:"extra8" bson:"extra8"`
	Extra9        string `dbf:"mehr9" json:"extra9" bson:"extra9"`
	Extra10       string `dbf:"mehr10" json:"extra10" bson:"extra10"`
	Color         string `dbf:"farbe" json:"color" bson:"color"`
	ChipNumber    string `dbf:"chipnr" json:"chipNumber" bson:"chipNumber"`
}

Jump to

Keyboard shortcuts

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