Add example code from other databases to Getting Started document #229
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I followed your getting started guide earlier using SQLite (and thank you--it successfully got me started!), and I agreed with issue #130.
I put together some javascript to show the blocks of code for the examples using different databases. This is not quite as nice as the mock up in that issue, but the code-blocks seemed like they would be more complicated to add buttons to. Let me know if you think that (or anything else) should work differently and I can try to fix it.
The code examples I added were all copied and pasted out of here. Any examples that were exactly the same across the 3 databases I just left as they were and they still link to the PostgreSQL on github since I didn't want to add 3 copies of the same code just to update the github link. If you think that should be more consistent I can take another look and maybe find some better way to update the link.
Some specific questions I guessed on for now but should be answered definitively if you want to merge this:
Does this example, step 1 lib.rs need to include the line
use diesel::sqlite::SqliteConnection;
(or in the others, PgConnection or MySQLConnection)? The current getting started example includes the lineuse diesel::pg::PgConnection;
, but in the linked file on github that line is not included. It compiled and ran for me on SQLite without including that line.In the table macro example of schema.rs, does that actually vary by database type? I copied the generated schema.rs files from the examples, but I'm not sure if that is supposed to be different because it's not the auto-generated file.
Example of the markdown format to make a new code block that has different code for the different database options: