medicine

package
v0.0.0-...-487d63a Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 8 Imported by: 0

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

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

func (*Medicine) TableName

func (*Medicine) TableName() string

TableName overrides the table name used by User to `users`

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

type Repository struct {
	DB *gorm.DB
}

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

Jump to

Keyboard shortcuts

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