Dostosowywanie modeli do pracy z bazą danych

This commit is contained in:
Marcel 2018-12-18 22:10:09 +01:00
parent 3977c3e9fe
commit 0cf50b3bf9

View File

@ -10,7 +10,7 @@ type patient struct {
Name string Name string
Surname string Surname string
BirthDate time.Time BirthDate time.Time
PatientState patientStates PatientState sql.NullString
PatientSex sex PatientSex sex
PatientEmail string PatientEmail string
} }
@ -37,7 +37,7 @@ type operation struct {
Name string Name string
averageTime string averageTime string
operationType operationTypes operationType operationTypes
cost []uint8 cost uint8
refoundation int64 refoundation int64
} }
@ -48,14 +48,14 @@ type room struct {
} }
type admission struct { type admission struct {
AdmissionID int AdmissionID int64
AdmissionDate time.Time AdmissionDate time.Time
EndDate time.Time EndDate time.Time
PatientPesel string PatientPesel string
DiagnosisSymbol string DiagnosisSymbol string
MainDoctor int MainDoctor int64
PlanedOperation int PlanedOperation int64
RoomNumber int RoomNumber int64
IsPlanned bool IsPlanned bool
} }
@ -70,7 +70,10 @@ type admissions []admission
type operations []operation type operations []operation
type rooms []room type rooms []room
type iDatabaseModel interface{} type iDatabaseModel interface {
getPrimaryKey() string
getPrimaryKeyName() string
}
type iDatabaseModels []iDatabaseModel type iDatabaseModels []iDatabaseModel
type iStoreModels interface { type iStoreModels interface {
readModels(rows *sql.Rows) iDatabaseModels readModels(rows *sql.Rows) iDatabaseModels