public IAsyncEnumerable <EntityUpdateView> ExportAllUpdatesGrouped(UpdateType type) { // todo: move to view return(_db.QueryStreamAsync <EntityUpdateView>(@" select type, timestamp, update_id, source_id, entity_id, hash, case when (lag(hash) over w) is distinct from hash then (select data from objects o where o.hash = u.hash limit 1) end as data from updates u where type = @Type window w as (partition by type, entity_id order by timestamp) order by type, entity_id, timestamp ", new { Type = type })); }
public IAsyncEnumerable <TimeMapEntry> GetTimeMap() => _db.QueryStreamAsync <TimeMapEntry>("select * from time_map_view order by start_time", new object());