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
use versatile_data::{
KeyValue
,UpdateTerm
,Activity
};
use crate::{
CollectionRow
};
#[derive(Clone,Copy,Default,PartialEq,Eq,PartialOrd,Ord)]
pub enum SessionOperation{
#[default]
New
,Update
,Delete
}
pub enum UpdateParent<'a>{
Inherit
,Overwrite(Vec<(&'a str,CollectionRow)>)
}
pub struct SessionRecord<'a>{
collection_id:i32
,operation:Operation<'a>
}
impl<'a> SessionRecord<'a>{
pub fn new(
collection_id:i32
,operation:Operation<'a>
)->SessionRecord<'a>{
SessionRecord{
collection_id
,operation
}
}
pub fn collection_id(&self)->i32{
self.collection_id
}
pub fn operation(&self)->&Operation{
&self.operation
}
}
pub enum Operation<'a>{
New{
activity:Activity
,term_begin:UpdateTerm
,term_end:UpdateTerm
,fields:Vec<KeyValue<'a>>
,parents:UpdateParent<'a>
,childs:Vec<(&'a str,Vec<SessionRecord<'a>>)>
}
,Update{
row:u32
,activity:Activity
,term_begin:UpdateTerm
,term_end:UpdateTerm
,fields:Vec<KeyValue<'a>>
,parents:UpdateParent<'a>
,childs:Vec<(&'a str,Vec<SessionRecord<'a>>)>
}
,Delete{row:u32}
}