2025-06-19 10:35:26 +08:00

60 lines
1.5 KiB
Go

package schema
import (
"github.com/google/uuid"
"gitlab.guxuan.icu/jinshan_community/pkg/util"
"gorm.io/gorm"
)
// Defining the `Help` struct.
type Help struct {
util.BaseModel
CustomerID string `json:"customerId" gorm:"type:char(36);index;comment:客户id"`
Desc string `json:"desc" gorm:"size:128;comment:介绍"`
Img string `json:"img" gorm:"size:2048;comment:图片"`
Sequence int `json:"sequence" gorm:"index;default:0;comment:排序"`
Typer string `json:"type" gorm:"index;comment:类型"`
Link string `json:"link" gorm:"size:2048;comment:链接"`
Status string `json:"status" gorm:"size:20;index;comment:状态"`
}
func (c *Help) BeforeCreate(tx *gorm.DB) (err error) {
if c.ID == "" {
c.ID = uuid.New().String()
}
return
}
// Defining the query parameters for the `Help` struct.
type HelpQueryParam struct {
util.PaginationParam
}
// Defining the query options for the `Help` struct.
type HelpQueryOptions struct {
util.QueryOptions
}
// Defining the query result for the `Help` struct.
type HelpQueryResult struct {
Data Helps
PageResult *util.PaginationResult
}
// Defining the slice of `Help` struct.
type Helps []*Help
// Defining the data structure for creating a `Help` struct.
type HelpForm struct {
}
// A validation function for the `HelpForm` struct.
func (a *HelpForm) Validate() error {
return nil
}
// Convert `HelpForm` to `Help` object.
func (a *HelpForm) FillTo(help *Help) error {
return nil
}