tododriver

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyBaseURL contextKey = iota
)

Variables

This section is empty.

Functions

func MakeAddItemEndpoint

func MakeAddItemEndpoint(service todo.Service) endpoint.Endpoint

MakeAddItemEndpoint returns an endpoint for the matching method of the underlying service.

func MakeDeleteItemEndpoint

func MakeDeleteItemEndpoint(service todo.Service) endpoint.Endpoint

MakeDeleteItemEndpoint returns an endpoint for the matching method of the underlying service.

func MakeDeleteItemsEndpoint

func MakeDeleteItemsEndpoint(service todo.Service) endpoint.Endpoint

MakeDeleteItemsEndpoint returns an endpoint for the matching method of the underlying service.

func MakeGRPCServer added in v0.3.0

func MakeGRPCServer(endpoints Endpoints, options ...kitgrpc.ServerOption) api.TodoListServiceServer

MakeGRPCServer makes a set of endpoints available as a gRPC server.

func MakeGetItemEndpoint

func MakeGetItemEndpoint(service todo.Service) endpoint.Endpoint

MakeGetItemEndpoint returns an endpoint for the matching method of the underlying service.

func MakeGraphQLResolver added in v0.3.0

func MakeGraphQLResolver(endpoints Endpoints, options ...kitxgraphql.ServerOption) graphql.ResolverRoot

MakeGraphQLResolver mounts all of the service endpoints into a GraphQL resolver.

func MakeGraphQLSchema added in v0.5.1

func MakeGraphQLSchema(endpoints Endpoints, options ...kitxgraphql.ServerOption) graphql2.ExecutableSchema

MakeGraphQLSchema mounts all of the service endpoints into a GraphQL executable schema.

func MakeHTTPHandler added in v0.6.1

func MakeHTTPHandler(endpoints Endpoints, options ...kithttp.ServerOption) http.Handler

MakeHTTPHandler mounts all of the service endpoints into an {http.Handler}.

func MakeListItemsEndpoint

func MakeListItemsEndpoint(service todo.Service) endpoint.Endpoint

MakeListItemsEndpoint returns an endpoint for the matching method of the underlying service.

func MakeUpdateItemEndpoint

func MakeUpdateItemEndpoint(service todo.Service) endpoint.Endpoint

MakeUpdateItemEndpoint returns an endpoint for the matching method of the underlying service.

Types

type AddItemRequest

type AddItemRequest struct {
	NewItem todo.NewItem
}

AddItemRequest is a request struct for AddItem endpoint.

type AddItemResponse

type AddItemResponse struct {
	Item todo.Item
	Err  error
}

AddItemResponse is a response struct for AddItem endpoint.

func (AddItemResponse) Failed

func (r AddItemResponse) Failed() error

type DeleteItemRequest

type DeleteItemRequest struct {
	Id string
}

DeleteItemRequest is a request struct for DeleteItem endpoint.

type DeleteItemResponse

type DeleteItemResponse struct {
	Err error
}

DeleteItemResponse is a response struct for DeleteItem endpoint.

func (DeleteItemResponse) Failed

func (r DeleteItemResponse) Failed() error

type DeleteItemsRequest

type DeleteItemsRequest struct{}

DeleteItemsRequest is a request struct for DeleteItems endpoint.

type DeleteItemsResponse

type DeleteItemsResponse struct {
	Err error
}

DeleteItemsResponse is a response struct for DeleteItems endpoint.

func (DeleteItemsResponse) Failed

func (r DeleteItemsResponse) Failed() error

type Endpoints

type Endpoints struct {
	AddItem     endpoint.Endpoint
	DeleteItem  endpoint.Endpoint
	DeleteItems endpoint.Endpoint
	GetItem     endpoint.Endpoint
	ListItems   endpoint.Endpoint
	UpdateItem  endpoint.Endpoint
}

Endpoints collects all of the endpoints that compose the underlying service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.

func MakeEndpoints

func MakeEndpoints(service todo.Service, middleware ...endpoint.Middleware) Endpoints

MakeEndpoints returns a(n) Endpoints struct where each endpoint invokes the corresponding method on the provided service.

type GetItemRequest

type GetItemRequest struct {
	Id string
}

GetItemRequest is a request struct for GetItem endpoint.

type GetItemResponse

type GetItemResponse struct {
	Item todo.Item
	Err  error
}

GetItemResponse is a response struct for GetItem endpoint.

func (GetItemResponse) Failed

func (r GetItemResponse) Failed() error

type ListItemsRequest

type ListItemsRequest struct{}

ListItemsRequest is a request struct for ListItems endpoint.

type ListItemsResponse

type ListItemsResponse struct {
	Items []todo.Item
	Err   error
}

ListItemsResponse is a response struct for ListItems endpoint.

func (ListItemsResponse) Failed

func (r ListItemsResponse) Failed() error

type UpdateItemRequest

type UpdateItemRequest struct {
	Id         string
	ItemUpdate todo.ItemUpdate
}

UpdateItemRequest is a request struct for UpdateItem endpoint.

type UpdateItemResponse

type UpdateItemResponse struct {
	Item todo.Item
	Err  error
}

UpdateItemResponse is a response struct for UpdateItem endpoint.

func (UpdateItemResponse) Failed

func (r UpdateItemResponse) Failed() error

Jump to

Keyboard shortcuts

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