-
Notifications
You must be signed in to change notification settings - Fork 102
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
Support for serializing maps #99
Comments
Hi, what result do you expect? What is the definition of the table and |
Hello, I have been trying to add metadata to rows also via #[derive(Row, Serialize)]
struct Metadata {
foo: String,
bar: String,
}
#[derive(Row, Serialize)]
struct MyRow {
#[serde(flatten)]
metadata: Metadata,
data: String,
} This would be expected to represent a row with columns (foo, bar, data). I may be misunderstanding serde, but to me this seems like how the attribute should behave. For reference I intend to use this in a templated struct to apply metadata (source/timestamp) to rows during their final submissions. But the example above is better to show the behaviour I expect. Thanks Edit: I realise this may be related to struct flattening, not map flattening as the issue relates, but this may be to do with terminology in serde. |
I have similar issue but with deserialization for the following struct #[derive(Debug, Row, Deserialize)]
pub(super) struct ClickhouseQueryMeterResult {
// Use ClickHouse's custom serialization for datetime fields
#[serde(with = "clickhouse::serde::time::datetime")]
pub windowstart: OffsetDateTime,
#[serde(with = "clickhouse::serde::time::datetime")]
pub windowend: OffsetDateTime,
pub value: f64,
#[serde(flatten)]
pub grouped_by: HashMap<String, Value>,
} I want to deserialize all the additional fields returned from clickhouse into grouped_by field. Is there a work around for this ? |
I encountered an issue with the
clickhouse
crate when trying to serialize a struct that uses#[serde(flatten)]
to combine multiple fields into a single row. It appears that theserialize_map
function is not implemented, as indicated by thetodo!()
macro insrc/rowbinary/ser.rs
at line 168, column 9.Example:
From the source (
src/rowbinary/ser.rs:168.9
)When attempting to serialize this struct, my binary panics because
serialize_map
is not yet supported by the crate. Is there a workaround or a planned update to support this functionality?The text was updated successfully, but these errors were encountered: