wip postgres

master
Chakib Benziane 5 years ago
parent ae30315d16
commit 10949a9ba3

@ -5,7 +5,8 @@ import (
"log"
"os"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
//_ "github.com/go-sql-driver/mysql"
"github.com/jmoiron/sqlx"
"github.com/mediocregopher/radix/v3"
)
@ -47,11 +48,11 @@ func (d *Database) Open() error {
log.Fatal("undefined DB_PASS env")
}
dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s", user, pass, host, DBName)
dsn := fmt.Sprintf("%s:%s@%s/%s", user, pass, host, DBName)
log.Printf("Opening SQL at %s\n", dsn)
d.Sql = sqlx.MustConnect("mysql", dsn)
d.Sql = sqlx.MustConnect("postgres", dsn)
// Execute Pragmas
//d.Sql.MustExec(DBPragma)

@ -3,6 +3,7 @@ version: "3.4"
volumes:
db:
maria-conf:
postgresql:
file-storage:
#sqlite:
gocache:
@ -46,6 +47,18 @@ services:
volumes:
- db:/var/lib/mysql
- maria-conf:/etc/mysql
postgres:
image: postgres:11.2
environment:
- POSTGRES_PASSWORD=bit4sat
- POSTGRES_USER=bit4sat
- POSTGRES_DB=bit4sat
volumes:
- postgresql:/var/lib/postgresql/data
redis:
image: redis:alpine

@ -9,6 +9,7 @@ require (
github.com/golang/protobuf v1.3.1 // indirect
github.com/jmoiron/sqlx v1.2.0
github.com/kr/pretty v0.1.0 // indirect
github.com/lib/pq v1.0.0
github.com/mattn/go-isatty v0.0.7 // indirect
github.com/mattn/go-sqlite3 v1.10.0
github.com/mediocregopher/radix/v3 v3.2.3

Loading…
Cancel
Save