datastore

package
v0.0.0-...-b2828fe Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2014 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB = &modl.DbMap{Dialect: modl.PostgresDialect{}}

DB is the global database.

DBH is a modl.SqlExecutor interface to DB, the global database. It is better to use DBH instead of DB because it prevents you from calling methods that could not later be wrapped in a transaction.

Functions

func Connect

func Connect()

Connect connects to the PostgreSQL database specified by the PG* environment variables. It calls log.Fatal if it encounters an error.

func Create

func Create()

Create the database schema. It calls log.Fatal if it encounters an error.

func Drop

func Drop()

Drop the database schema.

Types

type Datastore

type Datastore struct {
	Posts thesrc.PostsService
	// contains filtered or unexported fields
}

A Datastore accesses the datastore (in PostgreSQL).

func NewDatastore

func NewDatastore(dbh modl.SqlExecutor) *Datastore

NewDatastore creates a new client for accessing the datastore (in PostgreSQL). If dbh is nil, it uses the global DB handle.

func NewMockDatastore

func NewMockDatastore() *Datastore

Jump to

Keyboard shortcuts

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