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

Flattening in Row derive macro + documentation of attributes #35

Merged
merged 1 commit into from
Jan 5, 2024

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