diesel

A safe, extensible ORM and Query Builder for Rust

Subscribe to updates I use diesel


Statistics on diesel

Number of watchers on Github 2471
Number of open issues 100
Average time to close an issue 3 days
Main language Rust
Average time to merge a PR 3 days
Open pull requests 65+
Closed pull requests 32+
Last commit 7 months ago
Repo Created about 3 years ago
Repo Last Updated 6 months ago
Size 16.7 MB
Homepage http://diesel.rs
Organization / Authordiesel-rs
Latest Releasev1.1.1
Contributors20
Page Updated
Do you use diesel? Leave a review!
View open issues (100)
View diesel activity
View on github
Latest Open Source Launches
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating diesel for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

A safe, extensible ORM and Query Builder for Rust

Build Status Appveyor Build Status Gitter Crates.io

API Documentation: latest release master branch

Homepage

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.

Getting Started

Find our extensive Getting Started tutorial at https://diesel.rs/guides/getting-started. Guides on more specific features are coming soon.

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

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.

diesel open issues Ask a question     (View All Issues)
  • almost 2 years Postgres Geometry Point(X, Y) type
  • almost 2 years Installing diesel_cli on Windows : some assembly required
  • almost 2 years Refactor macros 1.1 codegen to use constants instead of strings
  • almost 2 years Update changeset options to use a boolean value
  • about 2 years Add documentation for binding to raw queries
  • about 2 years Add custom schema support
  • about 2 years Passing too much data results in a fatal error
  • about 2 years PG's documentation lies. Not all errors have messages
  • about 2 years Update documentation around syntex
  • about 2 years CLI: Add a subcommand to print db schema as `table!` calls
  • about 2 years Renaming the primary key of a table blows everything up
  • about 2 years Not possible to use Array<SomeTuple> as SqlType
  • about 2 years select query loads data incorrectly if model is 'out of order'
  • about 2 years command to populate db with test data in diesel-cli
  • about 2 years diesel_codegen_syntex panics with underflow
  • about 2 years Add `exists` to expression DSL functions
  • about 2 years Use Cargo Workspaces
  • about 2 years Transaction isolation
  • about 2 years Async I/O
  • about 2 years Many-To-Many Joins
  • about 2 years Getting started cargo.toml not valid
  • about 2 years Insert is crashing while trying to insert an empty vector
  • about 2 years missing documentation through diesel macros
  • about 2 years SQLite Getting started/Skeleton app
  • about 2 years SQLType cannot be assumed to be static.
  • over 2 years (slightly) more readable migration filenames?
  • over 2 years Expose diesel_cli's functionality as a library
  • over 2 years Support WITH RECURSIVE queries
  • over 2 years diesel_cli: `diesel database reset` does not escape database name
  • over 2 years Support user-defined `FromSql` and `ToSql` implementations
