Documentation ¶
Index ¶
- Constants
- func ServeCron(app *cron.Cron, graceTimeout time.Duration) error
- func ServeGRPC(server GRPCServer, address string, graceTimeout time.Duration) error
- func ServeREST(srv HTTPServer, address string, graceTimeout time.Duration) error
- func ServeRESTWithFiber(app *fiber.App, address string, graceTimeout time.Duration) error
- func WaitTermSig(handler func(context.Context) error) <-chan struct{}
- type GRPCServer
- type HTTPServer
Constants ¶
View Source
const ProtocolTCP4 = "tcp4"
Variables ¶
This section is empty.
Functions ¶
func ServeGRPC ¶
func ServeGRPC(server GRPCServer, address string, graceTimeout time.Duration) error
ServeGRPC start the gRPC server on the given address and add graceful shutdown handler
func ServeREST ¶
func ServeREST(srv HTTPServer, address string, graceTimeout time.Duration) error
ServeREST start the http server on the given address and add graceful shutdown handler
func ServeRESTWithFiber ¶
ServeRESTWithFiber start the http server using fiber on the given address and add graceful shutdown handler
func WaitTermSig ¶
WaitTermSig wait for termination signal and then execute the given handler The handler is usually transport shutdown, so we can properly shutdown our server upon SIGTERM. It returns channel which will be closed after the signal received and the handler executed. We can use the signal to wait for the shutdown to be finished.
Types ¶
type GRPCServer ¶
GRPCServer represents interface for grpc server
Click to show internal directories.
Click to hide internal directories.