2025-06-19 10:33:58 +08:00

50 lines
1.0 KiB
Go

package schema
import (
"github.guxuan/haibei/pkg/util"
)
// Defining the `Area` struct.
type Area struct {
util.BaseModel
Name string `json:"name" gorm:"size:128;not null;index"`
Status string `json:"status" gorm:"size:20;index"`
}
// Defining the query parameters for the `Area` struct.
type AreaQueryParam struct {
util.PaginationParam
}
// Defining the query options for the `Area` struct.
type AreaQueryOptions struct {
util.QueryOptions
}
// Defining the query result for the `Area` struct.
type AreaQueryResult struct {
Data Areas
PageResult *util.PaginationResult
}
// Defining the slice of `Area` struct.
type Areas []*Area
// Defining the data structure for creating a `Area` struct.
type AreaForm struct {
Name string `json:"name" `
Status string `json:"status"`
}
// A validation function for the `AreaForm` struct.
func (a *AreaForm) Validate() error {
return nil
}
// Convert `AreaForm` to `Area` object.
func (a *AreaForm) FillTo(area *Area) error {
area.Status = a.Status
area.Name = a.Name
return nil
}