GeezerVison is showing github.com — General Refactor (#72) · zerodaycode/Canyon-SQL@71c7951
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard Collapse file Copy file name to clipboardExpand all lines: .github/workflows/code-coverage.yml -5Lines changed: 0 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 25 | 25 | run: | | 26 | 26 | rustup toolchain install nightly | 27 | 27 | rustup override set nightly | 28 | | -
| 29 | | - - name: Make the USER own the working directory. Installing `gssapi` headers | 30 | | - run: | | 31 | | - sudo chown -R $USER:$USER ${{ github.workspace }} | 32 | | - sudo apt -y install gcc libgssapi-krb5-2 libkrb5-dev libsasl2-modules-gssapi-mit | 33 | 28 | | 34 | 29 | - name: Caching cargo dependencies | 35 | 30 | id: project-cache | |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/code-quality.yml +3-18Lines changed: 3 additions & 18 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,9 +2,9 @@ name: Code quality and sanity | 2 | 2 |
| 3 | 3 | on: | 4 | 4 | push: | 5 | | - branches: '*' | | 5 | + branches: [main, dev, develop] | 6 | 6 | pull_request: | 7 | | - branches: '*' | | 7 | + branches: [main, dev, develop] | 8 | 8 |
| 9 | 9 | jobs: | 10 | 10 | clippy: | | 15 | 15 | steps: | 16 | 16 | - uses: actions/checkout@v3 | 17 | 17 |
| 18 | | - - name: Make the USER own the working directory. Installing `gssapi` headers | 19 | | - run: | | 20 | | - sudo chown -R $USER:$USER ${{ github.workspace }} | 21 | | - sudo apt -y install gcc libgssapi-krb5-2 libkrb5-dev libsasl2-modules-gssapi-mit | 22 | | -
| 23 | 18 | - name: Caching project dependencies | 24 | 19 | id: project-cache | 25 | 20 | uses: Swatinem/rust-cache@v2 | | 35 | 30 | steps: | 36 | 31 | - uses: actions/checkout@v3 | 37 | 32 |
| 38 | | - - name: Make the USER own the working directory. Installing `gssapi` headers | 39 | | - run: | | 40 | | - sudo chown -R $USER:$USER ${{ github.workspace }} | 41 | | - sudo apt -y install gcc libgssapi-krb5-2 libkrb5-dev libsasl2-modules-gssapi-mit | 42 | | -
| 43 | 33 | - name: Caching project dependencies | 44 | 34 | id: project-cache | 45 | 35 | uses: Swatinem/rust-cache@v2 | @@ -56,15 +46,10 @@ jobs: | 56 | 46 | strategy: | 57 | 47 | fail-fast: false | 58 | 48 | matrix: | 59 | | - crate: [canyon_connection, canyon_crud, canyon_macros, canyon_migrations] | | 49 | + crate: [canyon_core, canyon_crud, canyon_macros, canyon_entities, canyon_migrations] | 60 | 50 | steps: | 61 | 51 | - uses: actions/checkout@v3 | 62 | 52 |
| 63 | | - - name: Make the USER own the working directory. Installing `gssapi` headers | 64 | | - run: | | 65 | | - sudo chown -R $USER:$USER ${{ github.workspace }} | 66 | | - sudo apt -y install gcc libgssapi-krb5-2 libkrb5-dev libsasl2-modules-gssapi-mit | 67 | | -
| 68 | 53 | - name: Caching project dependencies | 69 | 54 | id: project-cache | 70 | 55 | uses: Swatinem/rust-cache@v2 | |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/continuous-integration.yml +1-7Lines changed: 1 addition & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -23,17 +23,11 @@ jobs: | 23 | 23 | - { rust: stable, os: windows-latest } | 24 | 24 |
| 25 | 25 | steps: | 26 | | - - name: Make the USER own the working directory. Installing required build dependencies | 27 | | - if: ${{ matrix.os == 'ubuntu-latest' }} | 28 | | - run: | | 29 | | - sudo chown -R $USER:$USER ${{ github.workspace }} | 30 | | - sudo apt -y install gcc libgssapi-krb5-2 libkrb5-dev libsasl2-modules-gssapi-mit docker-compose | 31 | | - | 32 | 26 | - uses: actions/checkout@v3 | 33 | 27 |
| 34 | 28 | - name: docker-compose | 35 | 29 | if: ${{ matrix.os == 'ubuntu-latest' }} | 36 | | - run: docker-compose -f ./docker/docker-compose.yml up -d | | 30 | + run: docker compose -f ./docker/docker-compose.yml up -d | 37 | 31 |
| 38 | 32 | - name: Caching cargo dependencies | 39 | 33 | id: project-cache | |
Collapse file Copy file name to clipboardExpand all lines: .github/workflows/release.yml +1-6Lines changed: 1 addition & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@ name: Generate Canyon-SQL release | 2 | 2 |
| 3 | 3 | on: | 4 | 4 | push: | 5 | | - tags: | | 5 | + tags: | 6 | 6 | - 'v[0-9]+.[0-9]+.[0-9]+' | 7 | 7 | - 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+' | 8 | 8 |
| | 14 | 14 | - name: Checkout sources | 15 | 15 | uses: actions/checkout@v3 | 16 | 16 |
| 17 | | - - name: Installing `docker-compose` | 18 | | - run: sudo apt -y install docker-compose | 19 | | - - name: Installing `gssapi` headers | 20 | | - run: sudo apt -y install gcc libgssapi-krb5-2 libkrb5-dev libsasl2-modules-gssapi-mit | 21 | | - | 22 | 17 | - name: Install stable toolchain | 23 | 18 | uses: actions-rs/toolchain@v1 | 24 | 19 | with: | |
Collapse file Copy file name to clipboardExpand all lines: .gitignore -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,6 +4,5 @@ Cargo.lock | 4 | 4 | /tester_canyon_sql/ | 5 | 5 | canyon_tester/ | 6 | 6 | macro_utils.rs | 7 | | -.vscode/ | 8 | 7 | postgres-data/ | 9 | 8 | mysql-data/ |
Collapse file Copy file name to clipboard +11Lines changed: 11 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "rust-analyzer.cargo.features": ["postgres, mssql, mysql, migrations"], | | 3 | + "rust-analyzer.check.workspace": true, | | 4 | + "rust-analyzer.cargo.buildScripts.enable": true, | | 5 | + "rust-analyzer.procMacro.enable": true, | | 6 | + "rust-analyzer.diagnostics.disabled": ["unresolved-proc-macro"], | | 7 | + "rust-analyzer.linkedProjects": [ | | 8 | + "./Cargo.toml" | | 9 | + ] | | 10 | + } | | 11 | + |
Collapse file Copy file name to clipboardExpand all lines: Cargo.toml +40-18Lines changed: 40 additions & 18 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,17 +11,17 @@ description.workspace = true | 11 | 11 |
| 12 | 12 | [workspace] | 13 | 13 | members = [ | 14 | | - "canyon_connection", | | 14 | + "canyon_core", | 15 | 15 | "canyon_crud", | 16 | 16 | "canyon_entities", | 17 | 17 | "canyon_migrations", | 18 | 18 | "canyon_macros", | 19 | | - "tests" | | 19 | + "tests", | 20 | 20 | ] | 21 | 21 |
| 22 | 22 | [dependencies] | 23 | 23 | # Project crates | 24 | | -canyon_connection = { workspace = true } | | 24 | +canyon_core = { workspace = true } | 25 | 25 | canyon_crud = { workspace = true } | 26 | 26 | canyon_entities = { workspace = true } | 27 | 27 | canyon_migrations = { workspace = true, optional = true } | @@ -35,47 +35,69 @@ mysql_common = { workspace = true, optional = true } | 35 | 35 |
| 36 | 36 |
| 37 | 37 | [workspace.dependencies] | | 38 | +canyon_core = { version = "0.5.1", path = "canyon_core" } | 38 | 39 | canyon_crud = { version = "0.5.1", path = "canyon_crud" } | 39 | | -canyon_connection = { version = "0.5.1", path = "canyon_connection" } | 40 | 40 | canyon_entities = { version = "0.5.1", path = "canyon_entities" } | 41 | 41 | canyon_migrations = { version = "0.5.1", path = "canyon_migrations"} | 42 | 42 | canyon_macros = { version = "0.5.1", path = "canyon_macros" } | 43 | 43 |
| 44 | 44 | tokio = { version = "1.27.0", features = ["full"] } | 45 | 45 | tokio-util = { version = "0.7.4", features = ["compat"] } | 46 | 46 | tokio-postgres = { version = "0.7.2", features = ["with-chrono-0_4"] } | 47 | | -tiberius = { version = "0.12.1", features = ["tds73", "chrono", "integrated-auth-gssapi"] } | 48 | | -mysql_async = { version = "0.32.2" } | 49 | | -mysql_common = { version = "0.30.6", features = [ "chrono" ]} | | 47 | +tiberius = { version = "0.12.3", features = ["tds73", "chrono"] } | | 48 | +mysql_async = { version = "0.36.1" } | | 49 | +mysql_common = { version = "0.35.4", features = [ "chrono" ]} | 50 | 50 |
| 51 | 51 | chrono = { version = "0.4", features = ["serde"] } # Just from TP better? | 52 | 52 | serde = { version = "1.0.138", features = ["derive"] } | 53 | 53 |
| 54 | 54 | futures = "0.3.25" | 55 | | -indexmap = "1.9.1" | 56 | 55 | async-std = "1.12.0" | 57 | | -lazy_static = "1.4.0" | 58 | 56 | toml = "0.7.3" | 59 | | -async-trait = "0.1.68" | 60 | 57 | walkdir = "2.3.3" | 61 | 58 | regex = "1.9.3" | 62 | 59 | partialdebug = "0.2.0" | 63 | 60 |
| 64 | | -quote = "1.0.9" | 65 | | -proc-macro2 = "1.0.27" | | 61 | +quote = "1.0.47" | | 62 | +proc-macro2 = "1.0.107" | 66 | 63 |
| 67 | 64 | [workspace.package] | 68 | 65 | version = "0.5.1" | 69 | | -edition = "2021" | 70 | | - | | 66 | +edition = "2024" | | 67 | + | 71 | 68 | documentation = "https://zerodaycode.github.io/canyon-book/" | 72 | 69 | homepage = "https://github.com/zerodaycode/Canyon-SQL" | 73 | 70 | readme = "README.md" | 74 | 71 | license = "MIT" | 75 | 72 | description = "A Rust ORM and QueryBuilder" | 76 | 73 |
| 77 | 74 | [features] | 78 | | -postgres = ["tokio-postgres", "canyon_connection/postgres", "canyon_crud/postgres", "canyon_migrations/postgres", "canyon_macros/postgres"] | 79 | | -mssql = ["tiberius", "canyon_connection/mssql", "canyon_crud/mssql", "canyon_migrations/mssql", "canyon_macros/mssql"] | 80 | | -mysql = ["mysql_async", "mysql_common", "canyon_connection/mysql", "canyon_crud/mysql", "canyon_migrations/mysql", "canyon_macros/mysql"] | 81 | | -migrations = ["canyon_migrations", "canyon_macros/migrations"] | | 75 | +postgres = [ | | 76 | + "dep:tokio-postgres", | | 77 | + "canyon_core/postgres", | | 78 | + "canyon_crud/postgres", | | 79 | + "canyon_migrations?/postgres", | | 80 | + "canyon_macros/postgres", | | 81 | +] | | 82 | + | | 83 | +mssql = [ | | 84 | + "dep:tiberius", | | 85 | + "canyon_core/mssql", | | 86 | + "canyon_crud/mssql", | | 87 | + "canyon_migrations?/mssql", | | 88 | + "canyon_macros/mssql", | | 89 | +] | | 90 | + | | 91 | +mysql = [ | | 92 | + "dep:mysql_async", | | 93 | + "dep:mysql_common", | | 94 | + "canyon_core/mysql", | | 95 | + "canyon_crud/mysql", | | 96 | + "canyon_migrations?/mysql", | | 97 | + "canyon_macros/mysql", | | 98 | +] | | 99 | + | | 100 | +migrations = [ | | 101 | + "dep:canyon_migrations", | | 102 | + "canyon_macros/migrations", | | 103 | +] |
Collapse file Copy file name to clipboardExpand all lines: README.md +3-9Lines changed: 3 additions & 9 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -84,7 +84,7 @@ assert_eq!( | 84 | 84 | ); | 85 | 85 | ``` | 86 | 86 |
| 87 | | -Note the leading reference on the `find_by_pk(...)` parameter. This associated function receives an `&dyn QueryParameter<'_>` as argument, not a value. | | 87 | +Note the leading reference on the `find_by_pk(...)` parameter. This associated function receives an `&dyn QueryParameter` as argument, not a value. | 88 | 88 |
| 89 | 89 | ### :wrench: Building more complex queries | 90 | 90 |
| @@ -96,8 +96,8 @@ let mut select_with_joins = LeagueTournament::select_query(); | 96 | 96 | select_with_joins | 97 | 97 | .inner_join("tournament", "league.id", "tournament.league_id") | 98 | 98 | .left_join("team", "tournament.id", "player.tournament_id") | 99 | | - .r#where(LeagueFieldValue::id(&7), Comp::Gt) | 100 | | - .and(LeagueFieldValue::name(&"KOREA"), Comp::Eq) | | 99 | + .r#where(LeagueFieldValue::id(&7), Operator::Gt) | | 100 | + .and(LeagueFieldValue::name(&"KOREA"), Operator::Eq) | 101 | 101 | .and_values_in(LeagueField::name, &["LCK", "STRANGER THINGS"]); | 102 | 102 | // NOTE: We don't have in the docker the generated relationships | 103 | 103 | // with the joins, so for now, we are just going to check that the | @@ -170,10 +170,4 @@ Could not find openssl via pkg-config: | 170 | 170 | `sudo apt install pkg-config` on *apt* based systems. For other systems, you must read your package manager | 171 | 171 | docs and install it. | 172 | 172 |
| 173 | | -### failed to run custom build command for `libgssapi-sys vX.X.X` | 174 | | - | 175 | | -The problem is missing a *C* header `gssapi.h`. | 176 | | - | 177 | | -- Alpine: `apk --update add krb5-pkinit krb5-dev krb5` | 178 | | -- Ubuntu: `apt-get -y install gcc libgssapi-krb5-2 libkrb5-dev libsasl2-modules-gssapi-mit` | 179 | 173 |
|
Collapse file Copy file name to clipboardExpand all lines: bash_aliases.sh +6-1Lines changed: 6 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -14,6 +14,10 @@ alias DockerDown='docker-compose -f ./docker/docker-compose.yml down' | 14 | 14 | # Cleans the generated cache folder for the postgres in the docker | 15 | 15 | alias CleanPostgres='rm -rf ./docker/postgres-data' | 16 | 16 |
| | 17 | +# Code Quality | | 18 | +alias Clippy='cargo clippy --all-targets --all-features --workspace -- -D warnings' | | 19 | +alias Fmt='cargo fmt --all -- --check' | | 20 | + | 17 | 21 | # Build the project for Windows targets | 18 | 22 | alias BuildCanyonWin='cargo build --all-features --target=x86_64-pc-windows-msvc' | 19 | 23 | alias BuildCanyonWinFull='cargo clean && cargo build --all-features --target=x86_64-pc-windows-msvc' | @@ -37,10 +41,11 @@ alias IntegrationTestsLinux='cargo test --all-features --no-fail-fast -p tests - | 37 | 41 | alias ITIncludeIgnoredLinux='cargo test --all-features --no-fail-fast -p tests --target=x86_64-unknown-linux-gnu -- --show-output --test-threads=1 --nocapture --test-threads=1 --include-ignored' | 38 | 42 | alias SqlServerInitializationLinux='cargo test initialize_sql_server_docker_instance -p tests --all-features --no-fail-fast --target=x86_64-unknown-linux-gnu -- --show-output --test-threads=1 --nocapture --include-ignored' | 39 | 43 |
| 40 | | - | | 44 | +# ----- | 41 | 45 | # Publish Canyon-SQL to the registry with its dependencies | 42 | 46 | alias PublishCanyon='cargo publish -p canyon_connection && cargo publish -p canyon_crud && cargo publish -p canyon_migrations && cargo publish -p canyon_macros && cargo publish -p canyon_sql_root' | 43 | 47 |
| | 48 | +# ----- | 44 | 49 | # Collects the code coverage for the project (tests must run before this) | 45 | 50 | alias CcEnvVars='export CARGO_INCREMENTAL=0 | 46 | 51 | export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" | |
|