rusqlite-patterns

Community

Get the right Rust SQL DB patterns.

Authorjonaseck2
Version1.0.0
Installs0

System Documentation

What problem does it solve?

It prevents broken or inconsistent SQLite/Rust database layer changes by documenting the exact Tauri + rusqlite connection lifecycle, SQL command primitives, parameter binding rules, and where new logic should live.

Core Features & Use Cases

  • Connection lifecycle & safety model: how the single global SQLite connection is opened, guarded by a Mutex, switched between DB files, and closed.
  • SQL primitive contract: how the renderer-side db-shim calls the five generic Rust commands (db_batch, db_run, db_run_changes, db_get, db_all) and what shapes return.
  • Correct SQL binding & transactions: positional parameter binding via ? placeholders, supported JSON-to-SQL coercions, and the recommended transaction pattern using BEGIN IMMEDIATE/COMMIT/ROLLBACK.
  • Guidance on code placement: decision criteria for adding logic to src/api/ versus introducing new #[tauri::command] functions in Rust.
  • Type marshalling expectations: how SQL row values are marshalled into JSON types, including defensive handling for BLOB columns.

Quick Start

When modifying src-tauri/src/db.rs, ask the AI to explain how to implement your new SQL helper consistently with the existing db_* primitives, including parameter binding, transactions, and whether the change should go in src/api/ or as a Rust command.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: rusqlite-patterns
Download link: https://github.com/jonaseck2/slaktforskning/archive/main.zip#rusqlite-patterns

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.