-
Notifications
You must be signed in to change notification settings - Fork 110
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
docs: adding context to timeuuid using v1 feature #980
Conversation
|
0180bf3
to
007c513
Compare
|
Unfortunately, the error message from CI tells me nothing. As it's Sphinx task-related, it's @dgarcia360 who should have a clue about that. |
The problem is Apart from incompatibility with Sphinx, I don't see why |
Ah, right. Then adding |
21815d4
to
f68a18b
Compare
f68a18b
to
a3a923a
Compare
@annastuchlik Can you drop a review on it? Just in case I missed something :p |
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.
One minor typo, apart from this looks good to me
d3c0907
to
64d3c71
Compare
Ready to merge! |
docs/source/data-types/timeuuid.md
Outdated
for row in rows.into_typed::<(CqlTimeuuid,)>() { | ||
let (timeuuid_value,): (CqlTimeuuid,) = row?; | ||
} | ||
} |
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.
Don't use raw rows
field on QueryResult
; prefer rows_typed::<(CqlTimeuuid,)>()
method:
if let Some(rows) = session.query("SELECT a FROM keyspace.table", &[]).await?.rows { | |
for row in rows.into_typed::<(CqlTimeuuid,)>() { | |
let (timeuuid_value,): (CqlTimeuuid,) = row?; | |
} | |
} | |
let mut iter = session.query("SELECT a FROM keyspace.table", &[]).await?.rows_typed::<(CqlTimeuuid,)>(); | |
while let Some((timeuuid_value,)) = iter.next().transpose()? { | |
// do something with timeuuid_value | |
} |
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'll update, but can you explain in details why I shouldn't use it?
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.
Fixed! Ready to merge.
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.
rows
make you interact with an untyped, materialised vec of columns. At the present state of the driver, the main drawback is reduced type safety; as you call into_typed
anyway, this negative aspect is mitigated.
Another reason for avoiding using rows
ATM, which is relevant here, is the ongoing deserialization refactor. We ditch the materialized vec of CqlValue
at all to reduce unnecessary allocations. The new deserialization framework is lazy, which means that the values are going to be deserialized on-the-fly straight to the end type, based on the type provided in the iterator (rows_typed::<T>
).
With the new framework having landed in the driver, rows
will be removed at all (although their capabilities can be emulated for the users that really need them).
See #955
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.
Thank you for your contribution to the docs, @DanielHe4rt !
Motivation
I decided to give more context for newcomers that want to try Timeuuid in the Rust Driver. Since I didn't had that much experience in the beginning and struggled for a while until understand how to use it.
Also I still didn't understand when and how I should generate the the node_id on
uuid::new_v1([])
parameters and IMHO it would be a great addition to the docs.Fixes
uuid::v1
usagenew_v1()
node_id numbersPre-review checklist
./docs/source/
.Fixes:
annotations to PR description.