-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: bootstrap sqlx-jiff development #141
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: tison <[email protected]>
Signed-off-by: tison <[email protected]>
#50 (comment) discusses this. And the orphan rule is taken into account there. The way to do this integration, short of getting it merged upstream in Jiff is a "low level" crate. Having it depend on "high level" crates like |
This reverts commit 89f6330.
Signed-off-by: tison <[email protected]>
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.
@BurntSushi Yeah .. Adopt the other way now.
sqlx-jiff/src/lib.rs
Outdated
} | ||
} | ||
|
||
impl Deref for Timestamp { |
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.
impl AsRef
also?
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.
I'm not sure how far we want to go here. In theory, there are a lot of different traits we might want to implement. In practice, I'm not sure how useful they all are or whether we even want to encourage their use. I'd start with a minimal useful set for now.
I'm actually not even sure about using Deref
here. I'd leave that out for now.
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.
OK. Then I'd revoke #[derive(PartialEq, Eq, Serialize, Deserialize)]
also but just make it an opaque wrapper type. Users should always call to_jiff
and use jiff::Timestamp
's method.
Also, the crate should be called |
Signed-off-by: tison <[email protected]>
Signed-off-by: tison <[email protected]>
Signed-off-by: tison <[email protected]>
Other type mapping to be wrapped once we agree on the pattern:
Ref - |
This refers to #50.
Firstly, I considered to add a separated
sqlx-jiff
method, but soon I found that due to Rust's orphan rules, implementing sqlx's trait forTimestamp
and other types requires the code to be located at the same crate (jiff
). Otherwise we need an extra wrapper struct like:I prefer to implement code in
jiff
and gate it with feature flags.@BurntSushi This demonstrates the integration implementation direction. I'll complete other parts when we agree on this direction.