funcenter

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: Apache-2.0 Imports: 1 Imported by: 3

README

funcenter

😄 funcenter is a function middleware system

CircleCI GoDoc License GitHub release Go Report Card CodeFactor codecov Sourcegraph Made by Manfred Touron

funcenter allows you to create middlewares for functions, allowing you to have a clean codebase while having per-function tracing/logging/etc capabilities

Usage

See the examples directory

Install

$ go get -u moul.io/funcenter

License

© 2019 Manfred Touron - Apache-2.0 License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(ctx context.Context)

func Enter

func Enter(ctx context.Context, args ...interface{}) context.Context

func Leave

func Leave(ctx context.Context)

func New

func New(ctx context.Context, middlewares ...Middleware) (context.Context, error)

Types

type Middleware

type Middleware interface {
	OnInit(context.Context) (context.Context, error)
	OnEnter(context.Context, ...interface{}) context.Context
	OnLeave(context.Context)
	OnClose(context.Context)
}

func GetMiddlewares

func GetMiddlewares(ctx context.Context) []Middleware

func OnCloseMiddleware

func OnCloseMiddleware(fn func(context.Context)) Middleware

func OnEnterMiddleware

func OnEnterMiddleware(fn func(context.Context, ...interface{}) context.Context) Middleware

func OnInitMiddleware

func OnInitMiddleware(fn func(context.Context) (context.Context, error)) Middleware

func OnLeaveMiddleware

func OnLeaveMiddleware(fn func(context.Context)) Middleware

Directories

Path Synopsis
examples module
logging
zap Module

Jump to

Keyboard shortcuts

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