From 6ea4d2c82de80efc87708e5e182034b7c6c2019e Mon Sep 17 00:00:00 2001 From: Gibheer Date: Thu, 5 Sep 2024 19:38:25 +0200 Subject: switch from github.com/lib/pq to github.com/jackc/pgx/v5 lib/pq is out of maintenance for some time now, so switch to the newer more active library. Looks like it finally stabilized after a long time. --- cmd/monwork/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/monwork/main.go') diff --git a/cmd/monwork/main.go b/cmd/monwork/main.go index 4271213..1e8d69f 100644 --- a/cmd/monwork/main.go +++ b/cmd/monwork/main.go @@ -11,7 +11,7 @@ import ( "text/template" "time" - "github.com/lib/pq" + _ "github.com/jackc/pgx/v5/stdlib" ) var ( @@ -42,7 +42,7 @@ func main() { log.Fatalf("could not parse check interval: %s", err) } - db, err := sql.Open("postgres", config.DB) + db, err := sql.Open("pgx", config.DB) if err != nil { log.Fatalf("could not open database connection: %s", err) } @@ -167,7 +167,7 @@ func startConfigGen(db *sql.DB, checkInterval time.Duration) { time.Sleep(checkInterval) continue } - if _, err := tx.Exec(SQLRefreshActiveCheck, check_id, pq.Array(stringToShellFields(cmd.Bytes()))); err != nil { + if _, err := tx.Exec(SQLRefreshActiveCheck, check_id, stringToShellFields(cmd.Bytes())); err != nil { tx.Rollback() log.Printf("could not refresh check '%d': %s", check_id, err) continue -- cgit v1.2.3-70-g09d2