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

Add simple example of library usage and consuming generated output #111

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Wulf
Copy link
Owner

@Wulf Wulf commented Nov 2, 2023

Adds a simple example that we use as a compilation test.

We'll need to expand this going forward to ensure robustness

Note: This will fail until #104 is merged in as that fixes a few compilation issues with once_common_* flags

@Wulf Wulf requested a review from hasezoey November 2, 2023 01:01
use models::todo::Todo;

fn main() {
println!("Hello, world!");
Copy link
Owner Author

Choose a reason for hiding this comment

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

In the future, we'll want to add actual DB calls using the generate code and either use an in-memory sqlite db or spin up a postgres container to make sure those calls are working

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
println!("Hello, world!");
// This file (should) demonstrate the usage of the generated dsync output
println!("Hello, world!");
// TODO: This file in the example still needs to be expanded on

add a note so we dont forget the purpose

@Wulf Wulf mentioned this pull request Nov 2, 2023
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.

i dont really see why it would require #104, would #112 suffice?

examples/Cargo.toml Show resolved Hide resolved
examples/todo/Cargo.toml Show resolved Hide resolved
examples/todo/Cargo.toml Show resolved Hide resolved
examples/todo/Cargo.toml Show resolved Hide resolved
examples/todo/src/dsync.rs Outdated Show resolved Hide resolved
@hasezoey hasezoey changed the title Add simple compilation test Add simple example of library usage and consuming generated output Nov 6, 2023
@hasezoey
Copy link
Collaborator

hasezoey commented Nov 6, 2023

i change the title of this PR to better reflect what this PR is doing

@hasezoey hasezoey mentioned this pull request Nov 19, 2023
@Wulf Wulf requested a review from hasezoey January 2, 2024 01:49
@Wulf
Copy link
Owner Author

Wulf commented Jan 2, 2024

@hasezoey please give this another look when you have the time. It's been a long time since we visited this, so feel free to suggest another approach entirely.

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.

Looks mostly good to me now, some small Cargo.toml suggestions and adding some notes.

@@ -0,0 +1,2 @@
[workspace]
members = ["todo"]
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
members = ["todo"]
members = ["todo"]
resolver = "2"

remove the cargo warning:

warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions

use models::todo::Todo;

fn main() {
println!("Hello, world!");
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
println!("Hello, world!");
// This file (should) demonstrate the usage of the generated dsync output
println!("Hello, world!");
// TODO: This file in the example still needs to be expanded on

add a note so we dont forget the purpose

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.

2 participants