pub trait Event:
Send
+ Sync
+ Debug {
// Required methods
fn event_type(&self) -> &str;
fn as_any(&self) -> &dyn Any;
// Provided methods
fn table_name(&self) -> &str { ... }
fn timestamp(&self) -> Timestamp { ... }
fn json_payload(&self) -> Result<String> { ... }
fn extra_schema(&self) -> Vec<ColumnSchema> { ... }
fn extra_row(&self) -> Result<Row> { ... }
}
Expand description
Event trait defines the interface for events that can be recorded and persisted as the system table. By default, the event will be persisted as the system table with the following schema:
type
: the type of the event.payload
: the JSON bytes of the event.timestamp
: the timestamp of the event.
The event can also add the extra schema and row to the event by overriding the extra_schema
and extra_row
methods.
Required Methods§
Sourcefn event_type(&self) -> &str
fn event_type(&self) -> &str
Returns the type of the event.
Provided Methods§
Sourcefn table_name(&self) -> &str
fn table_name(&self) -> &str
Returns the table name of the event.
Sourcefn timestamp(&self) -> Timestamp
fn timestamp(&self) -> Timestamp
Returns the timestamp of the event. Default to the current time.
Sourcefn json_payload(&self) -> Result<String>
fn json_payload(&self) -> Result<String>
Returns the JSON bytes of the event as the payload. It will use JSON type to store the payload.
Sourcefn extra_schema(&self) -> Vec<ColumnSchema>
fn extra_schema(&self) -> Vec<ColumnSchema>
Add the extra schema to the event with the default schema.