Comments (12)
You can convert them into Vec/Map and then to Value.
from cdrs-tokio.
You can convert them into Vec/Map and then to Value.
Not really understanding, any code snippet?
from cdrs-tokio.
Here's an example how to convert a Cassandra list to a Vec: https://github.com/krojew/cdrs-tokio/blob/master/cdrs-tokio/tests/collection_types.rs#L76
You can do similar thing to a Map.
from cdrs-tokio.
Here's an example how to convert a Cassandra list to a Vec: https://github.com/krojew/cdrs-tokio/blob/master/cdrs-tokio/tests/collection_types.rs#L76
You can do similar thing to a Map.
But the problem is the row structure is unknown. I need to use ColSpec to get correct type
from cdrs-tokio.
Is there anything preventing you from calling as_r_rust()
on the column data?
from cdrs-tokio.
Is there anything preventing you from calling
as_r_rust()
on the column data?
No, but when I declare the new variable like HashMap<String, String (assume I don't know it's String)>, I have to provide type. But assume I don't know the map structure
from cdrs-tokio.
ColTypeOptionValue
contains the information about the underlying types for collections. You can use that to deserialize appropriate values and move them into serde_json::Value
.
from cdrs-tokio.
ColTypeOptionValue
contains the information about the underlying types for collections. You can use that to deserialize appropriate values and move them intoserde_json::Value
.
Yes, currently using this, but not sure how to deal with nested map and triple
from cdrs-tokio.
The same way you'd do it with other programming languages - recursion.
from cdrs-tokio.
@krojew , any idea ?
let v: ColTypeOptionValue = col.clone().col_type.value.expect("");
let v = match v {
ColTypeOptionValue::CMap(key, v) => {
println!("{:#?} {:#?}", key.id, v);
// how to use key.id and v.id here?
let map: HashMap<?, ?> = row
.r_by_name::<Map>(col.name.as_str())
.expect("")
.as_r_rust()
.expect("");
}
_ => todo!(),
};
from cdrs-tokio.
You are asking a basic programming question now, which is out of scope of rust crates.
from cdrs-tokio.
Related Issues (20)
- Keyspace setup falls Transport to infinite loop HOT 1
- schema change event is never received HOT 23
- Add support for HTTP proxy HOT 2
- error UnexpectedWriteType("CAS")) with multiple tokio tasks HOT 10
- Trouble with dropped connections on Session HOT 5
- increase in size for a byte array HOT 23
- Add non exhaustive to proto enums HOT 1
- TLS Example HOT 1
- Paging HOT 13
- Support for tracing informations HOT 4
- Range end index 88 out of range for slice of length 83 HOT 2
- Session can hit errors if used immediately
- rustc stack overflow when deriving IntoCdrsValue and TryFromRow if struct contains static string reference HOT 4
- Case where a machine is up but unreachable HOT 44
- High CPU usage for cdrs_tokio::transport::AsyncTransport::start_processing HOT 19
- exec_with_params is returning ErrorType::Unprepared. HOT 7
- ExponentialReconnectionPolicy panics after several attempts HOT 1
- Protocol v5 tests HOT 3
- Bug in transport.rs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cdrs-tokio.