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
921 B
Go

2 years ago
package serializer
import (
"fonchain-artshow/cmd/model"
2 years ago
"fonchain-artshow/pb/artShow"
2 years ago
)
2 years ago
func BuildShowRelM(in []*artShow.ShowRel, applyID uint) (out []*model.ShowRel) {
2 years ago
for i := 0; i < len(in); i++ {
showRel := &model.ShowRel{
ShowID: uint(in[i].ShowID),
ApplyID: applyID,
Index: in[i].Index,
Address: in[i].Address,
}
if in[i].ID != 0 {
showRel.ID = uint(in[i].ID)
}
out = append(out, showRel)
}
return
}
2 years ago
func BuildShowRelRes(in []*model.ShowRel) (out []*artShow.ShowRel) {
2 years ago
for i := 0; i < len(in); i++ {
2 years ago
showRel := &artShow.ShowRel{
2 years ago
ID: int64(in[i].ID),
ApplyID: int64(in[i].ApplyID),
ShowID: int64(in[i].ShowID),
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
}