Skip to content

Support for serializing maps #99

@AdvaithD

Description

@AdvaithD

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 the serialize_map function is not implemented, as indicated by the todo!() macro in src/rowbinary/ser.rs at line 168, column 9.

Example:

pub struct Xyz<T: Serialize + Row> {
    #[serde(flatten)]
    pub first_field: Metadata,
    #[serde(flatten)]
    pub second_field: T,
}

From the source (src/rowbinary/ser.rs:168.9)

    #[inline]
    fn serialize_map(self, _len: Option<usize>) -> Result<Self::SerializeMap> {
        todo!();
    }

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions