2019-09-27 11:46:31 +02:00
|
|
|
package qrm
|
2019-04-07 09:58:12 +02:00
|
|
|
|
2019-06-20 12:22:19 +02:00
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"database/sql"
|
|
|
|
|
)
|
2019-04-07 09:58:12 +02:00
|
|
|
|
2021-05-16 18:46:50 +02:00
|
|
|
// DB is common database interface used by query result mapping
|
|
|
|
|
// Both *sql.DB and *sql.Tx implements DB interface
|
2019-06-23 18:55:57 +02:00
|
|
|
type DB interface {
|
2019-04-07 09:58:12 +02:00
|
|
|
Exec(query string, args ...interface{}) (sql.Result, error)
|
2019-06-20 12:22:19 +02:00
|
|
|
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
|
2019-04-07 09:58:12 +02:00
|
|
|
Query(query string, args ...interface{}) (*sql.Rows, error)
|
2019-06-20 12:22:19 +02:00
|
|
|
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
|
2019-04-07 09:58:12 +02:00
|
|
|
}
|
2022-05-13 14:04:11 +02:00
|
|
|
|
|
|
|
|
// Queryable interface for sql QueryContext method
|
|
|
|
|
type Queryable interface {
|
|
|
|
|
QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Executable interface for sql ExecContext method
|
|
|
|
|
type Executable interface {
|
|
|
|
|
ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
|
|
|
|
|
}
|