adapters

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnnotator

func NewAnnotator() func(context.Context, *http.Request) metadata.MD

NewAnnotator returns a new grpc metadata annotator and illustrates how custom data can be added to the grpc metadata request context.

func NewIncomingHeaderMatcher

func NewIncomingHeaderMatcher() runtime.HeaderMatcherFunc

NewIncomingHeaderMatcher returns a new runtime.HeaderMatcherFunc and illustrates how to match incoming request headers and add them to the grpc metadata.

func NewOutgoingHeaderMatcher

func NewOutgoingHeaderMatcher() runtime.HeaderMatcherFunc

NewOutgoingHeaderMatcher returns a new runtime.HeaderMatcherFunc and illustrates how to match outgoing response headers.

func NewProtoErrorHandler

func NewProtoErrorHandler(logger *logrus.Logger) runtime.ProtoErrorHandlerFunc

NewProtoErrorHandler returns a new runtime.ProtoErrorHandlerFunc and illustrates how custom responses can be returned from the grpc gateway.

Types

type BeerInteractor

type BeerInteractor interface {
	// CreateBeer creates a beers.
	CreateBeer(ctx context.Context, params *domain.CreateBeerParams) (*domain.Beer, error)
	// GetBeer gets a beers.
	GetBeer(ctx context.Context, params *domain.GetBeerParams) (*domain.Beer, error)
	// UpdateBeer uodates a beers.
	UpdateBeer(ctx context.Context, params *domain.UpdateBeerParams) (*domain.Beer, error)
	// DeleteBeer deletes a beers.
	DeleteBeer(ctx context.Context, params *domain.DeleteBeerParams) error
	// ListBeers lists beers.
	ListBeers(ctx context.Context, params *domain.ListBeersParams) ([]*domain.Beer, error)
}

BeerInteractor defines a set of APIs for interacting with beers.

type BeerService

type BeerService struct {
	// contains filtered or unexported fields
}

BeerService implements the BeerService service gRPC API.

func NewBeerService

func NewBeerService(interactor BeerInteractor) *BeerService

NewBeerService creates a new beer service.

func (*BeerService) CreateBeer

func (svc *BeerService) CreateBeer(ctx context.Context, params *beers.CreateBeerRequest) (*beers.Beer, error)

CreateBeer create a beer with specified beer parameters.

func (*BeerService) DeleteBeer

func (svc *BeerService) DeleteBeer(ctx context.Context, params *beers.DeleteBeerRequest) (*empty.Empty, error)

DeleteBeer deletes the beer with specified beer identifier.

func (*BeerService) GetBeer

func (svc *BeerService) GetBeer(ctx context.Context, params *beers.GetBeerRequest) (*beers.Beer, error)

GetBeer gets the beer with specified beer identifier.

func (*BeerService) ListBeers

func (svc *BeerService) ListBeers(ctx context.Context, params *beers.ListBeersRequest) (*beers.ListBeersResponse, error)

ListBeers lists all beers.

func (*BeerService) UpdateBeer

func (svc *BeerService) UpdateBeer(ctx context.Context, params *beers.UpdateBeerRequest) (*beers.Beer, error)

UpdateBeer updates the beer with specified beer identifier.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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