rename postgres to cockroach

This commit is contained in:
Asim Aslam 2019-12-16 15:09:59 +00:00
parent 03700ae6c0
commit 303adca500
2 changed files with 9 additions and 5 deletions

View File

@ -1,9 +1,10 @@
// Package postgresql implements a micro Store backed by sql // Package cockroach implements the cockroach store
package postgresql package cockroach
import ( import (
"database/sql" "database/sql"
"fmt" "fmt"
"strings"
"time" "time"
"unicode" "unicode"
@ -208,9 +209,12 @@ func New(opts ...store.Option) store.Store {
} }
} }
source := nodes[0]
if !strings.Contains(source, " ") {
source = fmt.Sprintf("host=%s", source)
}
// create source from first node // create source from first node
source := fmt.Sprintf("host=%s", nodes[0]) db, err := sql.Open("postgres", source)
db, err := sql.Open("pq", source)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }

View File

@ -1,4 +1,4 @@
package postgresql package cockroach
import ( import (
"database/sql" "database/sql"