init: first steps
This commit is contained in:
25
model/status.go
Normal file
25
model/status.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Status struct {
|
||||
ID int `gorm:"primary_key;auto_increment" json:"-"`
|
||||
ServiceID int `gorm:"one" json:"-"`
|
||||
Status string `gorm:"size:255;not null" json:"status"`
|
||||
Description *string `gorm:"size:255" json:"description"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
}
|
||||
|
||||
func (Status) TableName() string {
|
||||
return "status"
|
||||
}
|
||||
|
||||
func (s *Status) BeforeCreate(*gorm.DB) error {
|
||||
s.CreatedAt = time.Now()
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user