Conversation
hasezoey
left a comment
There was a problem hiding this comment.
some things i noticed.
also converting this pr to WIP because of requirements
|
|
||
| Currently, it's more advantageous to generate code over deriving code with macros because intellisense and autocompletion isn't quite there when it comes to macro expansion. | ||
|
|
||
| **Migrating from v0 to v1? See migration notes below.** |
There was a problem hiding this comment.
| **Migrating from v0 to v1? See migration notes below.** | |
| **Migrating from v0 to v1? See [migration notes below](#migrating-from-v0-to-v1).** |
Note that i have not checked the slug, but it should likely be this
| - Supports `diesel-async` (enable `async` feature flag) | ||
| - Generates structs based on your `schema.rs` file (see the `test/simple_table` folder for sample output) | ||
| - Optionally generates CRUD functions and helper methods | ||
| - Use as a binary or library (read more below) |
There was a problem hiding this comment.
| - Use as a binary or library (read more below) | |
| - Usable as a binary or library (read more below) |
i think this reads better with better understanding
| Now we have everything we need! | ||
|
|
||
| ```rust | ||
| use models::todos; |
There was a problem hiding this comment.
why remove that line? i think this would make sense to get to know where some things come from
| /* | ||
| CRUD examples | ||
| */ | ||
| let created_todo = todos::create(&mut db, todos::CreateTodo { |
There was a problem hiding this comment.
| let created_todo = todos::create(&mut db, todos::CreateTodo { | |
| let created_todo = Todo::create(&mut db, todos::CreateTodo { |
unless i missed something, this should likely be the actual case (error from before this PR)
| let updated_todo = todos::update(&mut db, created_todo.id, UpdateTodo { | ||
| })?; | ||
|
|
||
| let todos_list = Todo::paginate(db, 1, 10)?; |
There was a problem hiding this comment.
if this PR requires #103, then shouldnt this take one more parameter?
| /* | ||
| CRUD examples | ||
| */ | ||
| let created_todo = todos::create(&mut db, todos::CreateTodo { |
There was a problem hiding this comment.
| let created_todo = todos::create(&mut db, todos::CreateTodo { | |
| let created_todo = todos::create(&mut db, CreateTodo { |
also to be consistent with later calls
| Use the "Filter" helper | ||
| --> Works well with intellisense! <-- | ||
| --> Easily create reusable/portable queries! <-- | ||
| (Support for date/time and other types coming soon) |
There was a problem hiding this comment.
what support is missing?
| ## Migrating from v0 to v1 | ||
| * For those that use plural table names: English-based pluralization is no longer handled. If you had a table named `todos`, dsync will not generate a struct named `Todo` anymore, but instead, `struct Todos` will be generated. It might be easier to rename your tables entirely to singular case. |
There was a problem hiding this comment.
| ## Migrating from v0 to v1 | |
| * For those that use plural table names: English-based pluralization is no longer handled. If you had a table named `todos`, dsync will not generate a struct named `Todo` anymore, but instead, `struct Todos` will be generated. It might be easier to rename your tables entirely to singular case. | |
| ## Migrating from v0 to v1 | |
| * For those that use plural table names: English-based pluralization is no longer handled. If you had a table named `todos`, dsync will not generate a struct named `Todo` anymore, but instead, `struct Todos` will be generated. It might be easier to rename your tables entirely to singular case. |
|
I'm going to close this -- we can always reference it later if needed! |
Requires #104 which requres #103!