go.uber.org/yarpc@v1.72.1/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/atomic/storefx/server.go (about) 1 // Code generated by thriftrw-plugin-yarpc 2 // @generated 3 4 package storefx 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 storeserver "go.uber.org/yarpc/encoding/thrift/thriftrw-plugin-yarpc/internal/tests/atomic/storeserver" 11 ) 12 13 // ServerParams defines the dependencies for the Store server. 14 type ServerParams struct { 15 fx.In 16 17 Handler storeserver.Interface 18 } 19 20 // ServerResult defines the output of Store server module. It provides the 21 // procedures of a Store 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 Store to an Fx application. It expects a 32 // storefx.Interface to be present in the container. 33 // 34 // fx.Provide( 35 // func(h *MyStoreHandler) storeserver.Interface { 36 // return h 37 // }, 38 // storefx.Server(), 39 // ) 40 func Server(opts ...thrift.RegisterOption) interface{} { 41 return func(p ServerParams) ServerResult { 42 procedures := storeserver.New(p.Handler, opts...) 43 return ServerResult{Procedures: procedures} 44 } 45 }