Documentation ¶
Index ¶
- func MakeListAllDepartmentsEndpoint(component Component) endpoint.Endpoint
- func MakeListAllDoctorsEndpoint(component Component) endpoint.Endpoint
- func MakeListAllHospitalsEndpoint(component Component) endpoint.Endpoint
- type Component
- type Department
- type Doctor
- type DoctorsDatabase
- type DoctorsModule
- type Endpoints
- type HospDepDatabase
- type HospDepModule
- type Hospital
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeListAllDepartmentsEndpoint ¶
MakeListAllDepartmentsEndpoint makes the ListAllDepartmentsEndpoint.
func MakeListAllDoctorsEndpoint ¶
MakeListAllDoctorsEndpoint makes the ListAllDoctorsEndpoint.
func MakeListAllHospitalsEndpoint ¶
MakeListAllHospitalsEndpoint makes the ListAllHospitalsEndpoint.
Types ¶
type Component ¶
type Component interface { ListAllHospitals(context.Context) ([]Hospital, error) ListAllDepartments(context.Context) ([]Department, error) ListAllDoctors(context.Context) ([]Doctor, error) }
Component is the hospital business component interface.
func NewComponent ¶
func NewComponent(hospDepModule HospDepModule, doctorsModule DoctorsModule) Component
NewComponent returns a patient business component
type Department ¶
type Department struct { ID int32 `json:"id,omitempty"` Name string `json:"name,omitempty"` Hospital Hospital `json:"hospital,omitempty"` Doctors []Doctor `json:"doctors,omitempty"` }
Department represents the department of a hospital
type Doctor ¶
type Doctor struct { ID int32 `json:"id,omitempty"` FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` Departments []Department `json:"departments,omitempty"` PatientsIds []int32 `json:"patients,omitempty"` }
Doctor represents a doctor
type DoctorsDatabase ¶
type DoctorsDatabase struct {
// contains filtered or unexported fields
}
DoctorsDatabase deals with the communication with CockroachDB.
func InitDoctorsDatabase ¶
func InitDoctorsDatabase(db cockroachDB) (*DoctorsDatabase, error)
InitDoctorsDatabase initializes the database
func (*DoctorsDatabase) ReadFromDb ¶
func (c *DoctorsDatabase) ReadFromDb() ([]Doctor, error)
ReadFromDb returns all the hospitals from the database
type DoctorsModule ¶
DoctorsModule contains the business logic for the doctors.
func NewDoctorModule ¶
func NewDoctorModule(doctorsDatabase DoctorsDatabase) DoctorsModule
NewDoctorModule returns a hospital/departments module
type Endpoints ¶
type Endpoints struct { ListAllHospitalsEndpoint endpoint.Endpoint ListAllDepartmentsEndpoint endpoint.Endpoint ListAllDoctorsEndpoint endpoint.Endpoint }
Endpoints wraps a service behind a set of endpoints.
type HospDepDatabase ¶
type HospDepDatabase struct {
// contains filtered or unexported fields
}
HospDepDatabase deals with the communication with CockroachDB.
func InitHospDepDatabase ¶
func InitHospDepDatabase(db cockroachDB) (*HospDepDatabase, error)
InitHospDepDatabase initializes the database
func (*HospDepDatabase) ReadDepartmentsFromDb ¶
func (c *HospDepDatabase) ReadDepartmentsFromDb() ([]Department, error)
ReadDepartmentsFromDb returns all the departments from the database
func (*HospDepDatabase) ReadHospitalsFromDb ¶
func (c *HospDepDatabase) ReadHospitalsFromDb() ([]Hospital, error)
ReadHospitalsFromDb returns all the hospitals from the database
type HospDepModule ¶
type HospDepModule interface { ListAllHospitals(ctx context.Context) ([]Hospital, error) ListAllDepartments(ctx context.Context) ([]Department, error) }
HospDepModule contains the business logic for the hospitals/departments.
func NewHospDepModule ¶
func NewHospDepModule(hospDepDatabase HospDepDatabase) HospDepModule
NewHospDepModule returns a hospital/departments module