db

package
v0.0.0-...-453881e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 19, 2018 License: MIT Imports: 4 Imported by: 8

Documentation

Overview

Package db contains logic for connecting to the database.

Index

Constants

This section is empty.

Variables

View Source
var Conn *sql.DB

Conn is a shared connection used by all database queries.

View Source
var DefaultConnection = &DatabaseURLConnector{}

DefaultConnection connects to a Postgres database using the DATABASE_URL environment variable.

Functions

func Connected

func Connected() bool

Connected returns true if a connection exists to the database.

Types

type Connector

type Connector interface {
	Connect(dbConns int) (*sql.DB, error)
}

Connector establishes a connection to a Postgres database, with the given number of connections, and stores the connection in conn.

type DatabaseURLConnector

type DatabaseURLConnector struct {
	// contains filtered or unexported fields
}

DatabaseURLConnector connects to the database using the DATABASE_URL environment variable.

func (*DatabaseURLConnector) Connect

func (dc *DatabaseURLConnector) Connect(dbConns int) (*sql.DB, error)

Connect to the database using the DATABASE_URL environment variable with the given number of database connections, and store the result in conn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL