Struct EventStream

Source
pub struct EventStream {
Show 21 fields pub id: Uuid, pub session_id: Uuid, pub tenant_id: Uuid, pub event_source: String, pub event_type: String, pub timestamp: DateTime<Utc>, pub created_by: String, pub md5_hash: String, pub request_id: Option<Uuid>, pub owner_id: Option<String>, pub product_id: Option<Uuid>, pub product_schema_uri: Option<String>, pub event_source_uri: Option<String>, pub affected_entity_uri: Option<String>, pub message: Option<String>, pub payload: Option<Value>, pub payload_uri: Option<String>, pub context: Option<Value>, pub context_uri: Option<String>, pub metadata: Option<Value>, pub tags: Option<Value>,
}
Expand description

Generic Event-Stream envelope (Event V1).

This struct matches the Event V1 schema exactly. All required and optional fields are included, with correct types.

Fields§

§id: Uuid§session_id: Uuid§tenant_id: Uuid§event_source: String§event_type: String§timestamp: DateTime<Utc>§created_by: String§md5_hash: String§request_id: Option<Uuid>§owner_id: Option<String>§product_id: Option<Uuid>§product_schema_uri: Option<String>§event_source_uri: Option<String>§affected_entity_uri: Option<String>§message: Option<String>§payload: Option<Value>§payload_uri: Option<String>§context: Option<Value>§context_uri: Option<String>§metadata: Option<Value>§tags: Option<Value>

Implementations§

Source§

impl EventStream

Source

fn compute_payload_hash(payload: &Option<Value>) -> String

Compute hash for the given payload

§Arguments
  • payload - The payload to compute the hash for
§Returns
  • String - The hash of the payload
Source

pub fn new( session_id: Uuid, tenant_id: Uuid, event_source: String, event_type: String, created_by: String, request_id: Option<Uuid>, owner_id: Option<String>, product_id: Option<Uuid>, product_schema_uri: Option<String>, event_source_uri: Option<String>, affected_entity_uri: Option<String>, message: Option<String>, payload: Option<Value>, payload_uri: Option<String>, context: Option<Value>, context_uri: Option<String>, metadata: Option<Value>, tags: Option<Value>, ) -> Self

Create a new EventStream

§Arguments
  • session_id - The session ID
  • tenant_id - The tenant ID
  • event_source - The event source
  • event_type - The event type
  • created_by - The created by
  • request_id - The request ID
  • owner_id - The owner ID
  • product_id - The product ID
  • product_schema_uri - The product schema URI
  • event_source_uri - The event source URI
  • affected_entity_uri - The affected entity URI
  • message - The message
  • payload - The payload
  • payload_uri - The payload URI
  • context - The context
  • context_uri - The context URI
  • metadata - The metadata
  • tags - The tags
§Returns
  • EventStream - The new EventStream

Trait Implementations§

Source§

impl Debug for EventStream

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for EventStream

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for EventStream

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,