go.uber.org/yarpc@v1.72.1/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/common/emptyservicefx/server.go (about) 1 // Code generated by thriftrw-plugin-yarpc 2 // @generated 3 4 package emptyservicefx 5 6 import ( 7 fx "go.uber.org/fx" 8 transport "go.uber.org/yarpc/api/transport" 9 thrift "go.uber.org/yarpc/encoding/thrift" 10 emptyserviceserver "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/common/emptyserviceserver" 11 ) 12 13 // ServerParams defines the dependencies for the EmptyService server. 14 type ServerParams struct { 15 fx.In 16 17 Handler emptyserviceserver.Interface 18 } 19 20 // ServerResult defines the output of EmptyService server module. It provides the 21 // procedures of a EmptyService handler to an Fx application. 22 // 23 // The procedures are provided to the "yarpcfx" value group. Dig 1.2 or newer 24 // must be used for this feature to work. 25 type ServerResult struct { 26 fx.Out 27 28 Procedures []transport.Procedure `group:"yarpcfx"` 29 } 30 31 // Server provides procedures for EmptyService to an Fx application. It expects a 32 // emptyservicefx.Interface to be present in the container. 33 // 34 // fx.Provide( 35 // func(h *MyEmptyServiceHandler) emptyserviceserver.Interface { 36 // return h 37 // }, 38 // emptyservicefx.Server(), 39 // ) 40 func Server(opts ...thrift.RegisterOption) interface{} { 41 return func(p ServerParams) ServerResult { 42 procedures := emptyserviceserver.New(p.Handler, opts...) 43 return ServerResult{Procedures: procedures} 44 } 45 }