Skip to main content

Module sql_repository

Module sql_repository 

Source
Expand description

v9.5.1 SqlRepository:Repository 的 SQL 后端实现

消除 FD-2 幻影交付:batch_create/batch_upsert/paginate_sql 重写为真正 SQL 实现(多值 INSERT / INSERT ON CONFLICT / LIMIT OFFSET + COUNT), 复用既有 QueryBuilder(query.rs:2953/3035)+ Connection::execute_with_params。

§设计要点

  • 异步方法:DB 操作为异步,提供 async 方法(非同步 Repository trait 实现)
  • 参数化:所有值通过 ?/$N 占位符绑定,杜绝 SQL 注入
  • 复用 QueryBuilder:batch_create/batch_upsert 用 build_batch_insert_with_params/build_batch_upsert_with_params
  • 复用 QueryBuilder:paginate_sql 用 build_select + LIMIT/OFFSET + build_count
  • 向后兼容:Repository trait 默认实现保留(repository.rs:554/562/570),本模块提供独立 async API

Structs§

SqlRepository
Repository 的 SQL 后端实现。