pkgdash/models/mapping.go

27 lines
459 B
Go

package models
import (
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
)
type ListPackage []*Package
func (l ListPackage) Mapping() []*pb.Package {
result := make([]*pb.Package, 0, len(l))
for i := range l {
temp := &pb.Package{
Id: l[i].ID,
Name: l[i].Name,
Url: l[i].URL,
Modules: l[i].Modules,
Issues: l[i].Issues,
Comments: l[i].Comments,
}
result = append(result, temp)
}
return result
}