Documentation
¶
Index ¶
- type Config
- type Factory
- type FactoryOption
- type Handler
- type Logger
- type NoopLogger
- func (n NoopLogger) DPanic(ctx context.Context, msg string, keysAndValues ...interface{})
- func (n NoopLogger) Debug(ctx context.Context, msg string, keysAndValues ...interface{})
- func (n NoopLogger) Error(ctx context.Context, msg string, keysAndValues ...interface{})
- func (n NoopLogger) Info(ctx context.Context, msg string, keysAndValues ...interface{})
- type Option
- func WithHealthCheck(f func(http.HandlerFunc) http.HandlerFunc) Option
- func WithLivenessCheck(f func(http.HandlerFunc) http.HandlerFunc) Option
- func WithReadinessCheck(f func(http.HandlerFunc) http.HandlerFunc) Option
- func WithServerConfig(c Config) Option
- func WithServerLogger(l Logger) Option
- func WithServerPort(p int) Option
- func WithServerReadTimeout(t int) Option
- func WithServerRouter(r Handler) Option
- func WithServerTracer(t opentracing.Tracer) Option
- func WithServerWriteTimeout(t int) Option
- func WithShutdownDelaySeconds(d int) Option
- func WithSwaggerFile(f string) Option
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
Factory interface to create a server.
func NewFactory ¶
func NewFactory(options ...FactoryOption) Factory
NewFactory instantiates a new server Factory
type FactoryOption ¶
type FactoryOption interface {
// contains filtered or unexported methods
}
FactoryOption interface to identify functional options
func WithConfig ¶
func WithConfig(c Config) FactoryOption
WithConfig provides option to provide a server configuration.
func WithLogger ¶
func WithLogger(l Logger) FactoryOption
WithLogger provides option to provide a logger implementation. Noop is default
func WithRouter ¶
func WithRouter(rf func() Handler) FactoryOption
WithRouter provides option to provide a function which returns which router will be used. By default we use http.ServeMux
func WithTracer ¶
func WithTracer(t opentracing.Tracer) FactoryOption
WithTracer provides option to provide a tracer implementation. Noop is default
type Logger ¶
type Logger interface { Debug(ctx context.Context, msg string, keysAndValues ...interface{}) Error(ctx context.Context, msg string, keysAndValues ...interface{}) Info(ctx context.Context, msg string, keysAndValues ...interface{}) }
Logger is a local interface for logging functionality
type NoopLogger ¶
type NoopLogger struct{}
NoopLogger is a noop logger implementation.
func (NoopLogger) DPanic ¶
func (n NoopLogger) DPanic(ctx context.Context, msg string, keysAndValues ...interface{})
DPanic ...
func (NoopLogger) Debug ¶
func (n NoopLogger) Debug(ctx context.Context, msg string, keysAndValues ...interface{})
Debug ...
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option interface to identify functional options
func WithHealthCheck ¶
func WithHealthCheck(f func(http.HandlerFunc) http.HandlerFunc) Option
WithHealthCheck provides option to provide additional health checks that are performed on health check probe.
func WithLivenessCheck ¶
func WithLivenessCheck(f func(http.HandlerFunc) http.HandlerFunc) Option
WithLivenessCheck provides option to provide additional liveness checks that are performed on liveness probe.
func WithReadinessCheck ¶
func WithReadinessCheck(f func(http.HandlerFunc) http.HandlerFunc) Option
WithReadinessCheck provides option to provide additional readiness checks that are performed on readiness probe.
func WithServerConfig ¶
WithServerConfig provides option to provide a server configuration.
func WithServerLogger ¶
WithServerLogger provides option to provide a logger to use while writing.
func WithServerPort ¶
WithServerPort provides option to provide the port on which the server listens. Default is 80
func WithServerReadTimeout ¶
WithServerReadTimeout provides option to provide the maximum duration in milliseconds for reading the entire request, including the body. defaults to 10 seconds
func WithServerRouter ¶
WithServerRouter provides option to provide hooks to use the http request to mutate the request context.
func WithServerTracer ¶
func WithServerTracer(t opentracing.Tracer) Option
WithServerTracer provides option to provide a tracer to use while writing.
func WithServerWriteTimeout ¶
WithServerWriteTimeout provides option to provide the maximum duration in milliseconds before timing out writes of the response. defaults to 10 seconds
func WithShutdownDelaySeconds ¶
WithShutdownDelaySeconds provides option to provide the duration by which server shutdown is delayed after receiving an os signal. defaults to 5 seconds
func WithSwaggerFile ¶
WithSwaggerFile provides option to provide the swagger file location. Default is '/swagger.json'