Use proto.Merge

This commit is contained in:
Benedikt Kulmann
2020-10-23 10:19:17 +02:00
parent 9646437ebf
commit be9f6e574b
3 changed files with 6 additions and 17 deletions
+2 -1
View File
@@ -12,6 +12,7 @@ import (
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/gofrs/uuid"
p "github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/empty"
fieldmask_utils "github.com/mennanov/fieldmask-utils"
merrors "github.com/micro/go-micro/v2/errors"
@@ -309,7 +310,7 @@ func (s Service) CreateAccount(ctx context.Context, in *proto.CreateAccountReque
return merrors.InternalServerError(s.id, "invalid account: empty")
}
out.XXX_Merge(in.Account)
p.Merge(out, in.Account)
if out.Id == "" {
out.Id = uuid.Must(uuid.NewV4()).String()
+3 -3
View File
@@ -6,12 +6,12 @@ import (
"path/filepath"
"strconv"
"github.com/owncloud/ocis/accounts/pkg/storage"
"github.com/gofrs/uuid"
p "github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/empty"
merrors "github.com/micro/go-micro/v2/errors"
"github.com/owncloud/ocis/accounts/pkg/proto/v0"
"github.com/owncloud/ocis/accounts/pkg/storage"
)
func (s Service) expandMembers(g *proto.Group) {
@@ -113,7 +113,7 @@ func (s Service) CreateGroup(c context.Context, in *proto.CreateGroupRequest, ou
if in.Group == nil {
return merrors.InternalServerError(s.id, "invalid group: empty")
}
out.XXX_Merge(in.Group)
p.Merge(out, in.Group)
if out.Id == "" {
out.Id = uuid.Must(uuid.NewV4()).String()