Documentation ¶
Index ¶
- Variables
- type Building
- func (q *Building) AfterCreate(dbh *gorm.DB) (err error)
- func (q *Building) AfterDelete(dbh *gorm.DB) (err error)
- func (q *Building) AfterSave(dbh *gorm.DB) (err error)
- func (q *Building) AfterUpdate(dbh *gorm.DB) (err error)
- func (q *Building) BeforeCreate() (err error)
- func (q *Building) BeforeDelete() (err error)
- func (q *Building) BeforeSave() (err error)
- func (q *Building) BeforeUpdate() (err error)
- func (q *Building) Create(dbh *gorm.DB) (int64, error)
- func (q *Building) Delete(dbh *gorm.DB) error
- func (q *Building) Get(dbh *gorm.DB) (*Building, error)
- func (q *Building) GetAll(dbh *gorm.DB, page, limit int) (BuildingGetResults, error)
- func (q *Building) HashKey(s string) string
- func (Building) TableName() string
- func (q *Building) Update(dbh *gorm.DB) error
- type BuildingCreator
- type BuildingFloor
- type BuildingGetResults
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrMissingRequiredParameters reqd parameter missing ErrMissingRequiredParameters = errors.New("missing required parameter") // ErrRecordsNotFound list is empty ErrRecordsNotFound = errors.New("record(s) not found") // ErrRecordNotFound data not exiss ErrRecordNotFound = errors.New("record not found") // ErrRecordMismatch generated hashkey by name is a mismatch ErrRecordMismatch = errors.New("record id/name mismatch") // ErrRecordExists data already exiss ErrRecordExists = errors.New("record exists") // ErrDBTransaction internal storage error ErrDBTransaction = errors.New("db storage failed") )
Functions ¶
This section is empty.
Types ¶
type Building ¶
type Building struct { ID int64 `gorm:"primary_key" json:"id,omitempty"` Name string `json:"name,omitempty"` Address string `json:"address,omitempty"` CreatedAt time.Time `json:"created_at,omitempty"` UpdatedAt time.Time `json:"updated_at,omitempty"` BuildingFloors []BuildingFloor `gorm:"ForeignKey:BuildingID" json:"floors,omitempty"` }
Building table buildings
func (*Building) AfterCreate ¶
AfterCreate callback after create
func (*Building) AfterDelete ¶
AfterDelete callback after remove
func (*Building) AfterUpdate ¶
AfterUpdate callback after update
func (*Building) BeforeCreate ¶
BeforeCreate callback before create
func (*Building) BeforeDelete ¶
BeforeDelete callback before remove
func (*Building) BeforeSave ¶
BeforeSave callback before save
func (*Building) BeforeUpdate ¶
BeforeUpdate callback before update
type BuildingCreator ¶
type BuildingCreator interface { Get(dbh *gorm.DB) (*Building, error) GetAll(dbh *gorm.DB) ([]Building, error) Create(dbh *gorm.DB) (int64, error) Update(dbh *gorm.DB) error Delete(dbh *gorm.DB) error }
BuildingCreator list of all building funcs
type BuildingFloor ¶
type BuildingFloor struct { ID int64 `gorm:"primary_key" json:"-"` Floor string `json:"floor,omitempty"` BuildingID int64 `json:"-"` CreatedAt time.Time `json:"-"` UpdatedAt time.Time `json:"-"` }
BuildingFloor table building_floors
func (BuildingFloor) TableName ¶
func (BuildingFloor) TableName() string
TableName table name to be buildings
Click to show internal directories.
Click to hide internal directories.