diesel open pull requests (View All Pulls)
  • Make our query builder faster than a SQL string
  • Add a logging Connection
  • Implement `RETURNING` clause for `DELETE` statements
  • Implement `UNION` and `UNION ALL` combination queries
  • Add Clippy (WIP)
  • Add sqlite support for chrono's Naive{DateTime,Date,Time} types
  • [WIP] Implement `#[changeset_for]` as a standard non-procedural macro
  • Feature/desc nulls last
  • cli: Use UTC for default migration version
  • infer_schema! will no longer treat views as tables
  • Bash completion
  • Improve implementation of associations!!
  • Update `FindDsl` to work with composite primary keys
  • Fix #384 (Invalid query on empty insert/select in)
  • doc: show example of updating multiple values
  • Simplify the support of custom types
  • `table` macro that allows remapping table and field names
  • add time type
  • Use a cargo workspace
  • WIP Error refactoring
  • Allow inserting empty slices
  • Fix failures on latest nightlies
  • Use constants instead of string literals
  • Refactor `AsChangeset!` now that macros in type positions are stable
  • Add an example for the transactions function
  • Add an example/doctest for BoxableExpression
  • Add an insert_default_values function
  • [bugfix][diesel_cli] parse dbname from connection string in a way that still leaves bugs
  • Add ability to document items of table! macro
  • add ability to skip timestamp helpers
  • [WIP] numeric/BigDecimal
  • Generate more human-readable migration dir names
  • First draft of an update guide
  • Remove the usage of tuples in argument positions from our API
  • Make CI scripts nicer
  • Rollup of 4 PRs
  • Add `DeleteStatement::into_boxed`.
  • Add `.then_order_by`, which appends rather than replaces
  • Rewrite `#[derive(SqlType)]` in derives2
  • Rewrite `#[derive(QueryableByName)]` in derives2
  • Use a less pervasive workaround for rustc bug
  • Rewrite `#[derive(Insertable)]` in derives2
  • Sqlite custom function
  • Change 'keep' from .gitkeep to .keep
  • [WIP] Explicit joinable! documentation.
  • Minor changes to the backend installation guide
  • Rewrite ci stuff to enable bors
  • Enable sqlite/bundle for diesel cli
  • open SQLite connection with SQLITE_OPEN_URI
  • Adding `barrel` feature
  • add statement position to error info
  • Derive `Identifiable` similar to `Insertable` and `AsChangeset`
  • Derive `AsChangeset` also for the plain struct, similar to `Insertable`
  • Derive insertable also on the type, not only on the reference
  • [WIP] feat: add support for the Point type on PG.
  • Adding chrono DateTime<Local> support for postgres
  • [WIP] Add Support for Unsigned Types in Mysql
  • Allow to select a column as nullable
  • Implement support for "FOR UPDATE" modifiers
  • Allow to pass boxed subselect queries as eq_any on nullable fields
  • Reimplement SqlLiteral::Bind
  • Allow to set fields to `Default` when constructing struct from query
  • Add a Insertable implementation for Vec<T>
  • [DO NOT MERGE] use match_default_bindings
  • Replace most raw pointer usage with `NonNull`
diesel questions on Stackoverflow (View All Questions)
  • Why Diesel complete a request more time according to client?
  • i need a gas and a diesel api that show the prices
  • Does diesel support python 3?
  • telnet Connection closed when I use yield in diesel
diesel list of languages used
diesel latest release notes
v1.1.1 1.1.1

This release fixes a minor issue with our r2d2 support. In 1.1 we recommend that people access r2d2 via diesel::r2d2. However, r2d2 has a type called Error, which was shadowed by our own type called Error in that same module, making it inaccessible. This release adds an alias PoolError to point at r2d2::Error.

Thanks to YetAnotherMinion for working on this release.

v1.1.0 1.1.0

Improved Support for Adding New Types

The primary focus of this release was improving the ergonomics of adding support for new types in Diesel.

For implementing new SQL types, we've added #[derive(SqlType)] which implements many traits that you need to implement for every SQL type. See the documentation for HasSqlType for details on this derive.

For implementing new mappings, we've added #[derive(FromSqlRow)] and #[derive(AsExpression)]. These derives will replace the majority of the boilerplate that was previously required when supporting new types. Adding support for new types in Diesel 1.1 should only require implementing FromSql and ToSql. The derives will handle the rest.

We've also provided FromSql impls for *const str and *const [u8]. Due to the design of FromSql, we can't provide impls for &str and &[u8] without a breaking change. However many impls just need to parse a string or some bytes, and don't need the allocation that would come from String or Vec<u8>. This will require unsafe code to use, but should make certain implementations more efficient.

Finally, we've restructured how our serialize/deserialize modules are structured, and provided type aliases to make implementations of FromSql and ToSql more consise.

r2d2_diesel is Now Part of Diesel

Finally, this release merges r2d2_diesel into Diesel itself. The main benefit of doing this is that we can implement Connection for PooledConnection, removing the need for explicit &* when using r2d2. This should also help to prevent version mismatches when changing Diesel versions.

To use the new r2d2 support, remove r2d2 and r2d2_diesel from your Cargo.toml. Add the r2d2 to your enabled features on diesel. Replace extern crate r2d2 with pub use diesel::r2d2. Replace any r2d2_diesel:: with diesel::r2d2::.

