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

Making realworld-postgres example compile #90

Merged
merged 1 commit into from
Feb 1, 2020

Conversation

xcthulhu
Copy link
Contributor

No description provided.

@xcthulhu xcthulhu requested a review from mehcode January 27, 2020 00:44
@mehcode
Copy link
Member

mehcode commented Jan 27, 2020

I really appreciate the PR but looking at the change, this actually looks like an unintentional regression with the query macros. We should support trailing commas.

@abonander ?

@abonander
Copy link
Collaborator

abonander commented Jan 27, 2020

Ah, yeah it was an accidental regression with the macro_rules! facade.

The fix should be as simple as duplicating the second branch of each macro in this file and adding a trailing comma*: https://github.com/launchbadge/sqlx/blob/master/src/macros.rs
Then add trailing commas arbitrarily to some macro invocations in tests/ to make sure we don't regress again (not all of them because we want to test the omission of a trailing comma as well).

Additionally, we should be checking that this example compiles on CI. We'll probably do that separately.

*I just tried adding $(,)? to the macros but you can't do that without having a metavariable in there.

@abonander
Copy link
Collaborator

@xcthulhu did you want to make the fixes I mentioned above? The modifications you made to the example shouldn't actually be necessary then.

@xcthulhu
Copy link
Contributor Author

@abonander I have to admit, I'm a n00b at rust macros. Can you give an example of the sort of change you are talking about? After that I can make a PR with the change.

If you guys have pg_tmp on CI, I can fix this example so it compiles. I've been spamming @mehcode with my build.rs file for this on discord...

@mehcode
Copy link
Member

mehcode commented Feb 1, 2020

If you guys have pg_tmp on CI, I can fix this example so it compiles. I've been spamming @mehcode with my build.rs file for this on discord...

There may be something fun we can do with pg_tmp after we get migrations to enable super fast integration testing. Definitely worth exploring in the near future.


@abonander I have to admit, I'm a n00b at rust macros. Can you give an example of the sort of change you are talking about? After that I can make a PR with the change.

No worries. I'm going to merge this so the example compiles for now. Thanks for the fix. I'll leave it to @abonander to fix the macro itself ( I opened #105 ).

@mehcode mehcode merged commit bdfea1a into launchbadge:master Feb 1, 2020
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.

3 participants