View Source EventStreamex.Operators.EntityProcessed (EventStreamex v1.3.1)

This module is called last for each event.

All it does is register the last updated timestamp of the entity and store it in the EventStreamex.Operators.ProcessStatus module.

By default the timestamp is taken from the updated_at field of the entity but you can change that in the :process_status_entity_field config param.

If no timestamp could be found, the entity is not registered in the process status.

Works with fields of type:

  • bigint: The unix timestamp with a microsecond precision
  • DateTime: Using microsecond precision
  • NaiveDateTime: Using microsecond precision

Summary

Functions

Transforms the last updated time field value to a unix timestamp. The precision must be in microsecond.

Transforms the last updated time field value to a unix timestamp.

Functions

Link to this function

processed(event)

View Source (since 1.1.0)
Link to this function

to_unix_timestamp(timestamp)

View Source (since 1.1.0)

Transforms the last updated time field value to a unix timestamp. The precision must be in microsecond.

Allowed types are:

  • bigint: The unix timestamp with a microsecond precision
  • DateTime: Using microsecond precision
  • NaiveDateTime: Using microsecond precision

Returns {:ok, unix_timestamp} or {:error, reason}

Examples

iex> EventStreamex.Operators.EntityProcessed.to_unix_timestamp(nil)
{:error, :no_value}
iex> EventStreamex.Operators.EntityProcessed.to_unix_timestamp("bad arg")
{:error, :bad_arg}
iex> EventStreamex.Operators.EntityProcessed.to_unix_timestamp(1422057007123000)
{:ok, 1422057007123000}
iex> {:ok, datetime, 9000} = DateTime.from_iso8601("2015-01-23T23:50:07.123+02:30")
iex> EventStreamex.Operators.EntityProcessed.to_unix_timestamp(datetime)
{:ok, 1422048007123000}
iex> naivedatetime = NaiveDateTime.from_iso8601!("2015-01-23T23:50:07.123Z")
iex> EventStreamex.Operators.EntityProcessed.to_unix_timestamp(naivedatetime)
{:ok, 1422057007123000}
Link to this function

to_unix_timestamp!(timestamp)

View Source (since 1.1.0)

Transforms the last updated time field value to a unix timestamp.

See to_unix_timestamp/1