-
-
Notifications
You must be signed in to change notification settings - Fork 192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get time from sqlx-sqlite directly #412
Conversation
sea-query-driver/src/sqlx_sqlite.rs
Outdated
v @ Value::TimeDate(_) => query.bind(v.time_as_naive_utc_in_string()), | ||
v @ Value::TimeTime(_) => query.bind(v.time_as_naive_utc_in_string()), | ||
v @ Value::TimeDateTime(_) => query.bind(v.time_as_naive_utc_in_string()), | ||
v @ Value::TimeDateTimeWithTimeZone(_) => query.bind(v.time_as_naive_utc_in_string()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time_as_naive_utc_in_string
is still used by rusqlite
and cannot be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyoto7250, thank you! Maybe we need to upgrade sqlx version here https://github.com/SeaQL/sea-query/blob/master/sea-query-binder/Cargo.toml#L18 ?
@kyoto7250 some tests failed |
Ah, This code does not work because It is not pattern matching anymore.
Thank you, I fixed in a8806ed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyoto7250 thank you! LGTM!
Hmm, we got a runtime error in CI. Sorry, I will check it. |
I think sqlx convert time object differently than sea-query do it before... |
It appears that Lines 436 to 437 in 6db27fd
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kyoto7250, thanks for the contributions!
Yes, this PR contains breaking changes, to be specific,
Value::TimeDate(Option<Box<time::Date>>)
is being serialized and store as String with format- old format:
[year]-[month]-[day]
- new format:
[year]-[month]-[day]
- No Change!
- old format:
Value::TimeTime(Option<Box<time::Time>>)
is being serialized and store as String with format- old format:
[hour]:[minute]:[second]
- new format:
[hour]:[minute]:[second].[subsecond]
- old format:
Value::TimeDateTime(Option<Box<PrimitiveDateTime>>)
is being serialized and store as String with format- old format:
[year]-[month]-[day] [hour]:[minute]:[second]
- new format:
[year]-[month]-[day] [hour]:[minute]:[second].[subsecond]
- old format:
Value::TimeDateTimeWithTimeZone(Option<Box<OffsetDateTime>>)
is being serialized and store as String with format- old format:
[year]-[month]-[day] [hour]:[minute]:[second] [offset_hour sign:mandatory][offset_minute]
- new format:
[year]-[month]-[day]T[hour]:[minute]:[second].[subsecond]Z
(RFC 3339)
- old format:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyoto7250 hello! Tests are failed: https://github.com/SeaQL/sea-query/runs/7969914195?check_suite_focus=true
src/value.rs
Outdated
format_description!("[hour]:[minute]:[second].[subsecond]"); | ||
pub static FORMAT_DATETIME: &[FormatItem<'static>] = | ||
format_description!("[year]-[month]-[day] [hour]:[minute]:[second]"); | ||
pub static FORMAT_DATETIME_TZ: &[FormatItem<'static>] = format_description!( | ||
"[year]-[month]-[day] [hour]:[minute]:[second] [offset_hour sign:mandatory][offset_minute]" | ||
); | ||
format_description!("[year]-[month]-[day] [hour]:[minute]:[second].[subsecond]"); | ||
pub static FORMAT_DATETIME_TZ: &[FormatItem<'static>] = | ||
format_description!("[year]-[month]-[day] [hour]:[minute]:[second].[subsecond]Z"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @kyoto7250, I don't think we need to change this part of the code. This is just for to_string
on SQL statement and it has nothing to do with value binding. I think we should keep it as-is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts? @kyoto7250
Sorry, I am traveling until this week, so I will check it in this weekend. Thank you for your kind 👍🏽 |
I'm sorry I'm late. |
@kyoto7250 hello! Can you resolve merge conflict? |
@kyoto7250 any updates? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kyoto7250 thank you! LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!! @kyoto7250
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ikrivosheev feel free to merge it
PR Info
close [SeaQuery] Support
time
crate on SQLite #409Changes
Breaking Changes
DateType
,time
is no longer compatible withchrono
.