We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 621cb6d commit f18086cCopy full SHA for f18086c
vlib/db/pg/pg.v
@@ -144,6 +144,14 @@ fn C.PQfinish(conn &C.PGconn)
144
// a connection error when something goes wrong
145
pub fn connect(config Config) !DB {
146
conninfo := 'host=${config.host} port=${config.port} user=${config.user} dbname=${config.dbname} password=${config.password}'
147
+
148
+ return connect_with_conninfo(conninfo)!
149
+}
150
151
+// connect_with_conninfo makes a new connection to the database server using
152
+// the `conninfo` connection string, returning
153
+// a connection error when something goes wrong
154
+pub fn connect_with_conninfo(conninfo string) !DB {
155
conn := C.PQconnectdb(&char(conninfo.str))
156
if conn == 0 {
157
return error('libpq memory allocation error')
0 commit comments