Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config implements a server config.
func NewConfig ¶ added in v0.7.0
func NewConfig(ctors ConfigConstructors, opts ...config.Option) (*Config, error)
NewConfig returns a new configuration for a server built with the given constructors.
func (*Config) GRPCServer ¶ added in v0.7.0
func (*Config) HTTPServer ¶ added in v0.7.0
type ConfigConstructors ¶ added in v0.7.0
type ConfigConstructors struct {
// NewLogger is used to creates a new logger config.
NewLoggerConfig func(...config.Option) (log.Config, error)
// NewDB is used to creates a new db config.
NewDBConfig func(...config.Option) (sql.Config, error)
// NewGRPCServer is used to create a new gRPC server config.
NewGRPCServerConfig func(...config.Option) (grpc.Config, error)
// NewHTTPServer is used to create a new HTTP server config.
NewHTTPServerConfig func(...config.Option) (http.Config, error)
}
ConfigConstructors injects a set of constructors to be used when creating a new server config.
type GRPCServer ¶ added in v0.7.0
type GRPCServer interface {
// Serve is the entry point for a service and will be run it a goroutine.
// It is passed a channel to communicate the result.
Serve(result chan<- error)
// Stop stops the server.
Stop()
// Registers the given services with this server.
Register([]grpc.Service)
}
GRPCServer abstracts a gRPC server.
type HTTPServer ¶ added in v0.7.0
type HTTPServer interface {
// Serve is the entry point for a service and will be run it a goroutine.
// It is passed a channel to communicate the result.
Serve(result chan<- error)
// Stop stops the server.
Stop()
// Handle associates the given handler with the server.
Handle(mux nethttp.Handler)
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a combination grpc and http server.
func New ¶ added in v0.7.0
func New(info build.Information, c ServerConstructors) (*Server, error)
NewServer returns a combinator grpc and http server.
type ServerConstructors ¶ added in v0.7.0
type ServerConstructors struct {
// NewConfig is used to create a new server config.
NewConfig func(...config.Option) (*Config, error)
// NewLogger is used to create a new logger.
NewLogger func(log.Config) log.Logger
// NewDB is used to create a new DB.
NewDB func(sql.Config, ...sql.Option) (sql.DB, error)
// NewGRPCServer is used to create a new gRPC server.
NewGRPCServer func(grpc.Config, ...grpc.Option) (GRPCServer, error)
// NewHTTPServer is used to create a new HTTP server.
NewHTTPServer func(http.Config, ...http.Option) (HTTPServer, error)
}
ServerConstructors injects a set of constructors to be used when creating a new server.
Click to show internal directories.
Click to hide internal directories.