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.
27 lines
428 B
27 lines
428 B
package serializer
|
|
|
|
import (
|
|
"go_fabric/model"
|
|
)
|
|
|
|
// Vo 向前端展示
|
|
type PoemVo struct {
|
|
Id uint `json:"id"`
|
|
Content string `json:"content"`
|
|
}
|
|
|
|
func BuildUser(poem *model.Poem) PoemVo {
|
|
return PoemVo{
|
|
Id: poem.Id,
|
|
Content: poem.Content,
|
|
}
|
|
}
|
|
|
|
func BuildUsers(items []model.Poem) (users []PoemVo) {
|
|
for _, item := range items {
|
|
poem := BuildUser(&item)
|
|
poems = append(poems, poem)
|
|
}
|
|
return poems
|
|
}
|