2021-10-17 16:22:46 +03:00
|
|
|
//! # OOD Persistence
|
|
|
|
//!
|
|
|
|
//! Asynchronous and synchronous interfaces and persistence implementations for your OOD architecture
|
|
|
|
//!
|
|
|
|
//! ## Installation
|
|
|
|
//!
|
|
|
|
//! Add `ood_persistence = { version = "0", features = ["<IMPLEMENTATION_NAME>"] }` as a dependency in `Cargo.toml`.
|
|
|
|
//!
|
|
|
|
//! NOTE: change `<IMPLEMENTATION_NAME>` to feature name from available list. See `Cargo.toml` for more information.
|
|
|
|
//!
|
|
|
|
//! `Cargo.toml` example:
|
|
|
|
//!
|
|
|
|
//! ```toml
|
|
|
|
//! [package]
|
|
|
|
//! name = "my-crate"
|
|
|
|
//! version = "0.1.0"
|
|
|
|
//! authors = ["Me <user@rust-lang.org>"]
|
|
|
|
//!
|
|
|
|
//! [dependencies]
|
|
|
|
//! ood_persistence = { version = "0", features = ["bb8_postgres"] }
|
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! In stable rust channel you can use only connection interface, but if you use nightly channel, add an additional
|
|
|
|
//! "nightly" feature to your `Cargo.toml` and you can use transactions as well.
|
|
|
|
//!
|
|
|
|
//! ## Usage
|
|
|
|
//!
|
|
|
|
//! See examples directory.
|
|
|
|
//!
|
|
|
|
#![forbid(unsafe_code, non_ascii_idents)]
|
2021-10-17 15:08:46 +03:00
|
|
|
#![deny(clippy::all)]
|
2021-10-17 16:22:46 +03:00
|
|
|
#![warn(missing_docs)]
|
2021-10-17 15:08:46 +03:00
|
|
|
#![cfg_attr(feature = "nightly", feature(generic_associated_types))]
|
|
|
|
|
2021-10-12 18:14:02 +03:00
|
|
|
#[cfg(feature = "async")]
|
|
|
|
#[macro_use]
|
|
|
|
extern crate async_trait;
|
|
|
|
|
2021-10-17 16:22:46 +03:00
|
|
|
/// This module contains interfaces for async persistence.
|
|
|
|
///
|
|
|
|
/// **Note:** This mod requires enabling the `async` feature or any feature
|
|
|
|
/// with async implementation (for example: `bb8_postgres`)
|
2021-10-12 18:14:02 +03:00
|
|
|
#[cfg(feature = "async")]
|
|
|
|
pub mod asyn;
|
|
|
|
|
2021-10-17 16:22:46 +03:00
|
|
|
/// This module contains interfaces for sync persistence.
|
|
|
|
///
|
|
|
|
/// **Note:** This mod requires enabling the `sync` feature or any feature
|
|
|
|
/// with sync implementation (for example: `r2d2_postgres`)
|
2021-10-12 18:14:02 +03:00
|
|
|
#[cfg(feature = "sync")]
|
|
|
|
pub mod syn;
|
|
|
|
|
2021-10-17 16:22:46 +03:00
|
|
|
/// You can get the bb8 module if you activate the `bb8` feature or
|
|
|
|
/// any feature with bb8 implementation like `bb8_postgres`
|
2021-10-12 18:14:02 +03:00
|
|
|
#[cfg(feature = "bb8")]
|
|
|
|
pub use bb8;
|
|
|
|
|
2021-10-17 16:22:46 +03:00
|
|
|
/// This module contains implementation for async interface of postgres database.
|
|
|
|
///
|
|
|
|
/// The implementation uses bb8 as the pool and tokio_postgres as the client.
|
|
|
|
///
|
|
|
|
/// **Note:** This mod requires enabling the `bb8_postgres` feature
|
2021-10-12 18:14:02 +03:00
|
|
|
#[cfg(feature = "bb8_postgres")]
|
|
|
|
pub mod bb8_postgres;
|
|
|
|
|
2021-10-17 16:22:46 +03:00
|
|
|
/// You can get the r2d2 module if you activate the `r2d2` feature or
|
|
|
|
/// any feature with r2d2 implementation like `r2d2_postgres`
|
2021-10-12 18:14:02 +03:00
|
|
|
#[cfg(feature = "r2d2")]
|
|
|
|
pub use r2d2;
|
|
|
|
|
2021-10-17 16:22:46 +03:00
|
|
|
/// This module contains implementation for sync interface of postgres database.
|
|
|
|
///
|
|
|
|
/// The implementation uses r2d2 as the pool and postgres as the client.
|
|
|
|
///
|
|
|
|
/// **Note:** This mod requires enabling the `r2d2_postgres` feature.
|
2021-10-12 18:14:02 +03:00
|
|
|
#[cfg(feature = "r2d2_postgres")]
|
|
|
|
pub mod r2d2_postgres;
|
|
|
|
|
2021-10-17 16:22:46 +03:00
|
|
|
/// This module contains implementations for errors and result, that this
|
|
|
|
/// crate uses
|
2021-10-12 18:14:02 +03:00
|
|
|
pub mod error;
|