package models import ( pb "go.unistack.org/unistack-org/pkgdash/proto" ) type ListPackage []*Package func (l ListPackage) Decode() []*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 } 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 }