21 lines
625 B
Go
21 lines
625 B
Go
// +build go1.8
|
|
|
|
package gorm
|
|
|
|
import (
|
|
"context"
|
|
"database/sql"
|
|
)
|
|
|
|
// SQLCommon is the minimal database connection functionality gorm requires. Implemented by *sql.DB.
|
|
type SQLCommon interface {
|
|
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
|
|
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
|
|
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
|
|
QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
|
|
}
|
|
|
|
type sqlDb interface {
|
|
BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
|
|
}
|