Protryon / klickhouse

Rust crate for accessing Clickhouse
Apache License 2.0
92 stars 21 forks source link

Flattening in Row derive macro + documentation of attributes #35

Closed cpg314 closed 10 months ago

cpg314 commented 10 months ago

Following issue https://github.com/Protryon/klickhouse/issues/30, this implements the serde-like flatten attribute on the Row derive macro, allowing to compose rows as follows:

#[derive(klickhouse::Row)]
struct User {
  age: u8,
  name: string
}
#[derive(klickhouse::Row)]
struct Row {
  #[klickhouse(flatten)]
  user: User,
  credits: u32
}
let users: Vec<Row> = ch.query_collect("SELECT age, name, credits FROM ...").await?;

The commit also adds documentation on the derive macro, in particular::

This is stacked on PRs from #33 and #33 (tests and documentation). Only the last commit d58c63355c0bab01cbd6b9f9e520083a2b8be5cb is new. See only new changes.

Protryon commented 10 months ago

@cpg314 Once this is rebased and merged, would you like me to cut a release now or wait for #34 ?