Documentation ¶
Overview ¶
Package database wraps `lib/pq` providing the basic methods for creating an entrypoint for our database.
Index ¶
Constants ¶
View Source
const ( ErrorInternal = errorCode(0) ErrorGeneric = errorCode(1) ErrorCreation = errorCode(2) ErrorTableCreation = errorCode(3) ErrorModelInvalid = errorCode(4) ErrorAlreadyExists = errorCode(5) ErrorNoData = errorCode(6) // ErrorExecute for any errors made by a bad query ErrorExecute = errorCode(7) ErrorNoRows = errorCode(8) ErrorMissingExtensions = errorCode(9) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB holds the connection pool to the database - created by a configuration object (`SQLConfig`).
func New ¶
New returns a SQL DB with the sql.DB set with the postgres DB connection string in the configuration
func (*DB) Close ¶
Close performs the release of any resources that `sql/database` DB pool created. This is usually meant to be used in the exitting of a program or `panic`ing.
Click to show internal directories.
Click to hide internal directories.