Back to

Package gogrpcservice

Latest Go to latest

The highest tagged major version is .

Published: Sep 7, 2020 | License: MIT | Module:



const Version = "0.0.9"

Version is incremented using bump2version


var (
	// GrpcMethodDescriptor ...
	GrpcMethodDescriptor = grpcMethodDescriptor("methodDesc")

	// NotReady ...
	NotReady = status.Error(codes.Unavailable, "the service is currently unavailable")

type BootstrapGrpcOptions

type BootstrapGrpcOptions struct {
	USI grpc.UnaryServerInterceptor
	SSI grpc.StreamServerInterceptor

BootstrapGrpcOptions ...

type DialOptions

type DialOptions struct {
	TimeoutSec int

DialOptions ...

type GrpcMethodName

type GrpcMethodName string

GrpcMethodName ...

type Service

type Service struct {
	Name         string
	Version      string
	BuildTime    string
	Echo         *echo.Echo
	HTTPServer   *http.Server
	GrpcServer   *grpc.Server
	Health       *health.Server
	TracerCloser io.Closer
	Ready        bool
	Healthy      bool

	// Hooks
	PostBootstrapHook func(bs *Service) error
	ConnectHook       func(bs *Service) error

	// Configuration
	HTTPHealthCheckURL string
	// contains filtered or unexported fields

Service ...

func (*Service) Bootstrap

func (bs *Service) Bootstrap(cliCtx *cli.Context) error

Bootstrap ...

func (*Service) BootstrapGrpc

func (bs *Service) BootstrapGrpc(ctx context.Context, cliCtx *cli.Context, opts *BootstrapGrpcOptions) error

BootstrapGrpc prepares a grpc service

func (*Service) BootstrapHTTP

func (bs *Service) BootstrapHTTP(ctx context.Context, cliCtx *cli.Context, handler *echo.Echo, mws []echo.MiddlewareFunc) error

BootstrapHTTP prepares an http service

func (*Service) ConfigureLogging

func (bs *Service) ConfigureLogging(cliCtx *cli.Context)

ConfigureLogging ...

func (*Service) ConfigureTracing

func (bs *Service) ConfigureTracing(cliCtx *cli.Context) (io.Closer, error)

ConfigureTracing ...

func (*Service) Connect

func (bs *Service) Connect(cliCtx *cli.Context) error

Connect connects to databases and other services

func (*Service) Dial

func (bs *Service) Dial(ctx context.Context, host string, port uint, opts *DialOptions) (*grpc.ClientConn, error)

Dial connects to an external GRPC service

func (*Service) GracefulStop

func (bs *Service) GracefulStop()

GracefulStop ...

func (*Service) ServeGrpc

func (bs *Service) ServeGrpc(listener net.Listener) error

ServeGrpc prepares an http service

func (*Service) SetHealthy

func (bs *Service) SetHealthy(healthy bool)

SetHealthy ...

func (*Service) SetLogFormat

func (bs *Service) SetLogFormat(format logrus.Formatter)

SetLogFormat ...

func (*Service) SetLogLevel

func (bs *Service) SetLogLevel(level logrus.Level)

SetLogLevel ...

func (*Service) SetupGrpcHealthCheck

func (bs *Service) SetupGrpcHealthCheck(ctx context.Context)

SetupGrpcHealthCheck ...

func (*Service) SetupHTTPHealthCheck

func (bs *Service) SetupHTTPHealthCheck(ctx context.Context, handler *echo.Echo, url string)

SetupHTTPHealthCheck ...

type WrappedServerStream

type WrappedServerStream struct {
	// WrappedContext is the wrapper's own Context. You can assign it.
	WrappedContext context.Context

WrappedServerStream is a thin wrapper around grpc.ServerStream that allows modifying context.

func WrapServerStream

func WrapServerStream(stream grpc.ServerStream) *WrappedServerStream

WrapServerStream returns a ServerStream that has the ability to overwrite context.

func (*WrappedServerStream) Context

func (w *WrappedServerStream) Context() context.Context

Context returns the wrapper's WrappedContext, overwriting the nested grpc.ServerStream.Context()

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier