-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinterfaces.go
More file actions
31 lines (26 loc) · 786 Bytes
/
interfaces.go
File metadata and controls
31 lines (26 loc) · 786 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package sqlh
import (
"database/sql"
)
// IQueries defines the methods common to types that can run queries.
type IQueries interface {
Exec(query string, args ...interface{}) (sql.Result, error)
Query(query string, args ...interface{}) (*sql.Rows, error)
QueryRow(query string, args ...interface{}) *sql.Row
}
// IPrepares defines the methods required to run prepared statements.
type IPrepares interface {
Prepare(query string) (*sql.Stmt, error)
}
// IIterates defines the methods required for iterating a query result set.
type IIterates interface {
Close() error
Columns() ([]string, error)
Err() error
Next() bool
Scan(dest ...interface{}) error
}
// IBegins defines the method(s) required to open a transaction.
type IBegins interface {
Begin() (*sql.Tx, error)
}