go-api-boilerplate: github.com/vardius/go-api-boilerplate/pkg/application Index | Files

package application

import "github.com/vardius/go-api-boilerplate/pkg/application"

Package errors implements functions to manipulate errors.

Index

Package Files

app.go debug.go errors.go

Variables

var (
    ErrInvalid           = errors.New("validation failed")
    ErrUnauthorized      = errors.New("access denied")
    ErrForbidden         = errors.New("forbidden")
    ErrNotFound          = errors.New("not found")
    ErrInternal          = errors.New("internal system error")
    ErrTemporaryDisabled = errors.New("temporary disabled")
    ErrTimeout           = errors.New("timeout")
)

Application errors

type Adapter Uses

type Adapter interface {
    Start(ctx context.Context) error
    Stop(ctx context.Context) error
}

Adapter interface

type App Uses

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

App represents application service

func New Uses

func New(logger *log.Logger) *App

New provides new service application

func (*App) AddAdapters Uses

func (app *App) AddAdapters(adapters ...Adapter)

AddAdapters adds adapters to application service

func (*App) Run Uses

func (app *App) Run(ctx context.Context)

Run runs the service application

func (*App) WithShutdownTimeout Uses

func (app *App) WithShutdownTimeout(timeout time.Duration)

WithShutdownTimeout overrides default shutdown timout

type DebugAdapter Uses

type DebugAdapter struct {
    *http.Server
}

DebugAdapter ./...

func NewDebugAdapter Uses

func NewDebugAdapter(address string) *DebugAdapter

NewDebugAdapter provides new debug adapter /debug/pprof - Added to the default mux by importing the net/http/pprof package. /debug/vars - Added to the default mux by importing the expvar package.

func (*DebugAdapter) Start Uses

func (adapter *DebugAdapter) Start(ctx context.Context) error

Start start http application adapter

func (*DebugAdapter) Stop Uses

func (adapter *DebugAdapter) Stop(ctx context.Context) error

Stop stops http application adapter

Package application imports 9 packages (graph) and is imported by 12 packages. Updated 2020-08-04. Refresh now. Tools for package owners.