Skip to content
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

result: add "Custom" metadata type #368

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions scylla/src/frame/response/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub struct TableSpec {

#[derive(Debug, Clone)]
pub enum ColumnType {
Custom(String),
Ascii,
Boolean,
Blob,
Expand Down Expand Up @@ -376,6 +377,10 @@ fn deser_type(buf: &mut &[u8]) -> StdResult<ColumnType, ParseError> {
use ColumnType::*;
let id = types::read_short(buf)?;
Ok(match id {
0x0000 => {
let type_str: String = types::read_string(buf)?.to_string();
Custom(type_str)
}
0x0001 => Ascii,
0x0002 => BigInt,
0x0003 => Blob,
Expand Down Expand Up @@ -534,6 +539,12 @@ fn deser_cql_value(typ: &ColumnType, buf: &mut &[u8]) -> StdResult<CqlValue, Par
}

Ok(match typ {
Custom(type_str) => {
return Err(ParseError::BadData(format!(
"Support for custom types is not yet implemented: {}",
type_str
)));
}
Ascii => {
if !buf.is_ascii() {
return Err(ParseError::BadData("String is not ascii!".to_string()));
Expand Down