Documentation
¶
Overview ¶
Code generated by Frodo - DO NOT EDIT.
Timestamp: Tue, 10 May 2022 16:18:41 EDT Source: example/names/name_service.go Generator: https://github.com/monadicstack/frodo
Code generated by Frodo - DO NOT EDIT.
Timestamp: Tue, 10 May 2022 16:18:40 EDT Source: example/names/name_service.go Generator: https://github.com/monadicstack/frodo
Index ¶
- type NameServiceClient
- func (client *NameServiceClient) Download(ctx context.Context, request *names.DownloadRequest) (*names.DownloadResponse, error)
- func (client *NameServiceClient) DownloadExt(ctx context.Context, request *names.DownloadExtRequest) (*names.DownloadExtResponse, error)
- 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) Download(ctx context.Context, request *names.DownloadRequest) (*names.DownloadResponse, error)
- func (gw NameServiceGateway) DownloadExt(ctx context.Context, request *names.DownloadExtRequest) (*names.DownloadExtResponse, error)
- 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) Download(ctx context.Context, request *names.DownloadRequest) (*names.DownloadResponse, error)
- func (proxy *NameServiceProxy) DownloadExt(ctx context.Context, request *names.DownloadExtRequest) (*names.DownloadExtResponse, error)
- 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.
NameService performs parsing/processing on a person's name. This is primarily just used as a reference service for integration testing our generated clients.
func (*NameServiceClient) Download ¶ added in v1.1.0
func (client *NameServiceClient) Download(ctx context.Context, request *names.DownloadRequest) (*names.DownloadResponse, error)
Download returns a raw CSV file containing the parsed name.
func (*NameServiceClient) DownloadExt ¶ added in v1.1.0
func (client *NameServiceClient) DownloadExt(ctx context.Context, request *names.DownloadExtRequest) (*names.DownloadExtResponse, error)
DownloadExt returns a raw CSV file containing the parsed name. This differs from Download by giving you the "Ext" knob which will let you exercise the content type and disposition interfaces that Frodo supports for raw responses.
func (*NameServiceClient) FirstName ¶
func (client *NameServiceClient) FirstName(ctx context.Context, request *names.FirstNameRequest) (*names.FirstNameResponse, error)
FirstName extracts just the first name from a full name string.
func (*NameServiceClient) LastName ¶
func (client *NameServiceClient) LastName(ctx context.Context, request *names.LastNameRequest) (*names.LastNameResponse, error)
LastName extracts just the last name from a full name string.
func (*NameServiceClient) SortName ¶
func (client *NameServiceClient) SortName(ctx context.Context, request *names.SortNameRequest) (*names.SortNameResponse, error)
SortName establishes the "phone book" name for the given full name.
func (*NameServiceClient) Split ¶
func (client *NameServiceClient) Split(ctx context.Context, request *names.SplitRequest) (*names.SplitResponse, error)
Split separates a first and last name.
type NameServiceGateway ¶
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) Download ¶ added in v1.1.0
func (gw NameServiceGateway) Download(ctx context.Context, request *names.DownloadRequest) (*names.DownloadResponse, error)
func (NameServiceGateway) DownloadExt ¶ added in v1.1.0
func (gw NameServiceGateway) DownloadExt(ctx context.Context, request *names.DownloadExtRequest) (*names.DownloadExtResponse, error)
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) Download ¶ added in v1.1.0
func (proxy *NameServiceProxy) Download(ctx context.Context, request *names.DownloadRequest) (*names.DownloadResponse, error)
func (*NameServiceProxy) DownloadExt ¶ added in v1.1.0
func (proxy *NameServiceProxy) DownloadExt(ctx context.Context, request *names.DownloadExtRequest) (*names.DownloadExtResponse, error)
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)