entdriver

package
v1.132.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package entdriver provides ent driver wrappers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StackDriver

type StackDriver struct {
	// Driver is the ent driver that runs the queries.
	*entsql.Driver
}

StackDriver is an ent driver that records the stack of the caller on each database error. The stack holds the repository method that ran the query, so Sentry groups a database failure by the query that failed. Do not run ent's schema API (Schema.Create, Diff, WriteTo) through it: that code casts the result rows to *sql.Rows, which stackRows is not.

func NewStackDriver

func NewStackDriver(driver *entsql.Driver) *StackDriver

NewStackDriver wraps driver so database errors record the caller's stack.

func (*StackDriver) BeginTx

func (d *StackDriver) BeginTx(ctx context.Context, opts *entsql.TxOptions) (dialect.Tx, error)

BeginTx starts a transaction with options. The generated ent client calls it through an interface check, so the wrapper must keep it.

func (*StackDriver) Exec

func (d *StackDriver) Exec(ctx context.Context, query string, args, v any) error

Exec runs a statement and records the stack of the caller on error.

func (*StackDriver) Query

func (d *StackDriver) Query(ctx context.Context, query string, args, v any) error

Query runs a query and records the stack of the caller on error.

func (*StackDriver) Tx

func (d *StackDriver) Tx(ctx context.Context) (dialect.Tx, error)

Tx starts a transaction whose errors record the stack of the caller.

Jump to

Keyboard shortcuts

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