File count on storage page

This commit is contained in:
Magnus Åhall 2026-06-28 11:17:04 +02:00
parent 6df2be7944
commit 65f8cd14a7
8 changed files with 319 additions and 16 deletions

View file

@ -124,6 +124,11 @@ func FileWriteData(userID int, dbID int, data []byte, create bool) (err error) {
return
} // }}}
func FileCountForUser(userID int) (count int, err error) { // {{{
row := db.QueryRowx(`SELECT COUNT(*) FROM public.file WHERE user_id = $1`, userID)
err = row.Scan(&count)
return
} // }}}
func FileMetadata(userID int, uuid string) (f File, err error) { // {{{
row := db.QueryRowx(`SELECT * FROM public.file WHERE user_id = $1 AND "uuid" = $2`, userID, uuid)
err = row.StructScan(&f)