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

Impl TryGetableMany for diffrent types of generices #175

Merged
merged 3 commits into from
Sep 18, 2021

Conversation

MuhannadAlrusayni
Copy link
Contributor

Resolve #174
in addition I implemented TryGetableMany for 4 types tuple, and I think we will need more in the future.

@MuhannadAlrusayni
Copy link
Contributor Author

wait don't merge this, looks like we need to do the same for TryFromU64 to make #174 work.

@MuhannadAlrusayni
Copy link
Contributor Author

Done. Waiting for reviews :D

@tyt2y3
Copy link
Member

tyt2y3 commented Sep 18, 2021

Thank you. Out of curiosity, why do you needed tuple of such high arity?

@MuhannadAlrusayni
Copy link
Contributor Author

MuhannadAlrusayni commented Sep 18, 2021

Out of curiosity, why do you needed tuple of such high arity?

In my case I need it to do many-to-many, where 1st table have primary key of Uuid and the 2nd table have primary key of (String, String), and 3rd table (intermediate table) would have primary key of (Uuid, String, String).
I can imagine a use case where 1st table have two columns primary key, and the 2nd table have two columns primary keys.

we can also do this, but I'm not sure if this is useful use case: (I have not tried that yet :D)

let stmt = "select id, name, age, gender from ..";
let res: (i32, String, i32, String) = db.query_one(stmt)?
    .unwrap()
    .try_get_many("", &["id".to_owned(), "name".to_owned(), "age".to_owned(), "gender".to_owned()])?;

@tyt2y3 tyt2y3 merged commit 5d1488f into SeaQL:master Sep 18, 2021
@tyt2y3
Copy link
Member

tyt2y3 commented Sep 18, 2021

Oh interesting.

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.

Impl TryGetableMany for diffrent types of generices (A, B, C)
2 participants