pg: update optional return syntax

pull/2113/head
joe-conigliaro 2019-09-26 21:23:29 +10:00 committed by Alexander Medvednikov
parent 896f978b94
commit f1f720cc78
1 changed files with 2 additions and 2 deletions

View File

@ -103,14 +103,14 @@ pub fn (db DB) exec(query string) []pg.Row {
return res_to_rows(res)
}
fn rows_first_or_empty(rows []pg.Row) pg.Row? {
fn rows_first_or_empty(rows []pg.Row) ?pg.Row {
if rows.len == 0 {
return error('no row')
}
return rows[0]
}
pub fn (db DB) exec_one(query string) pg.Row? {
pub fn (db DB) exec_one(query string) ?pg.Row {
res := C.PQexec(db.conn, query.str)
e := string(C.PQerrorMessage(db.conn))
if e != '' {