Created
August 29, 2014 18:58
-
-
Save chuckha/ba6390b4c80a767190fb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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