Module db

Source
Expand description

Database management for the Peillute application

This module handles all database operations, including user management, transaction processing, and state synchronization. It uses SQLite as the underlying database engine.

Structs§

DB_CONN
Transaction
Represents a transaction in the system

Constants§

NULL 🔒
Special value representing a null user

Functions§

calculate_solde
Calculates the current balance for a user
create_transaction
Creates a new transaction between users
create_user
Creates a new user with zero balance
delete_user
Deletes a user from the database
deposit
ensure_user
Ensures a user exists, creating it if necessary
get_local_state
Get the local state of the site
get_local_transaction_log
get_transaction
get_transactions_for_user
get_users
has_been_refunded
init_db
Initializes the database schema
is_database_initialized
Checks if the database has been initialized
print_transaction_for_user
print_transactions
print_users
refund_transaction
transaction_exists
Check if a transaction exists in the database
update_db_with_snapshot
Update the database with a snapshot
update_local_state
Update the local state of the site
update_solde
Updates the stored balance for a user
user_exists
Checks if a user exists in the database
withdraw