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
//! # Diesel-Versioning
//!
//! Diesel-Versioning implements [optimistic locking](https://en.wikipedia.org/wiki/Optimistic_concurrency_control) for [Diesel](https://diesel.rs).
//! This is achieved by an additional field on every entity, which should be support optimistic
//! locking.
//!
//! The entity must have implemented [`diesel::AsChangeset`] and [`diesel::Identifiable`] to implement [`Versioned`]. You can
//! use the provided derive macro.
//!
//! ```ignore
//! use diesel::AsChangeset;
//! use diesel::Identifiable;
//! use diesel_versioning::Versioned;
//!
//! #[derive(AsChangeset, Identifiable, Versioned)]
//! #[diesel(table_name = schema::users)]
//! #[diesel(check_for_backend(diesel::pg::Pg))]
//! pub struct User {
//! pub id: i32,
//! #[version]
//! pub version: i32,
//! pub body: String,
//! }
//! ```
//!
//! Currently only integer values are supported as version field.
//!
//! If you use the feature-flag `async`, you have to use [`VersionedAsync`] instead of
//! [`Versioned`].
use Connection;
use ;
use AsyncConnection;
///
/// Trait that must be implemented by an entity, to support optimitsic locking. You would use the
/// provided derive macro.
///
/// If you want to use async connection, use [`VersionedAsync`] instead.
///
///
/// Trait that must be implemented by an entity, to support optimitsic locking. You would use the
/// provided derive macro.
///
/// This is the async version of [`Versioned`]
///
pub use Versioned;
pub use VersionedAsync;