2019-02-15 00:20:56 +03:00
|
|
|
package postgres
|
|
|
|
|
2023-12-27 12:35:24 +03:00
|
|
|
func (a *PostgresAccessor) intQuery(q string, params ...interface{}) int {
|
|
|
|
rows, err := a.db.Query(q, params...)
|
2019-02-15 00:20:56 +03:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
defer rows.Close()
|
|
|
|
|
|
|
|
if rows.Next() {
|
|
|
|
var result int
|
|
|
|
err = rows.Scan(&result)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
|
|
|
|
panic("no result!")
|
|
|
|
}
|