Documentation
¶
Index ¶
- Constants
- Variables
- func QualifiedTable(schema, table string) string
- func WithStatement(ctx context.Context, statement *Statement) context.Context
- type Capabilities
- type ConstraintError
- type ConstraintKind
- type DebugDriver
- func (d *DebugDriver) BeginTx(ctx context.Context, opts *TxOptions) (Tx, error)
- func (d *DebugDriver) DB() *sql.DB
- func (d *DebugDriver) Exec(ctx context.Context, query string, args []any) (Result, error)
- func (d *DebugDriver) Query(ctx context.Context, query string, args []any) (Rows, error)
- func (d *DebugDriver) Tx(ctx context.Context) (Tx, error)
- type DebugTx
- type Dialect
- type Driver
- type ExecQuerier
- type Result
- type RowRef
- type Rows
- type Statement
- type StatementKind
- type Tx
- type TxOptions
- type UnsupportedError
Constants ¶
const ( Postgres = "postgres" SQLite = "sqlite3" )
Variables ¶
var ErrNoRows = sql.ErrNoRows
ErrNoRows is returned when a statement that must produce a row produces none. It is the database/sql sentinel so that errors.Is(err, sql.ErrNoRows) keeps working.
Functions ¶
func QualifiedTable ¶ added in v0.3.1
QualifiedTable returns the schema-qualified table name used in Statement.
Types ¶
type Capabilities ¶ added in v0.3.0
type ConstraintError ¶ added in v0.3.0
type ConstraintError struct {
Kind ConstraintKind
Constraint string
Table string
Err error
}
ConstraintError is returned by drivers when a statement violates a constraint.
func (*ConstraintError) Error ¶ added in v0.3.0
func (e *ConstraintError) Error() string
func (*ConstraintError) Unwrap ¶ added in v0.3.0
func (e *ConstraintError) Unwrap() error
type ConstraintKind ¶ added in v0.3.0
type ConstraintKind uint8
ConstraintKind classifies a violated database constraint.
const ( Unique ConstraintKind = iota ForeignKey Check NotNull Exclusion )
Constraint kinds reported by drivers.
type DebugDriver ¶
type DebugDriver struct {
Driver
// contains filtered or unexported fields
}
func (*DebugDriver) DB ¶ added in v0.3.0
func (d *DebugDriver) DB() *sql.DB
DB exposes the migration connection when supported by the wrapped driver.
type DebugTx ¶
type DebugTx struct {
Tx
// contains filtered or unexported fields
}
type Driver ¶
type ExecQuerier ¶
type Statement ¶ added in v0.3.1
type Statement struct {
Kind StatementKind
Tables []string
Lock bool
// IDColumn names the primary key column of the queried node when the
// statement selects it. Empty otherwise.
IDColumn string
// PointRead reports that the WHERE clause is a conjunction that pins the
// result to specific rows of the node table (Tables[0]) by primary key or
// unique columns. Rows in other tables may still affect the result.
PointRead bool
// RequestedIDs holds the primary key values a point read asked for. A
// cache uses them to invalidate negative results when such rows appear.
RequestedIDs []any
// Rows lists the rows a write touched. sqlgraph fills it after the
// statement executes, once RETURNING has been scanned, so readers must
// consult it only after the rows are closed or Exec returned.
Rows []RowRef
// Bulk lists tables a write touched without identifying the rows.
Bulk []string
}
Statement carries the structural metadata sqlgraph knows about a statement it is about to execute. Driver wrappers (caches, tracers) read it from the context. It travels in the context rather than through the Driver interface so that intermediate wrappers unaware of it cannot drop it.
Table names are schema-qualified ("schema.table") when a schema is set.
func StatementFrom ¶ added in v0.3.1
type StatementKind ¶ added in v0.3.1
type StatementKind uint8
const ( StatementRead StatementKind = iota + 1 StatementWrite )
type Tx ¶
type Tx interface {
ExecQuerier
Commit() error
Rollback() error
}
type UnsupportedError ¶ added in v0.3.0
UnsupportedError is returned when a feature is used on a dialect that lacks it.
func (*UnsupportedError) Error ¶ added in v0.3.0
func (e *UnsupportedError) Error() string
Directories
¶
| Path | Synopsis |
|---|---|
|
Package pg implements the driver boundary with native pgx codecs.
|
Package pg implements the driver boundary with native pgx codecs. |
|
Package sql provides wrappers around the standard database/sql package to allow the generated code to interact with a statically-typed API.
|
Package sql provides wrappers around the standard database/sql package to allow the generated code to interact with a statically-typed API. |
|
schema
Package schema contains all schema migration logic for SQL dialects.
|
Package schema contains all schema migration logic for SQL dialects. |
|
sqlgraph
Package sqlgraph provides graph abstraction capabilities on top of sql-based databases for ent codegen.
|
Package sqlgraph provides graph abstraction capabilities on top of sql-based databases for ent codegen. |
|
Package sqlite uses ncruces SQLite through database/sql.
|
Package sqlite uses ncruces SQLite through database/sql. |