Documentation
¶
Overview ¶
Code generated by Frodo from example/names/name_service.go - DO NOT EDIT
https://github.com/monadicstack/frodo
Code generated by Frodo from example/names/name_service.go - DO NOT EDIT
https://github.com/monadicstack/frodo
Index ¶
- type NameServiceClient
- func (client *NameServiceClient) FirstName(ctx context.Context, request *names.FirstNameRequest) (*names.FirstNameResponse, error)
- func (client *NameServiceClient) LastName(ctx context.Context, request *names.LastNameRequest) (*names.LastNameResponse, error)
- func (client *NameServiceClient) SortName(ctx context.Context, request *names.SortNameRequest) (*names.SortNameResponse, error)
- func (client *NameServiceClient) Split(ctx context.Context, request *names.SplitRequest) (*names.SplitResponse, error)
- type NameServiceGateway
- func (gw NameServiceGateway) FirstName(ctx context.Context, request *names.FirstNameRequest) (*names.FirstNameResponse, error)
- func (gw NameServiceGateway) LastName(ctx context.Context, request *names.LastNameRequest) (*names.LastNameResponse, error)
- func (gw NameServiceGateway) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (gw NameServiceGateway) SortName(ctx context.Context, request *names.SortNameRequest) (*names.SortNameResponse, error)
- func (gw NameServiceGateway) Split(ctx context.Context, request *names.SplitRequest) (*names.SplitResponse, error)
- type NameServiceProxy
- func (proxy *NameServiceProxy) FirstName(ctx context.Context, request *names.FirstNameRequest) (*names.FirstNameResponse, error)
- func (proxy *NameServiceProxy) LastName(ctx context.Context, request *names.LastNameRequest) (*names.LastNameResponse, error)
- func (proxy *NameServiceProxy) SortName(ctx context.Context, request *names.SortNameRequest) (*names.SortNameResponse, error)
- func (proxy *NameServiceProxy) Split(ctx context.Context, request *names.SplitRequest) (*names.SplitResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NameServiceClient ¶
NameServiceClient manages all interaction w/ a remote NameService 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 NewNameServiceClient() function to properly set this up.
func NewNameServiceClient ¶
func NewNameServiceClient(address string, options ...rpc.ClientOption) *NameServiceClient
NewNameServiceClient creates an RPC client that conforms to the NameService 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.
func (*NameServiceClient) FirstName ¶
func (client *NameServiceClient) FirstName(ctx context.Context, request *names.FirstNameRequest) (*names.FirstNameResponse, error)
func (*NameServiceClient) LastName ¶
func (client *NameServiceClient) LastName(ctx context.Context, request *names.LastNameRequest) (*names.LastNameResponse, error)
func (*NameServiceClient) SortName ¶
func (client *NameServiceClient) SortName(ctx context.Context, request *names.SortNameRequest) (*names.SortNameResponse, error)
func (*NameServiceClient) Split ¶
func (client *NameServiceClient) Split(ctx context.Context, request *names.SplitRequest) (*names.SplitResponse, error)
type NameServiceGateway ¶
type NameServiceGateway struct {
// contains filtered or unexported fields
}
func NewNameServiceGateway ¶
func NewNameServiceGateway(service names.NameService, options ...rpc.GatewayOption) NameServiceGateway
NewNameServiceGateway accepts your "real" NameService 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 := names.NameService{ /* set up to your liking */ }
gateway := names.NewNameServiceGateway(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.
func (NameServiceGateway) FirstName ¶
func (gw NameServiceGateway) FirstName(ctx context.Context, request *names.FirstNameRequest) (*names.FirstNameResponse, error)
func (NameServiceGateway) LastName ¶
func (gw NameServiceGateway) LastName(ctx context.Context, request *names.LastNameRequest) (*names.LastNameResponse, error)
func (NameServiceGateway) ServeHTTP ¶
func (gw NameServiceGateway) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (NameServiceGateway) SortName ¶
func (gw NameServiceGateway) SortName(ctx context.Context, request *names.SortNameRequest) (*names.SortNameResponse, error)
func (NameServiceGateway) Split ¶
func (gw NameServiceGateway) Split(ctx context.Context, request *names.SplitRequest) (*names.SplitResponse, error)
type NameServiceProxy ¶
type NameServiceProxy struct {
Service names.NameService
}
NameServiceProxy fully implements the NameService 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 NameService 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 (*NameServiceProxy) FirstName ¶
func (proxy *NameServiceProxy) FirstName(ctx context.Context, request *names.FirstNameRequest) (*names.FirstNameResponse, error)
func (*NameServiceProxy) LastName ¶
func (proxy *NameServiceProxy) LastName(ctx context.Context, request *names.LastNameRequest) (*names.LastNameResponse, error)
func (*NameServiceProxy) SortName ¶
func (proxy *NameServiceProxy) SortName(ctx context.Context, request *names.SortNameRequest) (*names.SortNameResponse, error)
func (*NameServiceProxy) Split ¶
func (proxy *NameServiceProxy) Split(ctx context.Context, request *names.SplitRequest) (*names.SplitResponse, error)