transaction

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package transaction implements a transaction middleware for REST endpoints using the ent db client

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrProcessingRequest is returned when the request cannot be processed
	ErrProcessingRequest = errors.New("error processing request, please try again")
)

Functions

func FromContext

func FromContext(ctx context.Context) *ent.Tx

FromContext returns a TX Client stored inside a context, or nil if there isn't one

func NewContext

func NewContext(parent context.Context, c *ent.Tx) context.Context

NewContext returns a new context with the given TX Client attached

Types

type Client

type Client struct {
	EntDBClient *ent.Client
	Logger      *zap.SugaredLogger
}

func (*Client) Middleware

func (d *Client) Middleware(next echo.HandlerFunc) echo.HandlerFunc

Middleware returns a middleware function for transactions on REST endpoints

Jump to

Keyboard shortcuts

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