Make ConnectionParameters fields public
This commit is contained in:
+6
-6
@@ -9,7 +9,7 @@ var SharedConnection *Connection
|
||||
func getSharedConnection() (c *Connection) {
|
||||
if SharedConnection == nil {
|
||||
var err error
|
||||
SharedConnection, err = Connect(ConnectionParameters{socket: "/private/tmp/.s.PGSQL.5432", user: "pgx_none", database: "pgx_test"})
|
||||
SharedConnection, err = Connect(ConnectionParameters{Socket: "/private/tmp/.s.PGSQL.5432", User: "pgx_none", Database: "pgx_test"})
|
||||
if err != nil {
|
||||
panic("Unable to establish connection")
|
||||
}
|
||||
@@ -19,7 +19,7 @@ func getSharedConnection() (c *Connection) {
|
||||
}
|
||||
|
||||
func TestConnect(t *testing.T) {
|
||||
conn, err := Connect(ConnectionParameters{socket: "/private/tmp/.s.PGSQL.5432", user: "pgx_none", database: "pgx_test"})
|
||||
conn, err := Connect(ConnectionParameters{Socket: "/private/tmp/.s.PGSQL.5432", User: "pgx_none", Database: "pgx_test"})
|
||||
if err != nil {
|
||||
t.Fatal("Unable to establish connection")
|
||||
}
|
||||
@@ -54,7 +54,7 @@ func TestConnect(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConnectWithTcp(t *testing.T) {
|
||||
conn, err := Connect(ConnectionParameters{host: "127.0.0.1", user: "pgx_md5", password: "secret", database: "pgx_test"})
|
||||
conn, err := Connect(ConnectionParameters{Host: "127.0.0.1", User: "pgx_md5", Password: "secret", Database: "pgx_test"})
|
||||
if err != nil {
|
||||
t.Fatal("Unable to establish connection: " + err.Error())
|
||||
}
|
||||
@@ -66,7 +66,7 @@ func TestConnectWithTcp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConnectWithInvalidUser(t *testing.T) {
|
||||
_, err := Connect(ConnectionParameters{socket: "/private/tmp/.s.PGSQL.5432", user: "invalid_user", database: "pgx_test"})
|
||||
_, err := Connect(ConnectionParameters{Socket: "/private/tmp/.s.PGSQL.5432", User: "invalid_user", Database: "pgx_test"})
|
||||
pgErr := err.(PgError)
|
||||
if pgErr.Code != "28000" {
|
||||
t.Fatal("Did not receive expected error when connecting with invalid user")
|
||||
@@ -74,7 +74,7 @@ func TestConnectWithInvalidUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConnectWithPlainTextPassword(t *testing.T) {
|
||||
conn, err := Connect(ConnectionParameters{socket: "/private/tmp/.s.PGSQL.5432", user: "pgx_pw", password: "secret", database: "pgx_test"})
|
||||
conn, err := Connect(ConnectionParameters{Socket: "/private/tmp/.s.PGSQL.5432", User: "pgx_pw", Password: "secret", Database: "pgx_test"})
|
||||
if err != nil {
|
||||
t.Fatal("Unable to establish connection: " + err.Error())
|
||||
}
|
||||
@@ -86,7 +86,7 @@ func TestConnectWithPlainTextPassword(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConnectWithMD5Password(t *testing.T) {
|
||||
conn, err := Connect(ConnectionParameters{socket: "/private/tmp/.s.PGSQL.5432", user: "pgx_md5", password: "secret", database: "pgx_test"})
|
||||
conn, err := Connect(ConnectionParameters{Socket: "/private/tmp/.s.PGSQL.5432", User: "pgx_md5", Password: "secret", Database: "pgx_test"})
|
||||
if err != nil {
|
||||
t.Fatal("Unable to establish connection: " + err.Error())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user