sgrif / diesel.rs-website

MIT License
32 stars 97 forks source link

Update the "All about inserts" guide to diesel 2.0 #153

Closed weiznich closed 2 years ago

weiznich commented 2 years ago

As preparation of the upcoming diesel 2.0 release we need to update the guides on our web page to reflect the corresponding changes. For the "All about inserts" guide this involves the following points:

  1. Update any code snippet to the corresponding variant from the 2.0.x branch
  2. Update any link pointing to the corresponding example in our repository to point to the 2.0.x branch
  3. Update any documentation link to point to the corresponding 2.0.x documentation page
  4. Update the section about RETURNING so that it mentions that support for RETURNING clauses using the sqlite backend is behind a feature flag (returning_clauses_for_sqlite_3_35)
  5. Update the wording in the section about UPSERT so that it applies to the SQLite backend as well.
  6. Open a PR with all this changes targeting the diesel_2.0_update branch

Please use this issue as discussion platform to ask any question that is unclear about updating this guide.

alphabitserial commented 2 years ago

I have some questions, as I've noticed some inconsistencies in the original pages ("All About Inserts" & "All About Updates"), and I'd like to make them consistent while I update them:

weiznich commented 2 years ago

First of all: Thanks for working on this. Your PR's are really helpful.

To answer your two questions:

In the SQL code blocks, should I be using $1 etc. or ? ?

I would use $1 etc. there as this is the postgres specific bind syntax and all of the guides currently assume that you use postgres.

Should I include or exclude the --binds ["foo"] SQL comments?

I would include the binds there, as this is the output generated by debug_query. Additionally that gives an hint which values where used in place of the bind.

I'm only able to perform a complete review of your PR's next week, as I'm away from my PC for this weekend.

alphabitserial commented 2 years ago

Okay, sounds great. I ended up busier this weekend than I expected, but I will have time this week to finish up.

weiznich commented 2 years ago

No worries, take your time. Your contributions are already really helpful.

weiznich commented 2 years ago

Fixed by #160