ginmiddleware

package
v0.11.15 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureResponseBody

func CaptureResponseBody(c *gin.Context, passThrough bool) (*bytes.Buffer, gin.ResponseWriter)

func Client

func Client[C ent.EntClient[T], T ent.EntTx[C]](c *gin.Context, name EntKey[C, T]) C

func DefaultOASErrorHandler

func DefaultOASErrorHandler(c *gin.Context, err error)

func Transaction

func Transaction[C ent.EntClient[T], T ent.EntTx[C]](c *gin.Context, name EntKey[C, T]) T

func WithEntClient

func WithEntClient[C ent.EntClient[T], T ent.EntTx[C]](client C, name EntKey[C, T]) gin.HandlerFunc

func WithEntClientBase added in v0.9.0

func WithEntClientBase(client ent.EntClientBase, name string) gin.HandlerFunc

TODO: we don't want to have this weakly typed version, but we need it to have common app init

func WithOASValidation

func WithOASValidation(
	spec *openapi3.T,
	validateResponse bool,
	errorHandler OASErrorHandler,
	options *openapi3filter.Options,
) gin.HandlerFunc

func WithTransaction

func WithTransaction[C ent.EntClient[T], T ent.EntTx[C]](
	name EntKey[C, T],
	opts *sql.TxOptions,
	controls ...TransactionControl,
) gin.HandlerFunc

Types

type EntKey added in v0.9.0

type EntKey[C ent.EntClient[T], T ent.EntTx[C]] string

type OASErrorHandler

type OASErrorHandler func(c *gin.Context, err error)

func AllowUndefinedRoutes

func AllowUndefinedRoutes(handler OASErrorHandler) OASErrorHandler

type TransactionControl

type TransactionControl func(*gin.Context, *sql.TxOptions) bool

Jump to

Keyboard shortcuts

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