go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/teams/proto/v1/teamsserver_dec.go (about) 1 // Code generated by svcdec; DO NOT EDIT. 2 3 package v1 4 5 import ( 6 "context" 7 8 proto "github.com/golang/protobuf/proto" 9 ) 10 11 type DecoratedTeams struct { 12 // Service is the service to decorate. 13 Service TeamsServer 14 // Prelude is called for each method before forwarding the call to Service. 15 // If Prelude returns an error, then the call is skipped and the error is 16 // processed via the Postlude (if one is defined), or it is returned directly. 17 Prelude func(ctx context.Context, methodName string, req proto.Message) (context.Context, error) 18 // Postlude is called for each method after Service has processed the call, or 19 // after the Prelude has returned an error. This takes the Service's 20 // response proto (which may be nil) and/or any error. The decorated 21 // service will return the response (possibly mutated) and error that Postlude 22 // returns. 23 Postlude func(ctx context.Context, methodName string, rsp proto.Message, err error) error 24 } 25 26 func (s *DecoratedTeams) Get(ctx context.Context, req *GetTeamRequest) (rsp *Team, err error) { 27 if s.Prelude != nil { 28 var newCtx context.Context 29 newCtx, err = s.Prelude(ctx, "Get", req) 30 if err == nil { 31 ctx = newCtx 32 } 33 } 34 if err == nil { 35 rsp, err = s.Service.Get(ctx, req) 36 } 37 if s.Postlude != nil { 38 err = s.Postlude(ctx, "Get", rsp, err) 39 } 40 return 41 }