pg: add port to config
parent
7008b1a92c
commit
efb45579aa
|
@ -20,6 +20,7 @@ struct C.PGResult { }
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub:
|
pub:
|
||||||
host string
|
host string
|
||||||
|
port int
|
||||||
user string
|
user string
|
||||||
password string
|
password string
|
||||||
dbname string
|
dbname string
|
||||||
|
@ -35,7 +36,7 @@ fn C.PQexec(voidptr) voidptr
|
||||||
fn C.PQexecParams(voidptr) voidptr
|
fn C.PQexecParams(voidptr) voidptr
|
||||||
|
|
||||||
pub fn connect(config pg.Config) ?DB {
|
pub fn connect(config pg.Config) ?DB {
|
||||||
conninfo := 'host=$config.host user=$config.user dbname=$config.dbname password=$config.password'
|
conninfo := 'host=$config.host port=$config.port user=$config.user dbname=$config.dbname password=$config.password'
|
||||||
conn := C.PQconnectdb(conninfo.str)
|
conn := C.PQconnectdb(conninfo.str)
|
||||||
status := C.PQstatus(conn)
|
status := C.PQstatus(conn)
|
||||||
println("status=$status")
|
println("status=$status")
|
||||||
|
|
Loading…
Reference in New Issue