buffalotools

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DatabaseMiddleware

func DatabaseMiddleware(db, rodb *pop.Connection) buffalo.MiddlewareFunc

DatabaseMiddleware returns a database connection provider middleware that will add the db into the `tx` context variable, in case its a PUT/POST/DELETE/PATCH method, it will wrap the handler in a transaction, otherwise it will just add the connection in the context.

Provided middleware can also consider a seccond read only replica database connection (rodb) that will be used on idempotent operations if present.

func DatabaseProvider

func DatabaseProvider(config fs.FS) func(name string) *pop.Connection

DatabaseProvider returns a function that returns the database connection for the current environment.

func NewPartialFeeder

func NewPartialFeeder(fs fs.FS) func(string) (string, error)

NewPartialFeeder returns a partialFeeder that looks up for template files in the given FS and returns its contents as string.

func NewRequestIDMiddleware

func NewRequestIDMiddleware(headerKey string) buffalo.MiddlewareFunc

NewRequestIDMiddleware returns a middleware that adds a request ID to the context. It will first attempt to look if the passed headerkey is set in the request headers. If it is not set, it will generate a new UUID and set it in the logs.

Types

This section is empty.

Jump to

Keyboard shortcuts

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