transaction

The 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

source

pub struct Model

A 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::author_id

source

pub fn author_id(&self) -> &Option<Id>

Author who ran the command, if known.

Parameter Type Description
returns &Option<Id>

Model::command

source

pub fn command(&self) -> &String

Rendered command line as executed.

Parameter Type Description
returns &String

Model::created_at

source

pub fn created_at(&self) -> &DateTime<Utc>

When the transaction was recorded.

Parameter Type Description
returns &DateTime<Utc>

Model::id

source

pub fn id(&self) -> &Id

Stable identifier assigned at creation.

Parameter Type Description
returns &Id

Model::project_id

source

pub fn project_id(&self) -> &Id

Project the command ran against.

Parameter Type Description
returns &Id

Model::undone_at

source

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

source

pub struct Event

A 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

source

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

source

pub fn created_at(&self) -> &DateTime<Utc>

When the event was recorded.

Parameter Type Description
returns &DateTime<Utc>

Event::event_type

source

pub fn event_type(&self) -> &String

Kind of change (e.g. insert, update, delete).

Parameter Type Description
returns &String

Event::id

source

pub fn id(&self) -> &Id

Stable identifier assigned at creation.

Parameter Type Description
returns &Id

Event::new_value

source

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

source

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

source

pub fn row_id(&self) -> &String

Primary key of the affected row.

Parameter Type Description
returns &String

Event::semantic_type

source

pub fn semantic_type(&self) -> &Option<String>

Optional domain-level column name the change targets.

Parameter Type Description
returns &Option<String>

Event::table_name

source

pub fn table_name(&self) -> &String

Name of the affected table.

Parameter Type Description
returns &String

Event::transaction_id

source

pub fn transaction_id(&self) -> &Id

Transaction this event belongs to.

Parameter Type Description
returns &Id