Documentation
¶
Index ¶
Constants ¶
View Source
const ( MySQL = "mysql" SQLite = "sqlite3" Postgres = "postgres" )
Dialect names for external usage.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface {
// ExecQuerier inheritance
ExecQuerier
// Dialect returns the dialect name of the driver.
Dialect() string
// Tx starts and returns a new transaction.
// The provided context is used until the transaction is committed or rolled back.
Tx(context.Context) (Tx, error)
// Migrate runs the migrations
Migrate(FileSystem) error
// Ping sends a ping request
Ping(context.Context) error
// Close closes the underlying connection.
Close() error
}
Driver is the interface that wraps all necessary operations for ent clients.
type ExecQuerier ¶
ExecQuerier wraps the standard Exec and Query methods.
type Execer ¶
type Execer interface {
// Exec executes a query that doesn't return rows. For example, in SQL, INSERT or UPDATE.
// It scans the result into the pointer v. In SQL, you it's usually sql.Result.
Exec(ctx context.Context, query string, args, v interface{}) error
}
Execer wraps the exec database operations.
type LoggerDriver ¶
type LoggerDriver struct {
Driver
// contains filtered or unexported fields
}
LoggerDriver is a driver that logs all driver operations.
func (*LoggerDriver) Exec ¶
func (d *LoggerDriver) Exec(ctx context.Context, query string, args, v interface{}) error
Exec logs its params and calls the underlying driver Exec method.
type LoggerTx ¶
type LoggerTx struct {
Tx // underlying transaction.
// contains filtered or unexported fields
}
LoggerTx is a transaction implementation that logs all transaction operations.
type Querier ¶
type Querier interface {
// Query executes a query that returns rows, typically a SELECT in SQL.
// It scans the result into the pointer v. In SQL, you it's usually *sql.Rows.
Query(ctx context.Context, query string, args, v interface{}) error
}
Querier wraps the query database operations.
Directories
¶
| Path | Synopsis |
|---|---|
|
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. |
Click to show internal directories.
Click to hide internal directories.