54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
package schema
|
|
|
|
import (
|
|
"github.com/google/uuid"
|
|
"gitlab.guxuan.icu/jinshan_community/pkg/util"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// Defining the `AiRequest` struct.
|
|
type AiRequest struct {
|
|
util.BaseModel
|
|
}
|
|
|
|
func (c *AiRequest) BeforeCreate(tx *gorm.DB) (err error) {
|
|
if c.ID == "" {
|
|
c.ID = uuid.New().String()
|
|
}
|
|
return
|
|
}
|
|
|
|
// Defining the query parameters for the `AiRequest` struct.
|
|
type AiRequestQueryParam struct {
|
|
util.PaginationParam
|
|
}
|
|
|
|
// Defining the query options for the `AiRequest` struct.
|
|
type AiRequestQueryOptions struct {
|
|
util.QueryOptions
|
|
}
|
|
|
|
// Defining the query result for the `AiRequest` struct.
|
|
type AiRequestQueryResult struct {
|
|
Data AiRequests
|
|
PageResult *util.PaginationResult
|
|
}
|
|
|
|
// Defining the slice of `AiRequest` struct.
|
|
type AiRequests []*AiRequest
|
|
|
|
// Defining the data structure for creating a `AiRequest` struct.
|
|
type AiRequestForm struct {
|
|
Msg string `json:"msg" `
|
|
}
|
|
|
|
// A validation function for the `AiRequestForm` struct.
|
|
func (a *AiRequestForm) Validate() error {
|
|
return nil
|
|
}
|
|
|
|
// Convert `AiRequestForm` to `AiRequest` object.
|
|
func (a *AiRequestForm) FillTo(aiRequest *AiRequest) error {
|
|
return nil
|
|
}
|