1ad775be63
- 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.
28 lines
820 B
Go
28 lines
820 B
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type MiniProgram struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
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;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 "小程序配置"
|
|
}
|