-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Diesel integration #658
Merged
Merged
Diesel integration #658
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
66e9b4e
feat: Prepare new crate for diesel
Sytten 4bf8905
feat: add sqlite support for diesel integration
Sytten 099ccb3
fix: diesel sqlite change some type mapping
Sytten 2831426
fix: More sqlite fixes
Sytten 25dcc9c
feat: add mysql support for diesel integration
Sytten d2b9e97
fix: Multiple small fixes to diesel integration
Sytten dc2f395
feat: add postgres support for diesel integration
Sytten 23b5437
chore: add diesel mysql example
Sytten 65eca4d
chore: add diesel postgres example
Sytten ec18f24
fix: remove defaults for diesel integration
Sytten 363be5d
chore: add diesel sqlite example
Sytten aa94442
fix: fix diesel postgres example missing features
Sytten 453e9f1
chore: use official diesel commit
Sytten c576232
Add diesel to build
Sytten d85662c
Update Diesel version
Sytten e33e238
Fix workflow expression
Sytten 0fd3492
Fix problem with bigdecimal build
Sytten e9e47f1
Remove useless install step
Sytten f39eb45
Simplify update logic
Sytten File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[workspace] | ||
# A separate workspace | ||
|
||
[package] | ||
name = "sea-query-diesel-mysql-example" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
chrono = { version = "0.4", default-features = false, features = ["clock"] } | ||
time = { version = "0.3", features = ["parsing", "macros"] } | ||
serde_json = { version = "1" } | ||
uuid = { version = "1", features = ["serde", "v4"] } | ||
diesel = { version = "2.1.1", features = ["mysql"] } | ||
sea-query = { path = "../.." } | ||
sea-query-diesel = { path = "../../sea-query-diesel", features = [ | ||
"mysql", | ||
"with-chrono", | ||
"with-json", | ||
"with-uuid", | ||
"with-time", | ||
] } | ||
|
||
# NOTE: if you are copying this example into your own project, use the following line instead: | ||
# sea-query = { version = "0"} | ||
# sea-query-diesel = { version = "0", features = [...] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# SeaQuery Diesel MySQL example | ||
|
||
Running: | ||
|
||
```sh | ||
cargo run | ||
``` | ||
|
||
Example output: | ||
|
||
``` | ||
Create table character: Ok(()) | ||
|
||
Insert into character Ok(4) | ||
|
||
Select one from character: | ||
CharacterStructChrono { id: 4, uuid: UUID(3a23c42d-8cd9-4a0f-a8c3-0ced15d42228), name: "A", font_size: 12, meta: Object {"notes": String("some notes here")}, created: Some(2020-01-01T02:02:02) } | ||
|
||
Select one from character: | ||
CharacterStructTime { id: 4, uuid: UUID(3a23c42d-8cd9-4a0f-a8c3-0ced15d42228), name: "A", font_size: 12, meta: Object {"notes": String("some notes here")}, created: Some(2020-01-01 2:02:02.0) } | ||
|
||
|
||
Update character: Ok(1) | ||
|
||
Select one from character: | ||
CharacterStructChrono { id: 4, uuid: UUID(3a23c42d-8cd9-4a0f-a8c3-0ced15d42228), name: "A", font_size: 24, meta: Object {"notes": String("some notes here")}, created: Some(2020-01-01T02:02:02) } | ||
|
||
Select one from character: | ||
CharacterStructTime { id: 4, uuid: UUID(3a23c42d-8cd9-4a0f-a8c3-0ced15d42228), name: "A", font_size: 24, meta: Object {"notes": String("some notes here")}, created: Some(2020-01-01 2:02:02.0) } | ||
|
||
|
||
Count character: Ok(CountField { count: 4 }) | ||
|
||
Delete character: Ok(1) | ||
``` |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This shouldn't be required anymore as diesel 2.1.1 added support for bigdecimal 0.4: https://crates.io/crates/diesel/2.1.1/dependencies
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha the issue is on sea-query side, they only support 0.3 and the resolver takes 0.4 for diesel so it causes a build failure because the types are incompatible. Its a PITA that we still don't have a way to pin a sub dependency without a lockfile.