Module db

Module db 

Source
Expand description

SQLite database stuff – schema, migrations, and CRUD for files and admins.

Structs§

AdminUser
An admin user from the admins table.
FileRecord
A file record from the files table.

Functions§

delete_admin
Delete an admin user by username. Returns true if a row was removed.
delete_file
Delete a file record by ID. Returns true if a row was removed.
delete_files_by_ids
Bulk-delete file records by their IDs. Returns the number of rows deleted.
get_admin_by_username
Look up an admin by username.
get_file
Look up a single file record by its ID.
get_files_by_ids
Look up multiple file records by their IDs.
init_db
Set up the database tables and run any needed migrations.
insert_admin
Insert a new admin user.
insert_file
Insert a new file record into the database.
list_active
List non-expired file records, newest first.
list_admins
List all admin users ordered by creation time.
list_all_files
List every file record, newest first.
list_all_storage_paths
List every storage path in the database.
list_expired
List expired file records only.
renew_file_id
Give a file a new ID and update its public URL.