svc

package
v0.0.0-...-4734723 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConfigInvalid is returned when the config parse is invalid.
	ErrConfigInvalid = `Invalid or missing config`
)

Functions

This section is empty.

Types

type Option

type Option func(o *Options)

Option defines a single option function.

func Config

func Config(val *config.Config) Option

Config provides a function to set the config option.

func Logger

func Logger(val log.Logger) Option

Logger provides a function to set the logger option.

func Middleware

func Middleware(val ...func(http.Handler) http.Handler) Option

Middleware provides a function to set the middleware option.

type Options

type Options struct {
	Logger     log.Logger
	Config     *config.Config
	Middleware []func(http.Handler) http.Handler
}

Options defines the available options for this package.

type Phoenix

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

Phoenix defines implements the business logic for Service.

func (Phoenix) Config

func (p Phoenix) Config(w http.ResponseWriter, r *http.Request)

Config implements the Service interface.

func (Phoenix) ServeHTTP

func (p Phoenix) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the Service interface.

func (Phoenix) Static

func (p Phoenix) Static(ttl int) http.HandlerFunc

Static simply serves all static files.

type Service

type Service interface {
	ServeHTTP(http.ResponseWriter, *http.Request)
	Config(http.ResponseWriter, *http.Request)
}

Service defines the extension handlers.

func NewInstrument

func NewInstrument(next Service, metrics *metrics.Metrics) Service

NewInstrument returns a service that instruments metrics.

func NewLogging

func NewLogging(next Service, logger log.Logger) Service

NewLogging returns a service that logs messages.

func NewService

func NewService(opts ...Option) Service

NewService returns a service implementation for Service.

func NewTracing

func NewTracing(next Service) Service

NewTracing returns a service that instruments traces.

Jump to

Keyboard shortcuts

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