alexpikalov / cdrs-async Goto Github PK
View Code? Open in Web Editor NEWAsync Cassandra driver made in Rust
Async Cassandra driver made in Rust
Hi Alex!
We're (@stadiamaps) using the synchronous variant of your CDRS crate in one of our Rust applications and we really like it. We're wrapping the sync operations in a Tokio blocking
thread, so it's not ideal.
How can we help push the async
version along?
Looking forward to helping!
I'm trying to make cdrs-helper-derive work with cdrs-aync, but failed. Is there any plan to support this use case.
`let mut loop_index = 0;
let mut paging_state = None;
loop {
println!("loop index: {:?}", &loop_index);
println!("pagin state: {:?}", &paging_state);
let params = page_request.build_query_params(paging_state, None);
let body: ResponseBody = scylladb
.query_body(&page_request.row_query_str, params)
.await
.unwrap();
let mut rows_cnt = 0;
match &body {
ResponseBody::Result(res) => {
match res {
ResResultBody::Rows(rows) => {
rows_cnt = rows.rows_count;
},
_ => ()
}
},
_ => (),
}
if rows_cnt == 0 {
return Ok(PageResult {
page_size: page_request.page_size,
page_index: page_request.page_index,
total: 0,
data: Vec::new(),
});
}
paging_state = body.as_rows_metadata().unwrap().paging_state;
if page_request.page_index == loop_index {
let rows = body.into_rows().unwrap();
let mut result: Vec<K> = Vec::new();
for row in rows {
result.push(K::try_from_row(row).expect("row transform error"));
}
// dbg!(rows);
// dbg!(paging_state);
return Ok(PageResult {
page_size: page_request.page_size,
page_index: page_request.page_index,
total: 0,
data: result,
});
} else {
loop_index = loop_index + 1;
}
}`
Hi,
I have a little server app with tokio and I need to perform a basic query. I can perform the query, but now I'm stuck on the deserialization of the result. I know this is in early stages of development, so not sure if this is in place, or has to be implemented. Which would be the right way to deserialize a result row? Can we use "cdrs" (non async library) for deserialization? Or we have to deserialize each field by hand?
Thanks.
I'm sorry... this was created by accident by my IDE :(
I see a lot of libraries starting to move to async/await, but being dependent on specific runtimes (either async-std or tokio) and this can become a mess when developers starts to need different libraries depending on different runtimes...
Also are you planning to merge it with the synchronous version or maintaining both in parallel?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.