Skip to content

Conversation

@Wulf
Copy link
Owner

@Wulf Wulf commented Oct 28, 2023

Requires #104 which requres #103!

Copy link
Collaborator

@hasezoey hasezoey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- 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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)?;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this PR requires #103, then shouldnt this take one more parameter?

/*
CRUD examples
*/
let created_todo = todos::create(&mut db, todos::CreateTodo {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what support is missing?

Comment on lines +184 to +185
## 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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## 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.

@hasezoey hasezoey marked this pull request as draft October 29, 2023 15:12
@Wulf
Copy link
Owner Author

Wulf commented Jan 2, 2024

I'm going to close this -- we can always reference it later if needed!

@Wulf Wulf closed this Jan 2, 2024
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