You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
947 B
Go

package serializer
import (
"fonchain-artshow/cmd/model"
"fonchain-artshow/pb/artShow"
)
func BuildShowRelM(in []*artShow.ShowRel, applyUID string) (out []*model.ShowRel) {
for i := 0; i < len(in); i++ {
showRel := &model.ShowRel{
ShowUID: in[i].ShowUID,
ApplyUID: applyUID,
Index: in[i].Index,
Address: in[i].Address,
}
if in[i].ShowRelUID != "" {
showRel.ShowRelUID = in[i].ShowRelUID
}
out = append(out, showRel)
}
return
}
func BuildShowRelRes(in []*model.ShowRel) (out []*artShow.ShowRel) {
for i := 0; i < len(in); i++ {
showRel := &artShow.ShowRel{
ShowRelUID: in[i].ShowRelUID,
ApplyUID: in[i].ApplyUID,
ShowUID: in[i].ShowUID,
Index: in[i].Index,
Address: in[i].Address,
}
out = append(out, showRel)
}
return
}
func BuildShowRelIDs(in []*model.ShowRel) (out []uint) {
out = make([]uint, len(in))
for i := 0; i < len(in); i++ {
out[i] = in[i].ID
}
return
}