public IAsyncEnumerable <TributesUpdateView> GetTributeUpdatesHourly(TributesQuery opts) => GetTributeUpdatesInner("tributes_hourly", opts);
private IAsyncEnumerable <TributesUpdateView> GetTributeUpdatesInner(string table, TributesQuery opts) { var q = new SqlKata.Query(table) .SelectRaw("update_id, timestamp, array_agg(player_id) as players, array_agg(peanuts) as peanuts") .GroupBy("timestamp", "update_id") .ApplySorting(opts, "timestamp", "update_id") .ApplyBounds(opts, "timestamp"); if (opts.Players != null) { q.WhereIn("player_id", opts.Players); } return(_db.QueryKataAsync <TributesUpdateView>(q)); }
public IAsyncEnumerable <TributesUpdateView> GetTributeUpdates(TributesQuery opts) => GetTributeUpdatesInner("tributes_by_player", opts);