...
1 package server
2
3 import (
4 "context"
5
6 "github.com/golang/glog"
7 examples "github.com/grpc-ecosystem/grpc-gateway/examples/internal/proto/examplepb"
8 )
9
10
11
12 type nonStandardServer struct{}
13
14 func newNonStandardServer() examples.NonStandardServiceServer {
15 return new(nonStandardServer)
16 }
17
18 func (s *nonStandardServer) Update(ctx context.Context, msg *examples.NonStandardUpdateRequest) (*examples.NonStandardMessage, error) {
19 glog.Info(msg)
20
21 newMsg := &examples.NonStandardMessage{
22 Thing: &examples.NonStandardMessage_Thing{SubThing: &examples.NonStandardMessage_Thing_SubThing{}},
23 }
24 applyFieldMask(newMsg, msg.Body, msg.UpdateMask)
25
26 glog.Info(newMsg)
27 return newMsg, nil
28 }
29
30 func (s *nonStandardServer) UpdateWithJSONNames(ctx context.Context, msg *examples.NonStandardWithJSONNamesUpdateRequest) (*examples.NonStandardMessageWithJSONNames, error) {
31 glog.Info(msg)
32
33 newMsg := &examples.NonStandardMessageWithJSONNames{
34 Thing: &examples.NonStandardMessageWithJSONNames_Thing{SubThing: &examples.NonStandardMessageWithJSONNames_Thing_SubThing{}},
35 }
36 applyFieldMask(newMsg, msg.Body, msg.UpdateMask)
37
38 glog.Info(newMsg)
39 return newMsg, nil
40 }
41
View as plain text