Releases: elastic-rs/elastic-types
Releases · elastic-rs/elastic-types
0.19.1
0.19.0
This release refactors Date
to start reducing dependence on chrono::DateTime
, and to make sure date formats aren't implicitly changed. Some of these changes might turn out to be too restrictive and may be reverted in the future (allowing formats to change without explicit conversions).
- Change
remap
methods to be static methods instead of instance methods - Add
DateExpr
for supporting date math expressions
Changes to Date
- Change
Date<F, M = DefaultDateMapping<F>>
toDate<M>
. So you can't just writeDate<EpochMillis>
anymore, it needs to beDate<DefaultDateMapping<EpochMillis>>
. This simplifies the generics, and makesDate
easier to work with. To get the ergonomics ofDate<EpochMillis>
back, you can use type aliases:
// For default date types with just a single format
type MyDateType = Date<DefaultDateMapping<EpochMillis>>;
// For default date types with any format
type MyDateType<F> = Date<DefaultDateMappinng<F>>;
- Adds a
DateValue
andFormattableDateValue
type - Use
DateValue
in theDateFormat::parse
andDateFormat::format
methods instead ofchrono::DateTime
- Remove the conversion from
chrono::DateTime
intoDate<M>
unlessM::Format = ChronoFormat
. This is becausechrono::DateTime
is already mappable with theChronoFormat
, so to make sure that formats aren't implicitly changed, you need to convert achrono::DateTime
into aDateValue
first, which doesn't have any format:
Before:
let date = Date::from(chrono_date);
After:
let date = Date::from(DateValue::from(chrono_date));
Changes to GeoPoint
- Like
Date
,GeoPoint<F, M = DefaultGeoPointMapping<F>>
has been changed toGeoPoint<M>
. Use the same type aliases approach for ergonomics