go项目脚手架
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sorbet/internal/services/feature/request/feature_content_upsert_requ...

40 lines
1.1 KiB

package request
import (
"sorbet/internal/entities"
)
type FeatureContentUpsertRequest struct {
ID uint `json:"id" xml:"id" form:"id" path:"id"`
FeatureID uint `json:"feature_id" xml:"feature_id" form:"feature_id"`
CategoryID *uint `json:"category_id" xml:"category_id" form:"category_id"`
Type string `json:"type" xml:"type" form:"type"`
Title string `json:"title" xml:"title" form:"title"`
Intro string `json:"intro" xml:"intro" form:"intro"`
}
func (f *FeatureContentUpsertRequest) GetID() any {
return f.ID
}
func (f *FeatureContentUpsertRequest) ToMap() map[string]any {
return map[string]any{
"id": f.ID,
"feature_id": f.FeatureID,
"category_id": f.CategoryID,
"type": f.Type,
"title": f.Title,
"intro": f.Intro,
}
}
func (f *FeatureContentUpsertRequest) ToEntity() any {
return &entities.FeatureContent{
ID: f.ID,
FeatureID: f.FeatureID,
CategoryID: f.CategoryID,
Type: f.Type,
Title: f.Title,
Intro: f.Intro,
}
}