Documentation
¶
Overview ¶
Code generated by Frodo from games/game_service.go - DO NOT EDIT
https://github.com/monadicstack/frodo
Code generated by Frodo from games/game_service.go - DO NOT EDIT
https://github.com/monadicstack/frodo
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGameServiceGateway ¶
func NewGameServiceGateway(service games.GameService, options ...rpc.GatewayOption) rpc.Gateway
NewGameServiceGateway accepts your "real" GameService instance (the thing that really does the work), and exposes it to other services/clients over RPC. The rpc.Gateway it returns implements http.Handler, so you can pass it to any standard library HTTP server of your choice.
// How to fire up your service for RPC and/or your REST API
service := games.GameService{ /* set up to your liking */ }
gateway := games.NewGameServiceGateway(service)
http.ListenAndServe(":8080", gateway)
The default instance works well enough, but you can supply additional options such as WithMiddleware() which accepts any negroni-compatible middleware handlers.
Types ¶
type GameServiceClient ¶
GameServiceClient manages all interaction w/ a remote GameService instance by letting you invoke functions on this instance as if you were doing it locally (hence... RPC client). You shouldn't instantiate this manually. Instead, you should utilize the NewGameServiceClient() function to properly set this up.
func NewGameServiceClient ¶
func NewGameServiceClient(address string, options ...rpc.ClientOption) *GameServiceClient
NewGameServiceClient creates an RPC client that conforms to the GameService interface, but delegates work to remote instances. You must supply the base address of the remote service gateway instance or the load balancer for that service.
GameService manages the catalog info for all of the games in our system.
func (*GameServiceClient) GetByID ¶
func (client *GameServiceClient) GetByID(ctx context.Context, request *games.GetByIDRequest) (*games.GetByIDResponse, error)
GetByID looks up a game record given its unique id.
func (*GameServiceClient) Register ¶
func (client *GameServiceClient) Register(ctx context.Context, request *games.RegisterRequest) (*games.RegisterResponse, error)
Register adds another game record to our gaming database.
type GameServiceProxy ¶
type GameServiceProxy struct {
Service games.GameService
}
GameServiceProxy fully implements the GameService interface, but delegates all operations to a "real" instance of the service. You can embed this type in a struct of your choice so you can "override" or decorate operations as you see fit. Any operations on GameService that you don't explicitly define will simply delegate to the default implementation of the underlying 'Service' value.
Since you have access to the underlying service, you are able to both implement custom handling logic AND call the "real" implementation, so this can be used as special middleware that applies to only certain operations.
func (*GameServiceProxy) GetByID ¶
func (proxy *GameServiceProxy) GetByID(ctx context.Context, request *games.GetByIDRequest) (*games.GetByIDResponse, error)
func (*GameServiceProxy) Register ¶
func (proxy *GameServiceProxy) Register(ctx context.Context, request *games.RegisterRequest) (*games.RegisterResponse, error)