Trait Event

Source
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§

Source

fn event_type(&self) -> &str

Returns the type of the event.

Source

fn as_any(&self) -> &dyn Any

Returns the event as any type.

Provided Methods§

Source

fn table_name(&self) -> &str

Returns the table name of the event.

Source

fn timestamp(&self) -> Timestamp

Returns the timestamp of the event. Default to the current time.

Source

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.

Source

fn extra_schema(&self) -> Vec<ColumnSchema>

Add the extra schema to the event with the default schema.

Source

fn extra_row(&self) -> Result<Row>

Add the extra row to the event with the default row.

Implementors§