greetertransport

package
v0.0.0-...-cb8cfd3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Server *server.Config
}

Config is a struct to contain all the needed configuration for our JSONService.

type TService

type TService struct {
	Endpoints greeterendpoint.Endpoints
}

TService will implement server.RPCService and handle all requests to the server.

func NewTService

func NewTService(cfg *Config, endpoints greeterendpoint.Endpoints) *TService

NewTService will instantiate a RPCService with the given configuration.

func (*TService) ContextEndpoints

func (s *TService) ContextEndpoints() map[string]map[string]server.ContextHandlerFunc

ContextEndpoints may be needed if your server has any non-RPC-able endpoints. In this case, we have none but still need this method to satisfy the server.RPCService interface.

func (*TService) ContextMiddleware

func (s *TService) ContextMiddleware(h server.ContextHandler) server.ContextHandler

ContextMiddleware provides a server.ContextHAndler hook wrapped around all requests. This could be handy if you need to decorate the request context.

func (*TService) Greeting

Greeting implementation of the gRPC service.

func (*TService) JSONEndpoints

func (s *TService) JSONEndpoints() map[string]map[string]server.JSONContextEndpoint

JSONEndpoints is a listing of all endpoints available in the TService.

func (*TService) JSONMiddleware

JSONMiddleware provides a JSONEndpoint hook wrapped around all requests. In this implementation, we're using it to provide application logging and to check errors and provide generic responses.

func (*TService) Middleware

func (s *TService) Middleware(h http.Handler) http.Handler

Middleware provides an http.Handler hook wrapped around all requests. In this implementation, we're using a GzipHandler middleware to compress our responses.

func (*TService) Prefix

func (s *TService) Prefix() string

Prefix returns the string prefix used for all endpoints within this service.

func (*TService) Service

func (s *TService) Service() (*grpc.ServiceDesc, interface{})

Service provides the TService with a description of the service to serve and the implementation.

Jump to

Keyboard shortcuts

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