use of com.datastax.dse.driver.api.core.data.time.DateRange in project nosqlbench by nosqlbench.
the class DateRangeDuring method apply.
@Override
public DateRange apply(long value) {
ZonedDateTime date = ZonedDateTime.ofInstant(Instant.ofEpochMilli(value), zoneid);
DateRangeBound lower = DateRangeBound.lowerBound(date, precision);
DateRangeBound upper = DateRangeBound.upperBound(date, precision);
DateRange dateRange = new DateRange(lower, upper);
return dateRange;
}
use of com.datastax.dse.driver.api.core.data.time.DateRange in project nosqlbench by nosqlbench.
the class DateRangeFunc method apply.
@Override
public DateRange apply(long value) {
ZonedDateTime lowerDate = ZonedDateTime.ofInstant(Instant.ofEpochMilli(lower.applyAsLong(value)), zoneid);
DateRangeBound lower = DateRangeBound.lowerBound(lowerDate, precision);
ZonedDateTime upperDate = ZonedDateTime.ofInstant(Instant.ofEpochMilli(upper.applyAsLong(value)), zoneid);
DateRangeBound upper = DateRangeBound.upperBound(upperDate, precision);
DateRange dateRange = new DateRange(lower, upper);
return dateRange;
}
use of com.datastax.dse.driver.api.core.data.time.DateRange in project nosqlbench by nosqlbench.
the class DateRangeOnOrBefore method apply.
@Override
public DateRange apply(long value) {
ZonedDateTime date = ZonedDateTime.ofInstant(Instant.ofEpochMilli(value), zoneid);
DateRangeBound lower = DateRangeBound.UNBOUNDED;
DateRangeBound upper = DateRangeBound.upperBound(date, precision);
DateRange dateRange = new DateRange(lower, upper);
return dateRange;
}
use of com.datastax.dse.driver.api.core.data.time.DateRange in project java-driver by datastax.
the class DateRangeCodecTest method should_encode_and_decode.
@Test
@UseDataProvider("dateRanges")
public void should_encode_and_decode(DateRange dateRange) {
TypeCodec<DateRange> codec = DseTypeCodecs.DATE_RANGE;
DateRange decoded = codec.decode(codec.encode(dateRange, ProtocolVersion.DEFAULT), ProtocolVersion.DEFAULT);
assertThat(decoded).isEqualTo(dateRange);
}
use of com.datastax.dse.driver.api.core.data.time.DateRange in project nosqlbench by nosqlbench.
the class DateRangeOnOrAfter method apply.
@Override
public DateRange apply(long value) {
ZonedDateTime date = ZonedDateTime.ofInstant(Instant.ofEpochMilli(value), zoneid);
DateRangeBound lower = DateRangeBound.lowerBound(date, precision);
DateRangeBound upper = DateRangeBound.UNBOUNDED;
DateRange dateRange = new DateRange(lower, upper);
return dateRange;
}
Aggregations