Documentation ¶
Overview ¶
Package flexgrpc provides a default set of configuration for hosting a grpc server in a service.
Example ¶
package main import ( "context" "time" "github.com/go-flexible/flexgrpc" "google.golang.org/grpc" ) func main() { srv := flexgrpc.New( &flexgrpc.Config{Addr: ":8080"}, grpc.ConnectionTimeout(10*time.Second), ) _ = srv.Run(context.Background()) }
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const Port = 50051
Port is the default gRPC port used in examples.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Addr string
}
Config represents configuration for the GRPC server.
type Server ¶
type Server struct { Connection *grpc.Server Now func() time.Time // contains filtered or unexported fields }
Server represents a collection of functions for starting and running an RPC server.
func New ¶
func New(config *Config, options ...grpc.ServerOption) *Server
New sets up a new grpc server.
Click to show internal directories.
Click to hide internal directories.