Skip to content

Instantly share code, notes, and snippets.

@chuckha
Created August 29, 2014 18:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chuckha/ba6390b4c80a767190fb to your computer and use it in GitHub Desktop.
Save chuckha/ba6390b4c80a767190fb to your computer and use it in GitHub Desktop.
package db
import (
"fmt"
"github.com/eaigner/jet"
_ "github.com/lib/pq"
)
var (
Db *jet.Db
DbUser = "docku"
DbName = "calculations"
DbSSL = "disable"
DbString = "user=%s dbname=%s sslmode=%s"
)
// Connect() needs to be called before anything else.
func Connect() {
var err error
str := fmt.Sprintf(DbString, DbUser, DbName, DbSSL)
Db, err = jet.Open("postgres", str)
if err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment