Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
Connect connects to the database specified by the dbURL. It tests the connection by calling db.Ping().
Example ¶
gp := ghost_postgres.New() defer gp.Terminate() if err := gp.Prepare(); err != nil { fmt.Println(err) return } db, err := Connect(gp.URL()) if err != nil { fmt.Println(err) return } fmt.Println(db != nil)
Output: true
func Exists ¶
Exists wraps a query with a simple exists check,
returning a bool, a la SELECT EXISTS ( -- subquery ) returning a bool
example usage:
if Exists("SELECT * FROM foo WHERE bar = 'baz'") { // do something }
Types ¶
type SQLReadWriter ¶
type WrappedDB ¶
type WrappedDB interface { SQLReadWriter Beginx() (WrappedTx, error) Close() error OpenConnections() int }
func MustConnect ¶
type WrappedTx ¶
type WrappedTx interface { SQLReadWriter Commit() error Rollback() error }
Click to show internal directories.
Click to hide internal directories.