22 lines
771 B
Go
22 lines
771 B
Go
package model
|
|
|
|
type Route struct {
|
|
ID uint `gorm:"primaryKey;autoIncrement"`
|
|
Name string `gorm:"type:varchar(255);not null;unique"`
|
|
Path *string `gorm:"type:varchar(255);default:null"`
|
|
Component string `gorm:"type:varchar(255);not null;comment:path to component file"`
|
|
Layout *string `gorm:"type:varchar(50);default:'default';comment:'default | empty'"`
|
|
Meta *string `gorm:"type:longtext;default:'{}'"`
|
|
IsActive *bool `gorm:"type:tinyint;default:1"`
|
|
SortOrder *int `gorm:"type:int;default:0"`
|
|
|
|
ParentID *uint `gorm:"index"`
|
|
Parent *Route `gorm:"constraint:OnUpdate:RESTRICT,OnDelete:SET NULL;foreignKey:ParentID"`
|
|
|
|
Children []Route `gorm:"foreignKey:ParentID"`
|
|
}
|
|
|
|
func (Route) TableName() string {
|
|
return "b2b_routes"
|
|
}
|