[#1343] go.mod: Update api-go

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Evgenii Stratonikov 2024-08-29 15:45:33 +03:00 committed by Evgenii Stratonikov
parent 882c068410
commit 98fe24cdb7
13 changed files with 180 additions and 206 deletions

View file

@ -360,7 +360,7 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
return nil, err
}
info := make([]*GetNodeByPathResponse_Info, 0, len(nodes))
info := make([]GetNodeByPathResponse_Info, 0, len(nodes))
for _, node := range nodes {
m, parent, err := s.forest.TreeGetMeta(ctx, cid, b.GetTreeId(), node)
if err != nil {
@ -374,11 +374,11 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
if b.GetAllAttributes() {
x.Meta = metaToProto(m.Items)
} else {
var metaValue []*KeyValue
var metaValue []KeyValue
for _, kv := range m.Items {
for _, attr := range b.GetAttributes() {
if kv.Key == attr {
metaValue = append(metaValue, &KeyValue{
metaValue = append(metaValue, KeyValue{
Key: kv.Key,
Value: kv.Value,
})
@ -388,7 +388,7 @@ func (s *Service) GetNodeByPath(ctx context.Context, req *GetNodeByPathRequest)
}
x.Meta = metaValue
}
info = append(info, &x)
info = append(info, x)
}
return &GetNodeByPathResponse{
@ -782,21 +782,19 @@ func (s *Service) TreeList(ctx context.Context, req *TreeListRequest) (*TreeList
}, nil
}
func protoToMeta(arr []*KeyValue) []pilorama.KeyValue {
func protoToMeta(arr []KeyValue) []pilorama.KeyValue {
meta := make([]pilorama.KeyValue, len(arr))
for i, kv := range arr {
if kv != nil {
meta[i].Key = kv.GetKey()
meta[i].Value = kv.GetValue()
}
meta[i].Key = kv.GetKey()
meta[i].Value = kv.GetValue()
}
return meta
}
func metaToProto(arr []pilorama.KeyValue) []*KeyValue {
meta := make([]*KeyValue, len(arr))
func metaToProto(arr []pilorama.KeyValue) []KeyValue {
meta := make([]KeyValue, len(arr))
for i, kv := range arr {
meta[i] = &KeyValue{
meta[i] = KeyValue{
Key: kv.Key,
Value: kv.Value,
}