docs: Update function documentation to use block comments

Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-09-10 16:53:50 -03:00
parent ec95bc8028
commit 94e82e132a
2 changed files with 67 additions and 64 deletions

View File

@@ -9,46 +9,49 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::rc::Rc;
/// Database module for the Keep application.
///
/// This module provides SQLite database operations for storing and retrieving
/// items, tags, and metadata. It includes schema migrations, CRUD operations,
/// and query utilities for efficient data access.
///
/// # Schema
///
/// The database uses three main tables:
/// - `items`: Core item information (ID, timestamp, size, compression).
/// - `tags`: Item-tag associations (many-to-many).
/// - `metas`: Item-metadata associations (many-to-many).
///
/// Foreign keys are enforced with cascading deletes. Indexes on tag and meta
/// names improve query performance.
///
/// # Migrations
///
/// Automatic schema migrations are applied on database open using
/// `rusqlite_migration`. The current schema includes:
/// - Items table with auto-increment ID.
/// - Tags and metas tables with composite primary keys.
/// - Indexes on tag and meta names.
///
/// # Usage
///
/// Open a connection:
/// ```
/// let conn = db::open(PathBuf::from("keep.db"))?;
/// ```
/// Insert an item:
/// ```
/// let item = db::Item { id: None, ts: Utc::now(), size: None, compression: "lz4".to_string() };
/// let id = db::insert_item(&conn, item)?;
/// ```
/*
Database module for the Keep application.
This module provides SQLite database operations for storing and retrieving
items, tags, and metadata. It includes schema migrations, CRUD operations,
and query utilities for efficient data access.
# Schema
The database uses three main tables:
- `items`: Core item information (ID, timestamp, size, compression).
- `tags`: Item-tag associations (many-to-many).
- `metas`: Item-metadata associations (many-to-many).
Foreign keys are enforced with cascading deletes. Indexes on tag and meta
names improve query performance.
# Migrations
Automatic schema migrations are applied on database open using
`rusqlite_migration`. The current schema includes:
- Items table with auto-increment ID.
- Tags and metas tables with composite primary keys.
- Indexes on tag and meta names.
# Usage
Open a connection:
```
let conn = db::open(PathBuf::from("keep.db"))?;
```
Insert an item:
```
let item = db::Item { id: None, ts: Utc::now(), size: None, compression: "lz4".to_string() };
let id = db::insert_item(&conn, item)?;
```
*/
lazy_static! {
/// Database schema migrations for the Keep application.
///
/// Defines the sequence of migrations to create and update the schema.
/// Applied automatically when opening a database connection.
// Database schema migrations for the Keep application.
//
// Defines the sequence of migrations to create and update the schema.
// Applied automatically when opening a database connection.
static ref MIGRATIONS: Migrations<'static> = Migrations::new(vec![
M::up(
"CREATE TABLE items(