Enhance database models with comments and table descriptions
- Added comments to various fields in the database models for better clarity and understanding. - Implemented TableComment methods for several models to provide descriptive information about their purpose. - Updated the AutoMigrate function to support setting table comments in the database. - Improved overall documentation within the code to facilitate future maintenance and development.
This commit is contained in:
@@ -8,16 +8,20 @@ import (
|
||||
|
||||
type MiniProgram struct {
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
|
||||
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"-"`
|
||||
|
||||
Name string `gorm:"size:100;not null" json:"name"`
|
||||
AppID string `gorm:"size:100;uniqueIndex" json:"app_id"`
|
||||
AppSecret string `gorm:"size:200;not null" json:"-"`
|
||||
Description string `gorm:"size:255" json:"description"`
|
||||
Name string `gorm:"size:100;not null;comment:小程序名称" json:"name"`
|
||||
AppID string `gorm:"size:100;uniqueIndex;comment:小程序AppID" json:"app_id"`
|
||||
AppSecret string `gorm:"size:200;not null;comment:小程序AppSecret" json:"-"`
|
||||
Description string `gorm:"size:255;comment:描述" json:"description"`
|
||||
}
|
||||
|
||||
func (MiniProgram) TableName() string {
|
||||
return "mini_programs"
|
||||
}
|
||||
|
||||
func (MiniProgram) TableComment() string {
|
||||
return "小程序配置"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user