Documentation ¶
Index ¶
- func Open(user, pass, host, name string, port uint, sslMode string) (*sql.DB, error)
- type AddressService
- type OwnerAddressDTO
- type OwnerNameDTO
- type OwnerService
- type Password
- type PatientService
- type ProductService
- type RecordService
- type ReportService
- type SearchService
- type SimpleLovService
- func (s *SimpleLovService) GetAllBreedsBySpecies(ctx context.Context, speciesID uint64) (*lara.LOVItemList, error)
- func (s *SimpleLovService) GetAllGenders(ctx context.Context) (*lara.LOVItemList, error)
- func (s *SimpleLovService) GetAllSpecies(ctx context.Context) (*lara.LOVItemList, error)
- func (s *SimpleLovService) GetAllTitles(ctx context.Context) (*lara.LOVItemList, error)
- func (s *SimpleLovService) GetAllUnits(ctx context.Context) (*lara.LOVItemList, error)
- type TagService
- func (s *TagService) Create(ctx context.Context, t *lara.CreateTag) (uint64, error)
- func (s *TagService) Get(ctx context.Context, id uint64) (*lara.GetTag, error)
- func (s *TagService) GetPatientByTag(ctx context.Context, tagValue string) (*lara.PatientByTag, error)
- func (s *TagService) Update(ctx context.Context, id uint64, t *lara.UpdateTag) error
- type UserService
- func (s *UserService) Authenticate(ctx context.Context, login, password string) (*lara.User, error)
- func (s *UserService) Grant(ctx context.Context, login string, permissions []lara.PermissionType) error
- func (s *UserService) Register(ctx context.Context, login, password string, permissions []lara.PermissionType) error
- func (s *UserService) Revoke(ctx context.Context, login string, permissions []lara.PermissionType) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddressService ¶
AddressService is implementation of lara.AddressService using postgresql database
func (*AddressService) SearchCity ¶
func (s *AddressService) SearchCity(ctx context.Context, query string) (*lara.CityStreetList, error)
SearchCity is implementation of AddressService.SearchCity using postgresql database. TODO make search limit parametric
func (*AddressService) SearchStreetForCity ¶
func (s *AddressService) SearchStreetForCity(ctx context.Context, cityID uint64, query string) (*lara.CityStreetList, error)
SearchStreetForCity is implementation of AddressService.SearchStreetForCity using postgresql database
type OwnerAddressDTO ¶
type OwnerAddressDTO struct { City sql.NullString Street sql.NullString HouseNo sql.NullString }
OwnerAddressDTO is common DTO for formatted Owner's address retrieval
func (*OwnerAddressDTO) String ¶
func (o *OwnerAddressDTO) String() string
type OwnerNameDTO ¶
type OwnerNameDTO struct { FirstName sql.NullString LastName string Title sql.NullString }
OwnerNameDTO is common DTO for formatted Owner's name retrieval
func (*OwnerNameDTO) String ¶
func (o *OwnerNameDTO) String() string
type OwnerService ¶
OwnerService is implementation of lara.OwnerService using postgresql database
func (*OwnerService) Create ¶
func (s *OwnerService) Create(ctx context.Context, o *lara.CreateOwner) (uint64, error)
Create is implementation of OwnerService.Create using postgresql database. Creates new owner in database and returns its ID.
func (*OwnerService) Get ¶
Get is implementation of OwnerService.Get using postgresql database. Returns GetOwner data by ID.
func (*OwnerService) Update ¶
func (s *OwnerService) Update(ctx context.Context, id uint64, o *lara.UpdateOwner) error
Update is implementation of OwnerService.Update using postgresql database.
type Password ¶
type Password interface { Create(pass string) ([]byte, []byte, error) // hash, salt, err Check(pass string, salt, hash []byte) error }
Password is interface for passwords manipulation
type PatientService ¶
PatientService is implementation of lara.PatientService using postgresql database
func (*PatientService) Create ¶
func (s *PatientService) Create(ctx context.Context, p *lara.CreatePatient) (uint64, error)
Create is implementation of PatientService.Create using postgresql database.
func (*PatientService) Get ¶
func (s *PatientService) Get(ctx context.Context, id uint64) (*lara.GetPatient, error)
Get is implementation of PatientService.Get using postgresql database.
func (*PatientService) Update ¶
func (s *PatientService) Update(ctx context.Context, id uint64, p *lara.UpdatePatient) error
Update is implementation of PatientService.Update using postgresql database.
type ProductService ¶
ProductService is lara.ProductService implementation backed by postgresql
func (*ProductService) Search ¶
func (s *ProductService) Search(ctx context.Context, p *lara.ProductSearchRequest) (*lara.ProductSearchResult, error)
Search performs DB search according to ProductSearchRequest TODO make search limit parametric
type RecordService ¶
RecordService is implementation of lara.RecordService using postgresql database
func (*RecordService) Create ¶
func (s *RecordService) Create(ctx context.Context, r *lara.CreateRecord) (uint64, error)
Create is implementation of RecordService.Create using postgresql database.
func (*RecordService) Update ¶
func (s *RecordService) Update(ctx context.Context, id uint64, r *lara.UpdateRecord) error
Update is implementation of RecordService.Update using postgresql database.
type ReportService ¶
ReportService is lara.ReportService implementation backed by postgresql
func (*ReportService) GetIncomeStatistics ¶
func (s *ReportService) GetIncomeStatistics(ctx context.Context, r *lara.ReportRequest) (*lara.IncomeStatistics, error)
GetIncomeStatistics counts records and income for specified time period
TODO: better query - all SUMs in one query - over months SELECT extract(year FROM r.rec_date) AS yr,
extract(month FROM r.rec_date) AS mon, sum(case when r.billed = true then ri.item_price else 0.0 end) AS "Billed", sum(case when r.billed = false then ri.item_price else 0.0 end) AS "Not Billed", sum(ri.item_price) AS "Total" FROM record r JOIN record_item ri on ri.record_id = r.id GROUP BY yr, mon ORDER by yr, mon;
type SearchService ¶
SearchService is lara.SearchService implementation backed by postgresql
func (*SearchService) Search ¶
func (s *SearchService) Search(ctx context.Context, q string) (*lara.SearchResult, error)
Search performs DB search of "q" string in owner/pet records TODO make search limit parametric
type SimpleLovService ¶
SimpleLovService is implementation of lara.TitleService, lara.UnitService, lara.GenderService, lara.SpeciesService, lara.BreedService using postgresql database.
func (*SimpleLovService) GetAllBreedsBySpecies ¶
func (s *SimpleLovService) GetAllBreedsBySpecies(ctx context.Context, speciesID uint64) (*lara.LOVItemList, error)
GetAllBreedsBySpecies is implementation of BreedService.GetAllBreedsBySpecies using postgresql database.
func (*SimpleLovService) GetAllGenders ¶
func (s *SimpleLovService) GetAllGenders(ctx context.Context) (*lara.LOVItemList, error)
GetAllGenders is implementation of GenderService.GetAllGenders using postgresql database.
func (*SimpleLovService) GetAllSpecies ¶
func (s *SimpleLovService) GetAllSpecies(ctx context.Context) (*lara.LOVItemList, error)
GetAllSpecies is implementation of SpeciesService.GetAllSpecies using postgresql database.
func (*SimpleLovService) GetAllTitles ¶
func (s *SimpleLovService) GetAllTitles(ctx context.Context) (*lara.LOVItemList, error)
GetAllTitles is implementation of TitleService.GetAllTitles using postgresql database.
func (*SimpleLovService) GetAllUnits ¶
func (s *SimpleLovService) GetAllUnits(ctx context.Context) (*lara.LOVItemList, error)
GetAllUnits is implementation of UnitService.GetAllUnits using postgresql database.
type TagService ¶
TagService is lara.TagService implementation backed by postgresql
func (*TagService) Create ¶
Create is implementation of TagService.Create using postgresql database.
func (*TagService) GetPatientByTag ¶
func (s *TagService) GetPatientByTag(ctx context.Context, tagValue string) (*lara.PatientByTag, error)
GetPatientByTag is implementation of TagService.GetPatientByTag using postgresql database.
type UserService ¶
UserService is lara.UserService implementation backed by postgresql
func (*UserService) Authenticate ¶
Authenticate checks password for given login and returns User structure Method Desn't wrap errors, that it wasn't possible to find out, whether password was incorrect, or login didn't exist. This method logs *all* errors and transforms them to unauthorizedError for http layer
func (*UserService) Grant ¶
func (s *UserService) Grant(ctx context.Context, login string, permissions []lara.PermissionType) error
Grant supplies user with a specified list of permissions
func (*UserService) Register ¶
func (s *UserService) Register(ctx context.Context, login, password string, permissions []lara.PermissionType) error
Register creates new user in database. If user already exists, error is returned.
func (*UserService) Revoke ¶
func (s *UserService) Revoke(ctx context.Context, login string, permissions []lara.PermissionType) error
Revoke removes supplied permissions from user