This commit is contained in:
idanoo 2023-02-13 08:47:08 +13:00
parent adfcf44890
commit 6b6037f735
Signed by: idanoo
GPG key ID: 387387CDBC02F132
2 changed files with 24 additions and 10 deletions

View file

@ -3,6 +3,7 @@ package gomastodonstats
import (
"database/sql"
"fmt"
"time"
_ "github.com/lib/pq"
)
@ -57,3 +58,23 @@ func runIntQuery(schema string, q string) (int, error) {
return res, err
}
func runIntQueryWithTime(schema string, q string, t time.Time) (int, error) {
var res int
db, err := getConnection(schema)
if err != nil {
return res, err
}
rows, err := db.Query(q, t)
if err != nil {
return res, err
}
defer rows.Close()
for rows.Next() {
rows.Scan(&res)
}
return res, err
}