Files
dbx/interfaces.go
T
end f9befa1b0a refactor: split dbx package into domain files
Reorganize monolithic dbx.go and utility.go into focused files by
concern, add package doc.go, and gitignore coverage.out.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 17:46:54 -07:00

55 lines
1.4 KiB
Go

package dbx
import (
"context"
"database/sql"
"github.com/go-jet/jet/v2/qrm"
)
// SQLOFunc is a function that returns a *sql.DB pointer.
type SQLOFunc = func() *sql.DB
// Queryable interface is an SQL driver object that can execute SQL statements
// for Jet.
type Queryable interface {
qrm.Queryable
Query(string, ...any) (*sql.Rows, error)
}
// Executable interface is an SQL driver object that can execute SQL statements
// for Jet.
type Executable interface {
qrm.Executable
Exec(string, ...any) (sql.Result, error)
}
// ExecutableTx interface is an SQL driver object that implements the Executable
// interface and can also begin a transaction.
type ExecutableTx interface {
Executable
Begin() (*sql.Tx, error)
}
// QueryExec interface is an SQL driver object that can execute SQL statements for Jet
// and query results.
type QueryExec interface {
Queryable
Executable
}
// QueryExecTx interface is an SQL driver object that can execute SQL statements for
// Jet, query results, and begin a transaction.
type QueryExecTx interface {
Queryable
ExecutableTx
}
// Statement is a common Jet statement for all SQL operations.
type Statement interface {
Query(db qrm.Queryable, destination any) error
QueryContext(ctx context.Context, db qrm.Queryable, destination any) error
Exec(db qrm.Executable) (sql.Result, error)
ExecContext(ctx context.Context, db qrm.Executable) (sql.Result, error)
}