teil 0.2.0-beta.1

A simple framework for database usage
docs.rs failed to build teil-0.2.0-beta.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: teil-0.5.0-alpha.3

Teil, basic data mapper for Postgres/Sqlite

Teil (pronounced /tail/)is a library that intends to make a connection to postgres (or sqlite) as simple as possible (with the limitations that this implies). Teil means part, portion or piece in german.

# async fn async_main() {
use teil::{Teil, fields::Serial};

#[derive(Teil, Debug)]
struct Account {
#[teil(auto, primary_key)]
id: Serial,
#[teil(unique)]
owner: String,
#[teil(rename = "account_balance")]
balance: f64
}

teil::config()
.user("example")
.password("password")
.dbname("example_db")
.host("127.0.0.1")
.port(5432)
.set().unwrap();

teil::create!(Account);

(Account {id: Serial::new(), owner: "Carlos".into(), balance: 420.00}).save().await.unwrap();
let account = Account::retrieve(1).await.unwrap();
println!("{:?}", account);

teil::destroy!(Account);
# }

Features available for this crate

  • sync: Enables the use of the sync version of the library (that is, the SyncTeil and SyncFilter traits and derive macros)
  • iter: Allows a transaction-based multiple-save function to be used (see save_iter)
  • chrono: Allows some chrono fields to be used as fields in a Teil-deriving structure. See TeilField and SyncTeilField for more information.
  • partial: Enables partial updating fields of a row in the database. See Teil for more information