names

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 6 Imported by: 0

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

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.

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