Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct { BaseModelSoftDelete FullName string `gorm:"not null;"` Email string `gorm:"not null;unique"` Password string `gorm:"not null;"` Phone *string `gorm:"unique"` Role string `gorm:"not null;"` CreatedByID *string CreatedBy *Admin }
Admin defines a administrators who are to manage the app
func (*Admin) BeforeDelete ¶
BeforeDelete hook is called before the data is delete so that we dont delete super admin
type BaseModel ¶
type BaseModel struct { // ID should use uuid_generate_v4() for the pk's ID uuid.UUID `gorm:"primary_key;type:uuid;default:uuid_generate_v4()"` CreatedAt time.Time `gorm:"index;not null;default:CURRENT_TIMESTAMP"` UpdatedAt time.Time `gorm:"index;not null;default:CURRENT_TIMESTAMP"` }
BaseModel defines the common columns that all db structs should hold, usually db structs based on this have no soft delete
type BaseModelSoftDelete ¶
BaseModelSoftDelete defines the common columns that all db structs should hold, usually. This struct also defines the fields for GORM triggers to detect the entity should soft delete
type Customer ¶
type Customer struct { BaseModelSoftDelete LastName string `gorm:"not null;"` OtherNames *string Email *string `gorm:"unique"` Phone string `gorm:"not null;unique"` }
Customer defines a customer who requests for a ride hail service
type Rider ¶
type Rider struct { BaseModelSoftDelete LastName string `gorm:"not null;"` OtherNames string `gorm:"not null;"` Email string `gorm:"not null;unique"` Phone string `gorm:"not null;unique"` Password string `gorm:"not null;"` AuthorisedAt *time.Time AuthorisedBy *Admin `gorm:"foreignKey:ID"` ProfilePhoto string `gorm:"not null;"` LicenseBack string `gorm:"not null;"` LicenseFront string `gorm:"not null;"` Bike string `gorm:"not null;"` }
Rider defines a riders who are to accept trips from customers
Click to show internal directories.
Click to hide internal directories.