Coder Social home page Coder Social logo

cdrs-async's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ Iโ€™m currently working on:

    • Rasmus - standalone WebAssembly engine.
    • TeleMQ - MQTT broker.
  • Previous projects:

    • CDRS - first Rust-native Apache Cassandra client.

cdrs-async's People

Contributors

alexpikalov avatar yukim avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cdrs-async's Issues

How can we help?

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!

there may be a Bug with paging.

`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;
        }
    }`

Best way to deserialize result

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 :(

Question: any way to make it runtime agnostic?

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.