item: better documentation on our "id"

This commit is contained in:
Peter Cai 2020-02-22 19:00:48 +08:00
parent 236aca3bef
commit 61f3d0cb52
No known key found for this signature in database
GPG Key ID: 71F5FB4E4F3FD54F
1 changed files with 8 additions and 0 deletions

View File

@ -25,6 +25,14 @@ impl Into<ItemOpError> for &str {
#[derive(Queryable)]
pub struct Item {
// This "id", though primary key, is not how the client actually
// identifies an item, and it is not sent to the client.
// Instead, this "id" is more like a "timestamp", in the sense
// that each time an item is modified, it increments.
// (this incrementing is achieved by deleting and re-inserting
// the item and relying on AUTOINCREMENT)
// This is used in place of the role of timestamp in the Ruby
// and Go implementation.
pub id: i64,
pub owner: i32,
pub uuid: String,