{"id":13478517,"url":"https://github.com/rbatis/rbatis","last_synced_at":"2026-02-11T08:21:26.912Z","repository":{"id":37164417,"uuid":"174461456","full_name":"rbatis/rbatis","owner":"rbatis","description":"Compile Time Async Dynamic SQL ORM","archived":false,"fork":false,"pushed_at":"2026-02-06T07:24:56.000Z","size":7393,"stargazers_count":2440,"open_issues_count":78,"forks_count":167,"subscribers_count":38,"default_branch":"master","last_synced_at":"2026-02-06T15:47:36.102Z","etag":null,"topics":["actix-web","database","mybatis","mybatis-plus","mysql","orm","postgres","rocket","rust","sql","sqlite","tokio","tokio-async-std"],"latest_commit_sha":null,"homepage":"https://rbatis.github.io/rbatis.io","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rbatis.png","metadata":{"files":{"readme":"README_CN.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-03-08T03:19:02.000Z","updated_at":"2026-02-06T07:21:21.000Z","dependencies_parsed_at":"2022-07-09T01:15:56.803Z","dependency_job_id":"4c4f2e78-2125-4554-a346-3e2d97c25465","html_url":"https://github.com/rbatis/rbatis","commit_stats":{"total_commits":5669,"total_committers":25,"mean_commits":226.76,"dds":"0.012700652672429036","last_synced_commit":"d90b355b9f26d5ef74d7b5a29c3570293006ce06"},"previous_names":["zhuxiujia/rbatis"],"tags_count":363,"template":false,"template_full_name":null,"purl":"pkg:github/rbatis/rbatis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbatis%2Frbatis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbatis%2Frbatis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbatis%2Frbatis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbatis%2Frbatis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rbatis","download_url":"https://codeload.github.com/rbatis/rbatis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rbatis%2Frbatis/sbom","scorecard":{"id":764019,"data":{"date":"2025-08-11","repo":{"name":"github.com/rbatis/rbatis","commit":"25b382e7b7d5eb8c4b611fc2e94d058e9196fe01"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":10,"reason":"30 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: no topLevel permission defined: .github/workflows/issues-translator.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/rbatis/rbatis/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/rbatis/rbatis/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/rbatis/rbatis/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/rbatis/rbatis/ci.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/issues-translator.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/rbatis/rbatis/issues-translator.yml/master?enable=pin","Info:   0 out of   1 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   4 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T00:14:54.725Z","repository_id":37164417,"created_at":"2025-08-23T00:14:54.725Z","updated_at":"2025-08-23T00:14:54.725Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29329796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T06:13:03.264Z","status":"ssl_error","status_checked_at":"2026-02-11T06:12:55.843Z","response_time":97,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actix-web","database","mybatis","mybatis-plus","mysql","orm","postgres","rocket","rust","sql","sqlite","tokio","tokio-async-std"],"created_at":"2024-07-31T16:01:58.103Z","updated_at":"2026-02-11T08:21:26.904Z","avatar_url":"https://github.com/rbatis.png","language":"Rust","readme":"# Rbatis\n\n##### 📖 [英文文档](Readme.md) | 📖 中文文档\n（机翻中文，如有差异，以英文原版为主）\n\n[Website](https://rbatis.github.io/rbatis.io) | [Showcase](https://github.com/rbatis/rbatis/network/dependents) | [Examples](https://github.com/rbatis/rbatis/tree/master/example)\n\n[![Build Status](https://github.com/rbatis/rbatis/workflows/ci/badge.svg)](https://github.com/zhuxiujia/rbatis/actions)\n[![doc.rs](https://docs.rs/rbatis/badge.svg)](https://docs.rs/rbatis/)\n[![](https://img.shields.io/crates/d/rbatis)](https://crates.io/crates/rbatis)\n[![unsafe forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg)](https://github.com/rust-secure-code/safety-dance/)\n[![codecov](https://codecov.io/gh/rbatis/rbatis/graph/badge.svg?token=VAVPXSHoff)](https://codecov.io/gh/rbatis/rbatis)\n[![GitHub release](https://img.shields.io/github/v/release/rbatis/rbatis)](https://github.com/rbatis/rbatis/releases)\n[![discussions](https://img.shields.io/github/discussions/rbatis/rbatis)](https://github.com/rbatis/rbatis/discussions)\n\n\u003cimg style=\"width: 200px;height: 190px;\" width=\"200\" height=\"190\" src=\"logo.png\" /\u003e\n\n## 简介\n\nRbatis 是一个基于编译时代码生成的高性能 Rust ORM 框架。它在开发效率、性能和稳定性之间实现了完美平衡，既是一个 ORM，也是一个动态 SQL 编译器。\n\n## AI 支持\n* - [rbdc-mcp](https://github.com/rbatis/rbdc-mcp)\n\n## 核心优势\n\n### 1. 高性能\n- **🚀 动态SQL直接翻译为原生Rust**：核心优势 - 将动态SQL直接编译为原生Rust代码，达到手写SQL的性能水平\n- **零运行时开销**：所有SQL解析和优化都在编译时完成，消除运行时解释成本\n- **基于 Tokio 异步模型**：充分利用 Rust 的异步特性，提升并发性能\n- **高效的连接池**：内置多种连接池实现，优化数据库连接管理\n\n### 2. 可靠性\n- **Rust 安全特性**：利用 Rust 的所有权和借用检查确保内存和线程安全\n- **统一参数占位符**：使用 `?` 作为统一占位符，支持所有驱动\n- **两种替换模式**：预编译的 `#{arg}` 和直接替换 `${arg}`，满足不同场景需求\n\n### 3. 开发效率\n- **强大的 ORM 能力**：数据库表与 Rust 结构体自动映射\n- **多种 SQL 构建方式**：\n  - **py_sql**：Python 风格的动态 SQL，支持 `if`、`for`、`choose/when/otherwise`、`bind`、`trim` 结构和集合操作（`.sql()`、`.csv()`）\n  - **html_sql**：类似 MyBatis 的 XML 模板，具有熟悉的标签结构（`\u003cif\u003e`、`\u003cwhere\u003e`、`\u003cset\u003e`、`\u003cforeach\u003e`），声明式 SQL 构建，自动处理 SQL 片段而无需 CDATA\n  - **原始 SQL**：直接的 SQL 语句\n- **CRUD 宏**：一行代码生成通用 CRUD 操作\n- **拦截器插件**：[自定义扩展功能](https://rbatis.github.io/rbatis.io/#/v4/?id=plugin-intercept)\n- **表同步插件**：[自动创建/更新表结构](https://rbatis.github.io/rbatis.io/#/v4/?id=plugin-table-sync)\n\n### 4. 可扩展性\n- **多数据库支持**：MySQL、PostgreSQL、SQLite、MSSQL、MariaDB、TiDB、CockroachDB、Oracle、TDengine 等\n- **自定义驱动接口**：实现简单接口即可添加对新数据库的支持\n- **多连接池**：FastPool（默认）、Deadpool、MobcPool\n- **兼容多种 Web 框架**：与 ntex、actix-web、axum、hyper、rocket、tide、warp、salvo 等无缝集成\n\n## 支持的数据库驱动\n\n| 数据库 (crates.io)                               | GitHub 链接                                                                       |\n|----------------------------------------------------|-----------------------------------------------------------------------------------|\n| [MySQL](https://crates.io/crates/rbdc-mysql)       | [rbatis/rbdc-mysql](https://github.com/rbatis/rbdc/tree/master/rbdc-mysql)        |\n| [PostgreSQL](https://crates.io/crates/rbdc-pg)     | [rbatis/rbdc-pg](https://github.com/rbatis/rbdc/tree/master/rbdc-pg)              |\n| [SQLite](https://crates.io/crates/rbdc-sqlite)     | [rbatis/rbdc-sqlite](https://github.com/rbatis/rbdc/tree/master/rbdc-sqlite)      |\n| [MSSQL](https://crates.io/crates/rbdc-mssql)       | [rbatis/rbdc-mssql](https://github.com/rbatis/rbdc/tree/master/rbdc-mssql)        |\n| [MariaDB](https://crates.io/crates/rbdc-mysql)     | [rbatis/rbdc-mysql](https://github.com/rbatis/rbdc/tree/master/rbdc-mysql)        |\n| [TiDB](https://crates.io/crates/rbdc-mysql)        | [rbatis/rbdc-mysql](https://github.com/rbatis/rbdc/tree/master/rbdc-mysql)        |\n| [CockroachDB](https://crates.io/crates/rbdc-pg)    | [rbatis/rbdc-pg](https://github.com/rbatis/rbdc/tree/master/rbdc-pg)              |\n| [Oracle](https://crates.io/crates/rbdc-oracle)     | [chenpengfan/rbdc-oracle](https://github.com/chenpengfan/rbdc-oracle)             |\n| [TDengine](https://crates.io/crates/rbdc-tdengine) | [tdcare/rbdc-tdengine](https://github.com/tdcare/rbdc-tdengine)                   |\n\n## 支持的连接池\n\n| 连接池 (crates.io)                               | GitHub 链接                                                                       |\n|-----------------------------------------------------------|-----------------------------------------------------------------------------------|\n| [FastPool (默认)](https://crates.io/crates/rbdc-pool-fast) | [rbatis/fast_pool](https://github.com/rbatis/rbatis/tree/master/rbdc-pool-fast) |\n| [Deadpool](https://crates.io/crates/rbdc-pool-deadpool)       | [rbatis/rbdc-pool-deadpool](https://github.com/rbatis/rbdc-pool-deadpool)      |\n| [MobcPool](https://crates.io/crates/rbdc-pool-mobc)            | [rbatis/rbdc-pool-mobc](https://github.com/rbatis/rbdc-pool-mobc)              |\n\n## 支持的数据类型\n\n| 数据类型                                                               | 支持 |\n|-------------------------------------------------------------------------|---------|\n| `Option`                                                                | ✓       |\n| `Vec`                                                                   | ✓       |\n| `HashMap`                                                               | ✓       |\n| `i32, i64, f32, f64, bool, String` 及其他 Rust 基础类型           | ✓       |\n| `rbatis::rbdc::types::{Bytes, Date, DateTime, Time, Timestamp, Decimal, Json}` | ✓ |\n| `rbatis::plugin::page::{Page, PageRequest}`                             | ✓       |\n| `rbs::Value`                                                            | ✓       |\n| `serde_json::Value` 及其他 serde 类型                               | ✓       |\n| 来自 rbdc-mysql, rbdc-pg, rbdc-sqlite, rbdc-mssql 的驱动特定类型 | ✓       |\n\n\n## 其他库 crates\n\n| crate                                 | GitHub 链接                                     |\n|---------------------------------------|-------------------------------------------------|\n| [rbdc](https://crates.io/crates/rbdc) | [rbdc](https://github.com/rbatis/rbdc)          |\n| [rbs](https://crates.io/crates/rbs)   | [rbs](https://github.com/rbatis/rbs)             |\n\n\n\n## Rbatis 工作原理\n\nRbatis 通过 `rbatis-codegen` crate 使用编译时代码生成，这意味着：\n\n1. **🎯 直接翻译为原生Rust**：动态SQL在编译期间转换为优化的Rust代码，无需任何运行时解释，达到与手写SQL完全相同的性能。\n\n2. **编译过程**：\n   - **词法分析**：由 `rbatis-codegen` 中的 `func.rs` 使用 Rust 的 `syn` 和 `quote` crates 处理\n   - **语法解析**：由 `rbatis-codegen` 中的 `parser_html` 和 `parser_pysql` 模块执行\n   - **抽象语法树**：使用 `rbatis-codegen` 中 `syntax_tree` 包定义的结构构建\n   - **中间代码生成**：由 `func.rs` 执行，其中包含所有代码生成函数\n\n3. **构建过程集成**：整个过程在 `cargo build` 阶段作为 Rust 的过程宏编译的一部分运行。生成的代码返回给 Rust 编译器进行 LLVM 编译以生成机器代码。\n\n4. **编译时SQL优化**：与传统ORM在运行时解释动态SQL（导致性能损失）不同，Rbatis在编译时将SQL翻译为原生Rust代码，在保持ORM便利性的同时，提供手写SQL的性能。\n\n## 性能基准测试\n\n```\n---- bench_raw stdout ----(windows/SingleThread)\nTime: 52.4187ms ,each:524 ns/op\nQPS: 1906435 QPS/s\n\n---- bench_select stdout ----(macos-M1Cpu/SingleThread)\nTime: 112.927916ms ,each:1129 ns/op\nQPS: 885486 QPS/s\n\n---- bench_insert stdout ----(macos-M1Cpu/SingleThread)\nTime: 346.576666ms ,each:3465 ns/op\nQPS: 288531 QPS/s\n```\n\n## 快速开始\n\n### 视频教程\n1. [基于ai的使用教程（来自作者）](https://www.bilibili.com/video/BV1YwUQBXEKf/)  \n2. [简单的入门教程](https://www.bilibili.com/video/BV1HzSFB8E8n)\n\n### 依赖\n\n```toml\n# Cargo.toml\n[dependencies]\nrbs = { version = \"4\"}\nrbatis = { version = \"4.7\"}\n#drivers\nrbdc-sqlite = { version = \"4.7\" }\n# rbdc-mysql = { version = \"4.7\" }\n# rbdc-pg = { version = \"4.7\" }\n# rbdc-mssql = { version = \"4.7\" }\n\n# 其他依赖\nserde = { version = \"1\", features = [\"derive\"] }\ntokio = { version = \"1\", features = [\"full\"] }\nlog = \"0.4\"\nfast_log = \"1.6\"\n```\n\n### 基本用法\n\n```rust\nuse rbatis::rbdc::datetime::DateTime;\nuse rbs::value;\nuse rbatis::RBatis;\nuse rbdc_sqlite::driver::SqliteDriver;\nuse serde::{Deserialize, Serialize};\nuse serde_json::json;\n\n#[derive(Clone, Debug, Serialize, Deserialize)]\npub struct BizActivity {\n    pub id: Option\u003cString\u003e,\n    pub name: Option\u003cString\u003e,\n    pub status: Option\u003ci32\u003e,\n    pub create_time: Option\u003cDateTime\u003e,\n    pub additional_field: Option\u003cString\u003e,\n}\n\n// 自动生成 CRUD 方法\ncrud!(BizActivity{});\n\n#[tokio::main]\nasync fn main() {\n    // 配置日志\n    fast_log::init(fast_log::Config::new().console()).expect(\"rbatis init fail\");\n    \n    // 初始化 rbatis\n    let rb = RBatis::new();\n    \n    // 连接数据库\n    rb.init(SqliteDriver {}, \"sqlite://target/sqlite.db\").expect(\"rb init fail\");\n    // 或其他数据库\n    // rb.init(MysqlDriver{}, \"mysql://root:123456@localhost:3306/test\").expect(\"pool init fail\");\n    // rb.init(PgDriver{}, \"postgres://postgres:123456@localhost:5432/postgres\").expect(\"pool init fail\");\n    \n    // 创建数据\n    let activity = BizActivity {\n        id: Some(\"1\".into()),\n        name: Some(\"测试活动\".into()),\n        status: Some(1),\n        create_time: Some(DateTime::now()),\n        additional_field: Some(\"额外信息\".into()),\n    };\n\n    // 插入数据\n    let data = BizActivity::insert(\u0026rb, \u0026activity).await;\n\n    // 批量插入\n    let data = BizActivity::insert_batch(\u0026rb, \u0026vec![BizActivity {\n            id: Some(\"2\".into()),\n            name: Some(\"活动 2\".into()),\n            status: Some(1),\n            create_time: Some(DateTime::now()),\n            additional_field: Some(\"信息 2\".into()),\n        }, BizActivity {\n            id: Some(\"3\".into()),\n            name: Some(\"活动 3\".into()),\n            status: Some(1),\n            create_time: Some(DateTime::now()),\n            additional_field: Some(\"信息 3\".into()),\n        },\n    ], 10).await;\n\n    // 根据 map 条件更新（更新所有字段）\n    let data = BizActivity::update_by_map(\u0026rb, \u0026activity, value!{ \"id\": \"1\" }).await;\n\n    // 使用条件中的 \"column\" 键更新特定字段（GitHub issue #591）\n    let data = BizActivity::update_by_map(\u0026rb, \u0026activity, value!{ \"id\": \"1\", \"column\": [\"name\", \"status\"] }).await;\n\n    // 根据 map 条件查询\n    let data = BizActivity::select_by_map(\u0026rb, value!{\"id\":\"2\",\"name\":\"活动 2\"}).await;\n\n    // LIKE 查询\n    let data = BizActivity::select_by_map(\u0026rb, value!{\"name like \":\"%活动%\"}).await;\n\n    // 大于查询\n    let data = BizActivity::select_by_map(\u0026rb, value!{\"id \u003e \":\"2\"}).await;\n\n    // IN 查询\n    let data = BizActivity::select_by_map(\u0026rb, value!{\"id\": \u0026[\"1\", \"2\", \"3\"]}).await;\n\n    // 根据 map 条件删除\n    let data = BizActivity::delete_by_map(\u0026rb, value!{\"id\": \u0026[\"1\", \"2\", \"3\"]}).await;\n}\n```\n\n## 创建自定义数据库驱动\n\n要为 Rbatis 实现自定义数据库驱动：\n\n1. 定义你的驱动项目及依赖：\n```toml\n[features]\ndefault = [\"tls-rustls\"]\ntls-rustls=[\"rbdc/tls-rustls\"]\ntls-native-tls=[\"rbdc/tls-native-tls\"]\n[dependencies]\nrbs = { version = \"4\"}\nrbdc = { version = \"4.7\", default-features = false, optional = true }\nfastdate = { version = \"0.3\" }\ntokio = { version = \"1\", features = [\"full\"] }\n```\n\n2. 实现所需的 trait：\n```rust\nuse rbdc::db::{Driver, MetaData, Row, Connection, ConnectOptions, Placeholder};\n\npub struct YourDriver{}\nimpl Driver for YourDriver{}\n\npub struct YourMetaData{}\nimpl MetaData for YourMetaData{}\n\npub struct YourRow{}\nimpl Row for YourRow{}\n\npub struct YourConnection{}\nimpl Connection for YourConnection{}\n\npub struct YourConnectOptions{}\nimpl ConnectOptions for YourConnectOptions{}\n\npub struct YourPlaceholder{}\nimpl Placeholder for YourPlaceholder{}\n\n// 然后使用你的驱动：\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), rbatis::Error\u003e {\n  let rb = rbatis::RBatis::new();\n  rb.init(YourDatabaseDriver {}, \"database://username:password@host:port/dbname\")?;\n}\n```\n\n## 更多信息\n\n- [完整文档](https://rbatis.github.io/rbatis.io)\n- [变更日志](https://github.com/rbatis/rbatis/releases/)\n- [rbdc-mcp](https://github.com/rbatis/rbdc-mcp)\n\n## 联系我们\n\n[![discussions](https://img.shields.io/github/discussions/rbatis/rbatis)](https://github.com/rbatis/rbatis/discussions)\n\n### 捐赠或联系\n\n\u003cimg style=\"width: 200px;height: 300px;\" width=\"200\" height=\"300\" src=\"https://raw.githubusercontent.com/rbatis/rbatis.io/master/docs/_media/wx_account.png\" alt=\"zxj347284221\" /\u003e\n\n\u003e 微信（添加好友时请备注 'rbatis'）\n\n\u003cimg style=\"width: 200px;height: 250px;\" width=\"200\" height=\"250\" src=\"https://raw.githubusercontent.com/rbatis/rbatis.io/master/docs/_media/wechat.jpg\" alt=\"zxj347284221\" /\u003e\n","funding_links":[],"categories":["Rust","Libraries","库 Libraries","sqlite"],"sub_categories":["Database","数据库 Database"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbatis%2Frbatis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frbatis%2Frbatis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frbatis%2Frbatis/lists"}