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 }