| OLD | NEW |
| (Empty) | |
| 1 // Code generated by svcdec; DO NOT EDIT |
| 2 |
| 3 package milo |
| 4 |
| 5 import ( |
| 6 proto "github.com/golang/protobuf/proto" |
| 7 context "golang.org/x/net/context" |
| 8 ) |
| 9 |
| 10 type DecoratedBuildInfo struct { |
| 11 // Service is the service to decorate. |
| 12 Service BuildInfoServer |
| 13 // Prelude is called for each method before forwarding the call to Servi
ce. |
| 14 // If Prelude returns an error, it the call is skipped and the error is |
| 15 // processed via the Postlude (if one is defined), or it is returned dir
ectly. |
| 16 Prelude func(c context.Context, methodName string, req proto.Message) (c
ontext.Context, error) |
| 17 // Postlude is called for each method after Service has processed the ca
ll, or |
| 18 // after the Prelude has returned an error. This takes the the Service's |
| 19 // response proto (which may be nil) and/or any error. The decorated |
| 20 // service will return the response (possibly mutated) and error that Po
stlude |
| 21 // returns. |
| 22 Postlude func(c context.Context, methodName string, rsp proto.Message, e
rr error) error |
| 23 } |
| 24 |
| 25 func (s *DecoratedBuildInfo) Get(c context.Context, req *BuildInfoRequest) (rsp
*BuildInfoResponse, err error) { |
| 26 var newCtx context.Context |
| 27 if s.Prelude != nil { |
| 28 newCtx, err = s.Prelude(c, "Get", req) |
| 29 } |
| 30 if err == nil { |
| 31 c = newCtx |
| 32 rsp, err = s.Service.Get(c, req) |
| 33 } |
| 34 if s.Postlude != nil { |
| 35 err = s.Postlude(c, "Get", rsp, err) |
| 36 } |
| 37 return |
| 38 } |
| OLD | NEW |