Thanks

In addition to the headline features, there were dozens of smaller additions which should make using Diesel even better! As always, you can check the CHANGELOG for a full list of changes in this release.

In addition to the Diesel core team, 8 people contributed to this release. A huge thank you to:

  • Ashe Connor
  • Chris Pick
  • Evan
  • Georg Semmler
  • MarcManiez
  • Martin Lindhe
  • Oliver Schneider
  • Ryan Blecher
v1.0.0 1.0.0

We didn't quite make it for 2017, but Diesel 1.0 is finally here! There are no changes between Diesel 1.0 and 1.0.0-rc1.

1.0.0 marks stability for Diesel. While there are many more features that will be added in the future, there will be no breaking changes from this point forward without a major version bump (which we do not anticipate happening for many years).

A lot has happened since Diesel 0.1 was released over 2 years ago. While it would be impossible to list every major change that has happened since then, here are a few highlights:

  • Expanded from a PostgreSQL specific library to supporting SQLite and MySQL
  • Went from nightly-only to nightly-optional to working purely on stable Rust
  • diesel print-schema replaced infer_schema! as the go-to way to infer your database schema.
  • Added support for a significant portion of SQL queries which could not be represented in 0.1

It's been a great honor to watch this community grow and thrive as this library has developed. I look forward to continuing to evolve Diesel, and seeing how far it can go.

In addition to the Diesel core team, 98 people have contributed to Diesel. A huge thank you to everyone who made this and every prior release possible:

  • Adam Perry
  • Adrian Perez de Castro
  • Alex Alvarez
  • Alex Kitchens
  • Alexey Zabelin
  • Andrew Lazarus
  • Andrew Ryan Lazarus
  • Arnar Mar Sig
  • Barosl Lee
  • Blake Pettersson
  • Bob
  • Boris-Chengbiao Zhou
  • Brandon W Maister
  • Cameron Alexander
  • Cengiz Can
  • Christopher Brickley
  • Cyryl Potnicki
  • Daniel Durante
  • Danilo Bargen
  • David Szotten
  • Derek Prior
  • Dimiter Petrov
  • Dorian Scheidt
  • Enether
  • Eric Kidd
  • Erich Cordoba
  • FliegendeWurst
  • Flux Xu
  • Garrett Squire
  • Georg Semmler
  • Graham Grochowski
  • JD Gonzales
  • Jake Goulding
  • Jakob Gillich
  • James Kominick
  • Jethro Beekman
  • Jim McGrath
  • Jimmy Cuadra
  • John Gallagher
  • Jordan
  • Josh Holmer
  • Jovansonlee Cesar
  • Katrina Brock
  • Kieran
  • Konstantinos Sideris
  • Lance Carlson
  • Lauri Apple
  • Maciej
  • Maciej Dziardziel
  • Mark Catley
  • Martijn de Haan
  • Mathieu Rochette
  • Matt Casper
  • Maxime pep Buquet
  • Michael Macias
  • Michael Stock
  • Mike Piccolo
  • Mrmaxmeier
  • Patrick Fernie
  • Paul Lange
  • Peter Marheine
  • Pyry Kontio
  • Rasmus Kaj
  • Richard Dodd
  • Robert Balicki
  • Robert Maloney
  • Ruben De Smet
  • Ryan Blecher
  • Sam Phippen
  • Sebastian Blei
  • Sergio Benitez
  • Severen Redwood
  • Sharad Chand
  • Sid Ngeth
  • Stu Black
  • Sunrin SHIMURA (keen)
  • Tamir Duberstein
  • Taryn Hill
  • Tess Griffin
  • Tim Brooks
  • Tobias Schottdorf
  • Tom Houl
  • Tshepang Lekhonkhobe
  • Will Murphy
  • William Murphy
  • benaryorg
  • bippityboppity
  • debris
  • derekdreery
  • jacob
  • jethrogb
  • kardeiz
  • king6cong
  • klieth
  • pfernie
  • theduke
  • wangcong
Other projects in Rust