popverb

package
v0.0.0-...-66ac5e2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Transaction = func(db *pop.Connection) echo.MiddlewareFunc {
	return func(handler echo.HandlerFunc) echo.HandlerFunc {
		return func(ctx echo.Context) error {
			return db.Transaction(func(tx *pop.Connection) error {
				var lg *reverb.Logger
				clg := ctx.Get("lg")
				if clg != nil {
					lg = clg.(*reverb.Logger)
				}
				ctx.Set("tx", tx)

				before := tx.Elapsed
				err := handler(ctx)
				after := tx.Elapsed
				if clg != nil {
					logPopTimings(lg, []time.Duration{time.Duration(after - before)})
				}
				return err
			})
		}
	}
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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