Documentation ¶
Overview ¶
Package medicine contains the repository implementation for the medicine entity
Package medicine contains the repository implementation for the medicine entity ¶
Package medicine contains the repository implementation for the medicine entity
Index ¶
- Variables
- type Medicine
- type PaginationResultMedicine
- type Repository
- func (r *Repository) Create(newMedicine *domainMedicine.Medicine) (createdMedicine *domainMedicine.Medicine, err error)
- func (r *Repository) Delete(id int) (err error)
- func (r *Repository) GetAll() (*[]domainMedicine.Medicine, error)
- func (r *Repository) GetByID(id int) (*domainMedicine.Medicine, error)
- func (r *Repository) GetData(page int64, limit int64, sortBy string, sortDirection string, ...) (*domainMedicine.DataMedicine, error)
- func (r *Repository) GetOneByMap(medicineMap map[string]any) (*domainMedicine.Medicine, error)
- func (r *Repository) Update(id int, medicineMap map[string]any) (*domainMedicine.Medicine, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ColumnsMedicineMapping = map[string]string{
"id": "id",
"name": "name",
"description": "description",
"eanCode": "ean_code",
"laboratory": "laboratory",
"createdAt": "created_at",
"updatedAt": "updated_at",
}
View Source
var ColumnsMedicineStructure = map[string]string{
"id": "ID",
"name": "Name",
"description": "Description",
"eanCode": "EanCode",
"laboratory": "Laboratory",
"createdAt": "CreatedAt",
"updatedAt": "UpdatedAt",
}
Functions ¶
This section is empty.
Types ¶
type Medicine ¶
type Medicine struct { ID int `json:"id" example:"123" gorm:"primaryKey"` Name string `json:"name" example:"Paracetamol" gorm:"unique"` Description string `json:"description" example:"Some Description"` EANCode string `json:"ean_code" example:"9900000124" gorm:"unique"` Laboratory string `json:"laboratory" example:"Roche"` CreatedAt time.Time `json:"created_at,omitempty" example:"2021-02-24 20:19:39" gorm:"autoCreateTime:mili"` UpdatedAt time.Time `json:"updated_at,omitempty" example:"2021-02-24 20:19:39" gorm:"autoUpdateTime:mili"` }
Medicine is a struct that contains the medicine model
type PaginationResultMedicine ¶
type PaginationResultMedicine struct { Data *[]domainMedicine.Medicine Total int64 Limit int64 Current int64 NextCursor uint PrevCursor uint NumPages int64 }
PaginationResultMedicine is a struct that contains the pagination result for medicine
type Repository ¶
Repository is a struct that contains the database implementation for medicine entity
func (*Repository) Create ¶
func (r *Repository) Create(newMedicine *domainMedicine.Medicine) (createdMedicine *domainMedicine.Medicine, err error)
Create ... Insert New data
func (*Repository) Delete ¶
func (r *Repository) Delete(id int) (err error)
Delete ... Delete medicine
func (*Repository) GetAll ¶
func (r *Repository) GetAll() (*[]domainMedicine.Medicine, error)
GetAll Fetch all medicine data no params just all data
func (*Repository) GetByID ¶
func (r *Repository) GetByID(id int) (*domainMedicine.Medicine, error)
GetByID ... Fetch only one medicine by Id
func (*Repository) GetData ¶
func (r *Repository) GetData(page int64, limit int64, sortBy string, sortDirection string, filters map[string][]string, searchText string, dateRangeFilters []domain.DateRangeFilter) (*domainMedicine.DataMedicine, error)
GetData Fetch all medicine data
func (*Repository) GetOneByMap ¶
func (r *Repository) GetOneByMap(medicineMap map[string]any) (*domainMedicine.Medicine, error)
GetOneByMap ... Fetch only one medicine by Map
func (*Repository) Update ¶
func (r *Repository) Update(id int, medicineMap map[string]any) (*domainMedicine.Medicine, error)
Update ... Update medicine
Click to show internal directories.
Click to hide internal directories.