Là một dự án dữ liệu, diesel-rs/diesel đã đạt 14.1k sao trên GitHub, ngôn ngữ Rust. A safe, extensible ORM and Query Builder for Rust
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Diesel gets rid of the boilerplate for database interaction and eliminates
runtime errors without sacrificing performance. It takes full advantage of
Rust's type system to create a low overhead query builder that "feels like
Rust."
Supported databases:
PostgreSQL
MySQL
SQLite
You can configure the database backend in Cargo.toml:
[dependencies]
diesel = { version = "<version>", features = ["<postgres|mysql|sqlite>"] }
Getting Started
Find our extensive Getting Started tutorial at
https://diesel.rs/guides/getting-started.
Guides on more specific features are coming soon.
Getting help
If you run into problems, you can come ask for help at in our GitHub Discussions forum.
This is also the right place to propose new features or show your applications.
Usage
Simple queries
Simple queries are a complete breeze. Loading all users from a database:
users::table.load(&mut connection)
Executed SQL:
SELECT * FROM users;
Loading all the posts for a user:
Post::belonging_to(user).load(&mut connection)
Executed SQL:
SELECT * FROM posts WHERE user_id = 1;
Complex queries
Diesel's powerful query builder helps you construct queries as simple or complex as
you need, at zero cost.
let versions = Version::belonging_to(krate)
.select(id)
.order(num.desc())
.limit(5);
let downloads = version_downloads
.filter(date.gt(now - 90.days()))
.filter(version_id.eq_any(versions))
.order(date)
.load::<Download>(&mut conn)?;
Executed SQL:
SELECT version_downloads.* FROM version_downloads
WHERE date > (NOW() - '90 days')
AND version_id = ANY(
SELECT id FROM versions
WHERE crate_id = 1
ORDER BY num DESC
LIMIT 5
)
ORDER BY date
Less boilerplate
Diesel codegen generates boilerplate for you. It lets you focus on your business logic, not mapping to and from SQL rows.
There 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.
#[derive(QueryableByName)]
#[diesel(table_name = users)]
struct User {
id: i32,
name: String,
organization_id: i32,
}
// Using `include_str!` allows us to keep the SQL in a
// separate file, where our editor can give us SQL specific
// syntax highlighting.
sql_query(include_str!("complex_users_by_organization.sql"))
.bind::<Integer, _>(organization_id)
.bind::<BigInt, _>(offset)
.bind::<BigInt, _>(limit)
.load::<User>(&mut conn)?;
Code of conduct
Anyone who interacts with Diesel in any space, including but not limited to
this GitHub repository, must follow our code of conduct.
License
Licensed under either of these:
Apache License, Version 2.0, (LICENSE-APACHE or
https://www.apache.org/licenses/LICENSE-2.0)
MIT license (LICENSE-MIT or
https://opensource.org/licenses/MIT)
Contributing
Before contributing, please read the contributors guide
for useful information about setting up Diesel locally, coding style and common abbreviations.
Unless you explicitly state otherwise, any contribution you intentionally submit
for inclusion in the work, as defined in the Apache-2.0 license, shall be
dual-licensed as above, without any additional terms or conditions.
Notable Sponsors and Supporters
We would like to thank all of the sponsors supporting the work on Diesel. Notable large sponsors are:
NLNet Foundation
Prototype Fund
GitHub Secure Open Source Fund
NGI Zero Core
Federal Ministry of Research, Technology and Space (Germany)
GiGa Infosystems GmbH
Bytebase - Open-source Database DevSecOps
Additionally we would like to thank all persons sponsoring the project on GitHub. Without them developing Diesel wouldn't be possible.
diesel-rs/diesel thuộc nhóm Data trên TopGit, cùng 6 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
diesel-rs/diesel có bao nhiêu sao?
diesel-rs/diesel có 14.1k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/diesel-rs/diesel. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
diesel-rs/diesel có những chủ đề gì?
GitHub topics của diesel-rs/diesel: "mysql", "orm", "postgresql", "query-builder", "rust", "sqlite". TopGit xếp repo vào nhóm Data.
diesel-rs/diesel có phải mã nguồn mở không?
Có — diesel-rs/diesel phát hành theo license Apache-2.0, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/diesel-rs/diesel.
diesel-rs/diesel có trang demo không?
Dự án có trang chủ ở https://diesel.rs. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
diesel-rs/diesel còn đang phát triển không?
Commit gần nhất trên diesel-rs/diesel là 24 ngày trước (theo timestamp GitHub). Repo có 1.2k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc thêm về diesel-rs/diesel ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/diesel-rs/diesel là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
Muốn nghe thêm một ý kiến về diesel?
Hỏi một AI đọc được trang này — một cú bấm là có ngay nhận định về diesel.