- netboot-base.nix with SSH key auth - Launch scripts for node01/02/03 - Node configuration.nix and disko.nix - Nix modules for first-boot automation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| Cargo.toml | ||
| main.rs | ||
| README.md | ||
FlareDB SQL Layer CRUD Example
This example demonstrates the basic CRUD operations using the FlareDB SQL layer.
Prerequisites
- A running FlareDB server on
127.0.0.1:8001 - Rust toolchain installed
What This Example Does
The example performs the following operations:
- CREATE TABLE: Creates a
userstable with columns (id, name, email, active) - INSERT: Inserts 4 sample users into the table
- SELECT *: Queries all users
- SELECT with WHERE: Queries only active users
- SELECT specific user: Queries a single user by ID
- DROP TABLE: Cleans up by dropping the table
Running the Example
# Navigate to the example directory
cd docs/por/T037-flaredb-sql-layer/example-crud
# Run the example
cargo run --bin crud-example
Expected Output
=== FlareDB SQL Layer CRUD Example ===
Connecting to FlareDB server at 127.0.0.1:8001...
Connected!
Step 1: Creating 'users' table...
✓ DdlSuccess("Table 'users' created")
Step 2: Inserting users...
✓ Inserted: Alice Johnson - DmlSuccess(1)
✓ Inserted: Bob Smith - DmlSuccess(1)
✓ Inserted: Carol White - DmlSuccess(1)
✓ Inserted: Dave Brown - DmlSuccess(1)
Step 3: Querying all users...
✓ Query result:
QueryResult { columns: ["id", "name", "email", "active"], rows: [...] }
Step 4: Querying active users only...
✓ Active users:
QueryResult { columns: ["id", "name", "email", "active"], rows: [...] }
Step 5: Querying user with id=2...
✓ Found user:
QueryResult { columns: ["id", "name", "email", "active"], rows: [...] }
Step 6: Dropping 'users' table...
✓ DdlSuccess("Table 'users' dropped")
=== Example completed ===
Implementation Details
The example uses:
flaredb-client: For connecting to the FlareDB serverflaredb-sql: For executing SQL statements
All operations use strong consistency mode, ensuring ACID properties for SQL operations.
Supported SQL Statements
Current SQL layer implementation supports:
CREATE TABLEwith primary key constraintsDROP TABLEINSERT INTOwith explicit column valuesSELECTwith column list or*WHEREclause with comparison operators (=, <, >, <=, >=, !=)
Future Enhancements
Planned features include:
- UPDATE and DELETE statements
- JOIN operations
- Aggregation functions (COUNT, SUM, AVG, etc.)
- ORDER BY and LIMIT clauses
- Indexes for query optimization