예제 #1
0
 public static FilterUtil BetweenDateKeys(string columnName, DateKey startDate, DateKey endDate)
 {
     return(Combine(
                Column(columnName, startDate, ColumnOperator.GreaterThanOrEqual),
                CombineOperator.And,
                Column(columnName, endDate, ColumnOperator.LessThanOrEqual)));
 }
예제 #2
0
        public static FilterUtil SinceDate(string columnName, DateKey startDate)
        {
            var filter = TableQuery.GenerateFilterCondition(
                columnName,
                QueryComparisons.GreaterThanOrEqual,
                startDate.Key);

            return(new FilterUtil(filter));
        }
예제 #3
0
 /// <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.
     }
 }
예제 #4
0
        /// <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));
        }
예제 #5
0
 public ViewNameEntity(DateKey dateKey, string viewName)
 {
     PartitionKey = dateKey.Key;
     RowKey       = viewName;
 }
예제 #6
0
 public static FilterUtil SinceDate(ColumnNames name, DateKey startDate)
 {
     return(SinceDate(ToColumnName(name), startDate));
 }
예제 #7
0
 public static FilterUtil Column(string columnName, DateKey dateKey, ColumnOperator op = ColumnOperator.Equal)
 {
     return(Column(columnName, dateKey.Key, op));
 }
예제 #8
0
 public static FilterUtil Column(ColumnNames name, DateKey dateKey, ColumnOperator op = ColumnOperator.Equal)
 {
     return(Column(ToColumnName(name), dateKey, op));
 }
예제 #9
0
 public static FilterUtil BetweenDateKeys(ColumnNames name, DateKey startDate, DateKey endDate)
 {
     return(BetweenDateKeys(ToColumnName(name), startDate, endDate));
 }