Skip to content

Conversation

@cpg314
Copy link
Collaborator

@cpg314 cpg314 commented Dec 25, 2023

Following issue #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 d58c633 is new. See only new changes.

@Protryon
Copy link
Owner

Protryon commented Jan 4, 2024

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

Following issue 30, this implements the serde-like `flatten` attribute on the `Row` derive macro, allowing to compose rows as follows:
```
struct Row {
  #[klickhouse(flatten)]
  user: User,
  credits: u32
}
let users: Vec<Row> = ch.query_collect("SELECT age, name, credits FROM ...").await?;
```

The commit also documents the serde- and clickhouse-specific attributes supported by the derive macro.
@Protryon Protryon merged commit f8439b7 into Protryon:master Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants