public static FilterUtil BetweenDateKeys(string columnName, DateKey startDate, DateKey endDate) { return(Combine( Column(columnName, startDate, ColumnOperator.GreaterThanOrEqual), CombineOperator.And, Column(columnName, endDate, ColumnOperator.LessThanOrEqual))); }
public static FilterUtil SinceDate(string columnName, DateKey startDate) { var filter = TableQuery.GenerateFilterCondition( columnName, QueryComparisons.GreaterThanOrEqual, startDate.Key); return(new FilterUtil(filter)); }
/// <summary> /// Ensure the view name for the given job is present in the <see cref="AzureConstants.TableNames.ViewNameDate"/> table. /// </summary> private async Task PopulateViewName(JobId jobId, DateTimeOffset buildDate) { try { var dateKey = new DateKey(buildDate); var entity = new ViewNameEntity(dateKey, AzureUtil.GetViewName(jobId)); var op = TableOperation.Insert(entity); await _viewNameDateTable.ExecuteAsync(op); } catch (StorageException ex) when(ex.RequestInformation.HttpStatusCode == 409) { // It's expected to get errors here because we're inserting duplicate data. All that matters is the // data is present in the table. } }
/// <summary> /// Query counter entities between the specified dates (inclusive) /// </summary> public static TableQuery <T> CreateTableQuery <T>(DateTimeOffset startDate, DateTimeOffset endDate) where T : CounterEntity, new() { var startDateKey = new DateKey(startDate); var endDateKey = new DateKey(endDate); var filter = FilterUtil .Combine( FilterUtil.BetweenDateKeys(ColumnNames.PartitionKey, startDateKey, endDateKey), CombineOperator.And, FilterUtil.Combine( FilterUtil.Column(nameof(CounterEntity.DateTimeUtcTicks), startDate.UtcTicks, ColumnOperator.GreaterThanOrEqual), CombineOperator.And, FilterUtil.Column(nameof(CounterEntity.DateTimeUtcTicks), endDate.UtcTicks, ColumnOperator.LessThanOrEqual))); return(new TableQuery <T>().Where(filter.Filter)); }
public ViewNameEntity(DateKey dateKey, string viewName) { PartitionKey = dateKey.Key; RowKey = viewName; }
public static FilterUtil SinceDate(ColumnNames name, DateKey startDate) { return(SinceDate(ToColumnName(name), startDate)); }
public static FilterUtil Column(string columnName, DateKey dateKey, ColumnOperator op = ColumnOperator.Equal) { return(Column(columnName, dateKey.Key, op)); }
public static FilterUtil Column(ColumnNames name, DateKey dateKey, ColumnOperator op = ColumnOperator.Equal) { return(Column(ToColumnName(name), dateKey, op)); }
public static FilterUtil BetweenDateKeys(ColumnNames name, DateKey startDate, DateKey endDate) { return(BetweenDateKeys(ToColumnName(name), startDate, endDate)); }