marten
marten copied to clipboard
querying / filtering events by type
currently I'm working on a small reporting tool that will output some of our events (create and change events for a specific type) into a csv specific by a start time and end time.
Unfortunatly via QueryRawEventDataOnly
it's not possible to filter by multiple types. and QueryAllRawEvents
does not expose the type
parameter.
At the moment the only thing it might be possible would be to do client side filtering:
var events = await session.Events
.QueryAllRawEvents()
.Where(t => t.Timestamp >= firstDayOfMonth && t.Timestamp < firstDayOfNextMonth)
.ToListAsync();
events.Where(t => t is Event<TenantCreateEvent> || t is Event<TenantChangeEvent>).ToList()
it would be at least great to expose the type
param to IEvent
Hmm, not knowing the application, have you tried or considered just going with projections? E.g. see the example https://martendb.io/documentation/events/projections/projectionbyeventtype/ that projects by a time window.
And I still like this idea, but I'm unilaterally kicking it back to 4.1
Maybe support query by interface ? see https://github.com/JasperFx/marten/issues/623