work on optimising vcenter queries
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-14 17:00:40 +11:00
parent 44ae2094f3
commit 56f021590d
8 changed files with 419 additions and 193 deletions

View File

@@ -876,6 +876,32 @@ func (q *Queries) ListUnprocessedEvents(ctx context.Context, eventtime sql.NullI
return items, nil
}
const sqliteColumnExists = `-- name: SqliteColumnExists :one
SELECT COUNT(1) AS count
FROM pragma_table_info
WHERE name = ?1
`
func (q *Queries) SqliteColumnExists(ctx context.Context, columnName sql.NullString) (int64, error) {
row := q.db.QueryRowContext(ctx, sqliteColumnExists, columnName)
var count int64
err := row.Scan(&count)
return count, err
}
const sqliteTableExists = `-- name: SqliteTableExists :one
SELECT COUNT(1) AS count
FROM sqlite_master
WHERE type = 'table' AND name = ?1
`
func (q *Queries) SqliteTableExists(ctx context.Context, tableName sql.NullString) (int64, error) {
row := q.db.QueryRowContext(ctx, sqliteTableExists, tableName)
var count int64
err := row.Scan(&count)
return count, err
}
const updateEventsProcessed = `-- name: UpdateEventsProcessed :exec
UPDATE events
SET "Processed" = 1