Get DB size from Postgres
This commit is contained in:
parent
273bb20baa
commit
7b056a4a41
5 changed files with 46 additions and 44 deletions
21
db/stats.sql.go
Normal file
21
db/stats.sql.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.25.0
|
||||
// source: stats.sql
|
||||
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const dBSize = `-- name: DBSize :one
|
||||
SELECT pg_size_pretty(pg_database_size(current_database()))
|
||||
`
|
||||
|
||||
func (q *Queries) DBSize(ctx context.Context) (string, error) {
|
||||
row := q.db.QueryRow(ctx, dBSize)
|
||||
var pg_size_pretty string
|
||||
err := row.Scan(&pg_size_pretty)
|
||||
return pg_size_pretty, err
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue