database

package
v0.0.0-...-ebf8853 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Handle
	BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error)
}

Client is a handle capable of starting new transactions.

func New

func New(dialect string, conn *sql.DB) (Client, error)

New creates a new Client for the specified dialect and connection.

type Handle

type Handle interface {
	Ent() *ent.Client
	Sqlc() sqlc.Querier
}

Handle has two different entry points, Ent and Sqlc style. They can be mixed and matched as desired.

type Tx

type Tx interface {
	Handle
	Commit() error
	Rollback() error
}

Tx implements a database Handle as well as commit/rollback functions. While the Tx interface itself does not support nested invocations the resulting *ent.Client may attempt to make one. For this purpose ent is supplied with a transaction wrapper that implements nested transactions using sql savepoints.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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