pkgdash/models/mapping.go

45 lines
787 B
Go
Raw Normal View History

package models
import (
pb "go.unistack.org/unistack-org/pkgdash/proto/go_generate"
)
type ListPackage []*Package
2023-08-11 17:07:37 +03:00
func (l ListPackage) Decode() []*pb.Package {
result := make([]*pb.Package, 0, len(l))
2023-08-10 22:24:41 +03:00
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
}
2023-08-11 17:07:37 +03:00
type ListModule []*Module
func (l ListModule) Decode() []*pb.Module {
result := make([]*pb.Module, 0, len(l))
for i := range l {
temp := &pb.Module{
Id: l[i].ID,
Name: l[i].Name,
Version: l[i].Version,
LastVersion: l[i].LastVersion,
}
result = append(result, temp)
}
return result
}