serverutil

package
v0.0.0-...-586ce9b Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(opts ...ServeContextOption) error

Types

type GRPCGateway

type GRPCGateway interface {
	RegisterGateway(ctx context.Context, mux *runtime.ServeMux, bind string, opts []grpc.DialOption) error
}

GRPCGateway is any structure that implements the RegisterGateway method which registers a new gateway to the http mux.

type GRPCServer

type GRPCServer interface {
	Register(server *grpc.Server)
}

GRPCServer is any structure that implements the Register method for grpc server registration.

type ServeContext

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

ServeContext encapsulates services and hooks for the Serve

type ServeContextOption

type ServeContextOption func(c *ServeContext)

ServeContextOption allows setup of the ServeContext

func WithContext

func WithContext(ctx context.Context) ServeContextOption

WithContext sets the ServeContext context. The context is then used within the grpc gateway connections.

func WithGRPC

func WithGRPC() ServeContextOption

WithGRPC enables GRPC capabilities of the server

func WithGRPCGateway

func WithGRPCGateway() ServeContextOption

WithGRPCGateway enables gateway capabilities of the server

func WithOnExit

func WithOnExit(cb func()) ServeContextOption

WithOnExit adds the onExit callback fired when the service is exiting

func WithOnListen

func WithOnListen(cb func()) ServeContextOption

WithOnListen adds the onListen callback fired when the listening starts

func WithPort

func WithPort(port string) ServeContextOption

WithPort sets the port of the context. If no port is set, one will be picked by the system

func WithPubSub

func WithPubSub() ServeContextOption

WithPubSub enables PubSub capabilities of the server. Enabling PubSub also enables the gateway option

func WithServices

func WithServices(s ...interface{}) ServeContextOption

WithServices adds services that should be registered within the multiplexer

Jump to

Keyboard shortcuts

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