transaction
transactions and transaction_events tables, which record each command and its row changes for undo.Model is one recorded command. Event is one row change within it.
struct Model
pub struct ModelA recorded command execution for undo support.
| Field | Type | Description |
|---|---|---|
author_id |
Option<Id> | Author who ran the command, if known. |
command |
String | Rendered command line as executed. |
created_at |
DateTime<Utc> | When the transaction was recorded. |
id |
Id | Stable identifier assigned at creation. |
project_id |
Id | Project the command ran against. |
undone_at |
Option<DateTime<Utc>> | When the transaction was undone, or None if still in effect. |
Implements Clone, Debug, Deserialize<'de>, Eq, PartialEq, Serialize, TryFrom<Row>.
Model::command
pub fn command(&self) -> &StringRendered command line as executed.
| Parameter | Type | Description |
|---|---|---|
| returns | &String |
Model::created_at
pub fn created_at(&self) -> &DateTime<Utc>When the transaction was recorded.
| Parameter | Type | Description |
|---|---|---|
| returns | &DateTime<Utc> |
Model::id
pub fn id(&self) -> &IdStable identifier assigned at creation.
| Parameter | Type | Description |
|---|---|---|
| returns | &Id |
Model::project_id
pub fn project_id(&self) -> &IdProject the command ran against.
| Parameter | Type | Description |
|---|---|---|
| returns | &Id |
Model::undone_at
pub fn undone_at(&self) -> &Option<DateTime<Utc>>When the transaction was undone, or None if still in effect.
| Parameter | Type | Description |
|---|---|---|
| returns | &Option<DateTime<Utc>> |
struct Event
pub struct EventA single change recorded within a transaction for undo replay.
| Field | Type | Description |
|---|---|---|
before_data |
Option<Value> | Full JSON snapshot of the affected row before the change, when captured. |
created_at |
DateTime<Utc> | When the event was recorded. |
event_type |
String | Kind of change (e.g. insert, update, delete). |
id |
Id | Stable identifier assigned at creation. |
new_value |
Option<String> | Serialized post-change value for single-field updates, when applicable. |
old_value |
Option<String> | Serialized pre-change value for single-field updates, when applicable. |
row_id |
String | Primary key of the affected row. |
semantic_type |
Option<String> | Optional domain-level column name the change targets. |
table_name |
String | Name of the affected table. |
transaction_id |
Id | Transaction this event belongs to. |
Implements Clone, Debug, Deserialize<'de>, Eq, PartialEq, Serialize, TryFrom<Row>.
Event::before_data
pub fn before_data(&self) -> &Option<Value>Full JSON snapshot of the affected row before the change, when captured.
| Parameter | Type | Description |
|---|---|---|
| returns | &Option<Value> |
Event::created_at
pub fn created_at(&self) -> &DateTime<Utc>When the event was recorded.
| Parameter | Type | Description |
|---|---|---|
| returns | &DateTime<Utc> |
Event::event_type
pub fn event_type(&self) -> &StringKind of change (e.g. insert, update, delete).
| Parameter | Type | Description |
|---|---|---|
| returns | &String |
Event::id
pub fn id(&self) -> &IdStable identifier assigned at creation.
| Parameter | Type | Description |
|---|---|---|
| returns | &Id |
Event::new_value
pub fn new_value(&self) -> &Option<String>Serialized post-change value for single-field updates, when applicable.
| Parameter | Type | Description |
|---|---|---|
| returns | &Option<String> |
Event::old_value
pub fn old_value(&self) -> &Option<String>Serialized pre-change value for single-field updates, when applicable.
| Parameter | Type | Description |
|---|---|---|
| returns | &Option<String> |
Event::row_id
pub fn row_id(&self) -> &StringPrimary key of the affected row.
| Parameter | Type | Description |
|---|---|---|
| returns | &String |
Event::semantic_type
pub fn semantic_type(&self) -> &Option<String>Optional domain-level column name the change targets.
| Parameter | Type | Description |
|---|---|---|
| returns | &Option<String> |
Event::table_name
pub fn table_name(&self) -> &StringName of the affected table.
| Parameter | Type | Description |
|---|---|---|
| returns | &String |
Event::transaction_id
pub fn transaction_id(&self) -> &IdTransaction this event belongs to.
| Parameter | Type | Description |
|---|---|---|
| returns | &Id |