pub struct Event {
pub id: String,
pub source: String,
pub event_type: String,
pub subject: Option<String>,
pub data: Option<EventData>,
pub time: Option<DateTime<Utc>>,
pub datacontenttype: Option<String>,
pub dataschema: Option<String>,
pub extensions: Vec<(String, ExtensionValue)>,
}Expand description
A stored event with a full source URI.
After storage, the EvidentSource server transforms the stream name into a full URI
like https://host/db/database-name/streams/stream-name.
Fields§
§id: StringUnique identifier for this event.
source: StringFull source URI (e.g., “https://host/db/name/streams/stream”).
event_type: StringThe event type (e.g., “com.example.account.opened”).
subject: Option<String>Optional subject identifying the entity this event is about.
data: Option<EventData>Optional event data payload.
time: Option<DateTime<Utc>>Optional timestamp when the event occurred.
datacontenttype: Option<String>Optional content type of the data.
dataschema: Option<String>Optional schema URI for the data.
extensions: Vec<(String, ExtensionValue)>Extension attributes.
Implementations§
Source§impl Event
impl Event
Sourcepub fn stream(&self) -> Option<&str>
pub fn stream(&self) -> Option<&str>
Extract the stream name from the source URI.
Parses URIs like https://host/db/name/streams/my-stream to extract my-stream.
Returns None if the URI doesn’t match the expected pattern.
Sourcepub fn event_type(&self) -> &str
pub fn event_type(&self) -> &str
Get the event type.
Sourcepub fn extension(&self, key: &str) -> Option<&ExtensionValue>
pub fn extension(&self, key: &str) -> Option<&ExtensionValue>
Get an extension value by key.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnwindSafe for Event
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request