names

package
v1.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2022 License: MIT Imports: 6 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NameServiceClient

type NameServiceClient struct {
	rpc.Client
}

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

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

type NameServiceGateway struct {
	rpc.Gateway
	// 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) Download added in v1.1.0

func (NameServiceGateway) DownloadExt added in v1.1.0

func (NameServiceGateway) FirstName

func (NameServiceGateway) LastName

func (NameServiceGateway) ServeHTTP

func (gw NameServiceGateway) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (NameServiceGateway) SortName

func (NameServiceGateway) Split

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 (*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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL