pgx-vs-pq
Jack Christensen 2013-03-30 18:13:40 -05:00
parent 05f94f7107
commit 18e225b66d
3 changed files with 7 additions and 5 deletions

View File

@ -9,7 +9,7 @@ type conn struct {
conn net.Conn
}
func Connect(options map[string] string) (c *conn, err error) {
func Connect(options map[string]string) (c *conn, err error) {
c = new(conn)
var present bool
@ -17,7 +17,9 @@ func Connect(options map[string] string) (c *conn, err error) {
if socket, present = options["socket"]; present {
c.conn, err = net.Dial("unix", socket)
if err != nil { return nil, err }
if err != nil {
return nil, err
}
}
// conn, err := net.Dial("tcp", "localhost:5432")

View File

@ -5,7 +5,7 @@ import (
)
func TestConnect(t *testing.T) {
_, err := Connect(map[string] string { "socket": "/private/tmp/.s.PGSQL.5432" })
_, err := Connect(map[string]string{"socket": "/private/tmp/.s.PGSQL.5432"})
if err != nil {
t.Fatal("Unable to establish connection")
}

View File

@ -9,11 +9,11 @@ const (
)
type startupMessage struct {
options map[string] string
options map[string]string
}
func newStartupMessage() *startupMessage {
return &startupMessage{map[string] string{}}
return &startupMessage{map[string]string{}}
}
func (self *startupMessage) Bytes() (buf []byte) {