Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { // Exec queries the database and returns the affected rows Exec(sql string, args ...interface{}) (int64, error) // Query queries the database and return the rows Query(sql string, args ...interface{}) (Rows, error) // QueryRow queries the database and return a single row QueryRow(sql string, args ...interface{}) Row // BeginTx Starts a database Transaction BeginTx() (Transaction, error) }
type Row ¶
type Row interface { // Scan reads the values from the current row into dest values positionally Scan(dest ...interface{}) error }
Row is the result returned from a query
type Rows ¶
type Rows interface { // Scan reads the values from the current row into dest values positionally Scan(dest ...interface{}) error // Next prepares the next row for reading. It returns true if there is another row and false if no more rows are available. It automatically closes rows when all rows are read. Next() bool // Close closes the rows, making the connection ready for use again. It is safe to call Close after rows is already closed. Close() // Err returns any error that occurred while reading. Err() error }
Rows is the result set returned from a query
type Transaction ¶
type Transaction interface { // Commit commits the database transaction Commit() error // Rollback rollbacks the database transaction Rollback() error // Exec queries the database and returns the affected rows Exec(sql string, args ...interface{}) (int64, error) // Query queries the database and return the rows Query(sql string, args ...interface{}) (Rows, error) // QueryRow queries the database and return a single row QueryRow(sql string, args ...interface{}) Row }
Transaction represents an SQL database transaction
Click to show internal directories.
Click to hide internal directories.