Documentation ¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func Drop(db *sql.DB) error
- func MustAsset(name string) []byte
- func New(connectionString string) (coordinate.Coordinate, error)
- func NewWithClock(connectionString string, clk clock.Clock) (coordinate.Coordinate, error)
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func Upgrade(db *sql.DB) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func Drop ¶
Drop clears a database by running all of the migrations in reverse, ultimately resulting in dropping all of the tables.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func New ¶
func New(connectionString string) (coordinate.Coordinate, error)
New creates a new coordinate.Coordinate connection object using the provided PostgreSQL connection string. The connection string may be an expanded PostgreSQL string, a "postgres:" URL, or a URL without a scheme. These are all equivalent:
"host=localhost user=postgres password=postgres dbname=postgres" "postgres://postgres:postgres@localhost/postgres" "//postgres:postgres@localhost/postgres"
See http://godoc.org/github.com/lib/pq for more details. If parameters are missing from this string (or if you pass an empty string) they can be filled in from environment variables as well; see http://www.postgresql.org/docs/current/static/libpq-envars.html.
The returned Coordinate object carries around a connection pool with it. It can (and should) be shared across the application. This New() function should be called sparingly, ideally exactly once.
func NewWithClock ¶
func NewWithClock(connectionString string, clk clock.Clock) (coordinate.Coordinate, error)
NewWithClock creates a new coordinate.Coordinate connection object, using an explicit time source. See New() for further details. Most application code should call New(), and use the default (real) time source; this entry point is intended for tests that need to inject a mock time source.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
This section is empty.