1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//! # 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
//!
//! ```rust
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // create pool to our database
//! let pool = create_postgres_pool();
//! // initialize persistence
//! let persistence = ood_persistence::r2d2_postgres::new(&pool);
//! // get connection to database
//! let mut conn = persistence.get_connection()?;
//! // we can query something
//! let res: i32 = conn.inner().query_one("select 1", &[])?.get(0);
//! assert_eq!(res, 1);
//!
//! Ok(())
//! }
//! ```
//!
//! See examples directory for more information.
//!
//! ## Contributors
//!
//! [pleshevskiy](https://github.com/pleshevskiy) (Dmitriy Pleshevskiy) – creator, maintainer.
//!
extern crate async_trait;
/// 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`)
/// 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`)
/// You can get the bb8 module if you activate the `bb8` feature or
/// any feature with bb8 implementation like `bb8_postgres`
pub use bb8;
/// 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
/// You can get the r2d2 module if you activate the `r2d2` feature or
/// any feature with r2d2 implementation like `r2d2_postgres`
pub use r2d2;
/// 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.
/// This module contains implementation for sync interface of sqlite database.
///
/// The implementation uses `r2d2` as the pool and `rusqlite` as the client.
///
/// **Note:** This mod requires enabling the `r2d2_sqlite` feature.
/// This module contains implementation for sync interface of mysql database.
///
/// The implementation uses `r2d2` as the pool and `mysql` as the client.
///
/// **Note:** This mod requires enabling the `r2d2_mysql` feature.
/// This module contains implementations for errors and result, that this
/// crate uses
pub use ;