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
use Bind;
use Database;
/// Trait that can be implemented on a `struct` to bind the fields of
/// of this struct with a [sqlx::query::QueryAs] or a [sqlx::query::Query].
///
/// # Example
///
/// ```
/// use miniorm::prelude::*;
/// use sqlx::Postgres;
///
/// struct Todo {
/// description: String,
/// done: bool,
/// }
///
/// impl BindColumn<Postgres> for Todo {
/// fn bind_column<'q, Q>(&self, query: Q, column_name: &'static str) -> Q
/// where
/// Q: Bind<'q, Postgres> {
/// match column_name {
/// "description" => query.bind(self.description.clone()),
/// "done" => query.bind(self.done.clone()),
/// _ => query,
/// }
/// }
/// }
///
/// ```
///
/// This trait can be derived automatically using the [Entity](miniorm_macros::Entity)
/// derive macro.
///