[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5454":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":32,"readmeContent":33,"aiSummary":34,"trendingCount":16,"starSnapshotCount":16,"syncStatus":35,"lastSyncTime":36,"discoverSource":37},5454,"diesel","diesel-rs\u002Fdiesel","diesel-rs","A safe, extensible ORM and Query Builder for Rust","https:\u002F\u002Fdiesel.rs",null,"Rust",14091,1214,106,98,0,12,50,3,80.25,"Apache License 2.0",false,"main",true,[26,27,28,29,30,31],"mysql","orm","postgresql","query-builder","rust","sqlite","2026-06-12 04:00:25","[![diesel logo](https:\u002F\u002Fdiesel.rs\u002Fassets\u002Fimages\u002Fdiesel_logo_stacked_black.png)](https:\u002F\u002Fdiesel.rs)\n\n# A safe, extensible ORM and Query Builder for Rust\n\n[![Build Status](https:\u002F\u002Fgithub.com\u002Fdiesel-rs\u002Fdiesel\u002Fworkflows\u002FCI%20Tests\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002Fdiesel-rs\u002Fdiesel\u002Factions?query=workflow%3A%22CI+Tests%22+branch%3Amain)\n[![Crates.io](https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Fdiesel.svg)](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fdiesel)\n\nAPI Documentation: [latest release](https:\u002F\u002Fdocs.rs\u002Fdiesel) – [main branch](https:\u002F\u002Fdocs.diesel.rs\u002Fmain\u002Fdiesel\u002Findex.html)\n\n[Homepage](https:\u002F\u002Fdiesel.rs)\n\nDiesel gets rid of the boilerplate for database interaction and eliminates\nruntime errors without sacrificing performance. It takes full advantage of\nRust's type system to create a low overhead query builder that \"feels like\nRust.\"\n\nSupported databases:\n1. [PostgreSQL](https:\u002F\u002Fdocs.diesel.rs\u002Fmain\u002Fdiesel\u002Fpg\u002Findex.html)\n2. [MySQL](https:\u002F\u002Fdocs.diesel.rs\u002Fmain\u002Fdiesel\u002Fmysql\u002Findex.html)\n3. [SQLite](https:\u002F\u002Fdocs.diesel.rs\u002Fmain\u002Fdiesel\u002Fsqlite\u002Findex.html)\n\nYou can configure the database backend in `Cargo.toml`:\n\n```toml\n[dependencies]\ndiesel = { version = \"\u003Cversion>\", features = [\"\u003Cpostgres|mysql|sqlite>\"] }\n```\n\n## Getting Started\n\nFind our extensive Getting Started tutorial at\n[https:\u002F\u002Fdiesel.rs\u002Fguides\u002Fgetting-started](https:\u002F\u002Fdiesel.rs\u002Fguides\u002Fgetting-started).\nGuides on more specific features are coming soon.\n\n## Getting help\n\nIf you run into problems, you can come ask for help at in our [GitHub Discussions](https:\u002F\u002Fgithub.com\u002Fdiesel-rs\u002Fdiesel\u002Fdiscussions) forum. \nThis is also the right place to propose new features or show your applications.\n\n## Usage\n\n### Simple queries\n\nSimple queries are a complete breeze. Loading all users from a database:\n\n```rust\nusers::table.load(&mut connection)\n```\n\nExecuted SQL:\n\n```sql\nSELECT * FROM users;\n```\n\nLoading all the posts for a user:\n\n``` rust\nPost::belonging_to(user).load(&mut connection)\n```\n\nExecuted SQL:\n\n```sql\nSELECT * FROM posts WHERE user_id = 1;\n```\n\n### Complex queries\n\nDiesel's powerful query builder helps you construct queries as simple or complex as\nyou need, at zero cost.\n\n```rust\nlet versions = Version::belonging_to(krate)\n  .select(id)\n  .order(num.desc())\n  .limit(5);\nlet downloads = version_downloads\n  .filter(date.gt(now - 90.days()))\n  .filter(version_id.eq_any(versions))\n  .order(date)\n  .load::\u003CDownload>(&mut conn)?;\n```\n\nExecuted SQL:\n\n```sql\nSELECT version_downloads.* FROM version_downloads\n  WHERE date > (NOW() - '90 days')\n    AND version_id = ANY(\n      SELECT id FROM versions\n        WHERE crate_id = 1\n        ORDER BY num DESC\n        LIMIT 5\n    )\n  ORDER BY date\n```\n\n### Less boilerplate\n\nDiesel codegen generates boilerplate for you. It lets you focus on your business logic, not mapping to and from SQL rows.\n\nThat means you can write this:\n\n```rust\n#[derive(Queryable, Selectable)]\n#[diesel(table_name = downloads)]\npub struct Download {\n    id: i32,\n    version_id: i32,\n    downloads: i32,\n    counted: i32,\n    date: SystemTime,\n}\n```\n\nInstead of this without Diesel:\n\n```rust\npub struct Download {\n    id: i32,\n    version_id: i32,\n    downloads: i32,\n    counted: i32,\n    date: SystemTime,\n}\n\nimpl Download {\n    fn from_row(row: &Row) -> Download {\n        Download {\n            id: row.get(\"id\"),\n            version_id: row.get(\"version_id\"),\n            downloads: row.get(\"downloads\"),\n            counted: row.get(\"counted\"),\n            date: row.get(\"date\"),\n        }\n    }\n}\n```\n\n### Inserting data\n\nIt's not just about reading data. Diesel makes it easy to use structs for new records.\n\n```rust\n#[derive(Insertable)]\n#[diesel(table_name = users)]\nstruct NewUser\u003C'a> {\n    name: &'a str,\n    hair_color: Option\u003C&'a str>,\n}\n\nlet new_users = vec![\n    NewUser { name: \"Sean\", hair_color: Some(\"Black\") },\n    NewUser { name: \"Gordon\", hair_color: None },\n];\n\ninsert_into(users)\n    .values(&new_users)\n    .execute(&mut connection);\n```\n\nExecuted SQL:\n\n```sql\nINSERT INTO users (name, hair_color) VALUES\n  ('Sean', 'Black'),\n  ('Gordon', DEFAULT)\n```\n\nIf you need data from the rows you inserted, just change `execute` to `get_result` or `get_results`. Diesel will take care of the rest.\n\n```rust\nlet new_users = vec![\n    NewUser { name: \"Sean\", hair_color: Some(\"Black\") },\n    NewUser { name: \"Gordon\", hair_color: None },\n];\n\nlet inserted_users = insert_into(users)\n    .values(&new_users)\n    .get_results::\u003CUser>(&mut connection);\n```\n\nExecuted SQL:\n\n```sql\nINSERT INTO users (name, hair_color) VALUES\n  ('Sean', 'Black'),\n  ('Gordon', DEFAULT)\n  RETURNING *\n```\n\n### Updating data\n\nDiesel's codegen can generate several ways to update a row, letting you encapsulate your logic in the way that makes sense for your app.\n\nModifying a struct:\n\n```rust\npost.published = true;\npost.save_changes(&mut connection);\n```\n\nOne-off batch changes:\n\n```rust\nupdate(users.filter(email.like(\"%@spammer.com\")))\n    .set(banned.eq(true))\n    .execute(&mut connection)\n```\n\nUsing a struct for encapsulation:\n\n```rust\nupdate(Settings::belonging_to(current_user))\n    .set(&settings_form)\n    .execute(&mut connection)\n```\n\n### Raw SQL\n\nThere will always be certain queries that are just easier to write as raw SQL, or can't be expressed with the query builder. Even in these cases, Diesel provides an easy to use API for writing raw SQL.\n\n```rust\n#[derive(QueryableByName)]\n#[diesel(table_name = users)]\nstruct User {\n    id: i32,\n    name: String,\n    organization_id: i32,\n}\n\n\u002F\u002F Using `include_str!` allows us to keep the SQL in a\n\u002F\u002F separate file, where our editor can give us SQL specific\n\u002F\u002F syntax highlighting.\nsql_query(include_str!(\"complex_users_by_organization.sql\"))\n    .bind::\u003CInteger, _>(organization_id)\n    .bind::\u003CBigInt, _>(offset)\n    .bind::\u003CBigInt, _>(limit)\n    .load::\u003CUser>(&mut conn)?;\n```\n\n## Code of conduct\n\nAnyone who interacts with Diesel in any space, including but not limited to\nthis GitHub repository, must follow our [code of conduct](https:\u002F\u002Fgithub.com\u002Fdiesel-rs\u002Fdiesel\u002Fblob\u002Fmain\u002Fcode_of_conduct.md).\n\n## License\n\nLicensed under either of these:\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or\n   https:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or\n   https:\u002F\u002Fopensource.org\u002Flicenses\u002FMIT)\n\n### Contributing\n\nBefore contributing, please read the [contributors guide](https:\u002F\u002Fgithub.com\u002Fdiesel-rs\u002Fdiesel\u002Fblob\u002Fmain\u002FCONTRIBUTING.md)\nfor useful information about setting up Diesel locally, coding style and common abbreviations.\n\nUnless you explicitly state otherwise, any contribution you intentionally submit\nfor inclusion in the work, as defined in the Apache-2.0 license, shall be\ndual-licensed as above, without any additional terms or conditions.\n\n### Notable Sponsors and Supporters\n\nWe would like to thank all of the sponsors supporting the work on Diesel. Notable large sponsors are:\n\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd align=\"center\" width=\"33%\">\n      \u003Ca href=\"https:\u002F\u002Fnlnet.nl\u002Fproject\u002FDiesel\u002F\">\n        \u003Cimg src=\"https:\u002F\u002Fdiesel.rs\u002Fassets\u002Fimages\u002Fnl_net_foundation_logo.svg\" \u002F>\n        \u003Cbr\u002F>\n        \u003Csub>\u003Cb>NLNet Foundation\u003C\u002Fb>\u003C\u002Fsub>\n      \u003C\u002Fa>\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"33%\">\n      \u003Ca href=\"https:\u002F\u002Fwww.prototypefund.de\u002Fprojects\u002Fdiesel-databaseviews\">\n        \u003Cimg src=\"https:\u002F\u002Fdiesel.rs\u002Fassets\u002Fimages\u002FPrototypeFund_logo_dark.png\" \u002F>\n        \u003Cbr\u002F>\n        \u003Csub>\u003Cb>Prototype Fund\u003C\u002Fb>\u003C\u002Fsub>\n      \u003C\u002Fa>\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"33%\">\n      \u003Ca href=\"https:\u002F\u002Fgithub.blog\u002Fopen-source\u002Fmaintainers\u002Fsecuring-the-supply-chain-at-scale-starting-with-71-important-open-source-projects\u002F\">\n        \u003Cimg src=\"https:\u002F\u002Fdiesel.rs\u002Fassets\u002Fimages\u002FGitHub_Logo.png\" \u002F>\n        \u003Cbr\u002F>\n        \u003Csub>\u003Cb>GitHub Secure Open Source Fund\u003C\u002Fb>\u003C\u002Fsub>\n      \u003C\u002Fa>\n    \u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd align=\"center\" width=\"33%\">\n      \u003Ca href=\"https:\u002F\u002Fnlnet.nl\u002Fproject\u002FDiesel\u002F\">\n        \u003Cimg src=\"https:\u002F\u002Fdiesel.rs\u002Fassets\u002Fimages\u002FNGI0Core_tag.svg\" \u002F>\n        \u003Cbr\u002F>\n        \u003Csub>\u003Cb>NGI Zero Core\u003C\u002Fb>\u003C\u002Fsub>\n      \u003C\u002Fa>\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"33%\">\n      \u003Ca href=\"https:\u002F\u002Fwww.prototypefund.de\u002Fprojects\u002Fdiesel-databaseviews\">\n        \u003Cimg src=\"https:\u002F\u002Fdiesel.rs\u002Fassets\u002Fimages\u002Fbmbf_logo.jpg\" \u002F>\n        \u003Cbr\u002F>\n        \u003Csub>\u003Cb>Federal Ministry of Research, Technology and Space (Germany)\u003C\u002Fb>\u003C\u002Fsub>\n      \u003C\u002Fa>\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"33%\">\n      \u003Ca href=\"https:\u002F\u002Fgiga-infosystems.com\u002F\">\n        \u003Cimg src=\"https:\u002F\u002Fdiesel.rs\u002Fassets\u002Fimages\u002Flogo_giga.svg\" \u002F>\n        \u003Cbr\u002F>\n        \u003Csub>\u003Cb>GiGa Infosystems GmbH\u003C\u002Fb>\u003C\u002Fsub>\n      \u003C\u002Fa>\n    \u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\nAdditionally we would like to thank all persons sponsoring the project on [GitHub](https:\u002F\u002Fgithub.com\u002Fsponsors\u002Fweiznich#sponsors). Without them developing Diesel wouldn't be possible.\n","Diesel 是一个为 Rust 语言设计的安全、可扩展的对象关系映射（ORM）和查询构建器。它通过利用 Rust 的类型系统来消除数据库交互中的样板代码，并在编译时检查错误，从而保证了高性能与安全性。支持 PostgreSQL、MySQL 和 SQLite 等多种数据库，允许开发者通过简单的配置选择合适的后端。Diesel 适用于需要高效且安全地进行数据库操作的 Rust 应用场景，如 Web 后端服务、数据处理工具等。其强大的查询构建能力使得从简单到复杂的 SQL 查询都能以直观的方式编写，同时自动生成的代码减少了手动映射数据模型的工作量。",2,"2026-06-11 03:03:26","top_language"]