Created
March 27, 2023 21:20
-
-
Save matthiasdebernardini/c6a9b92cf764f5b996f3df4bd54b894f to your computer and use it in GitHub Desktop.
Revisions
-
matthiasdebernardini created this gist
Mar 27, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ [package] name = "testing_compiler_error" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] sqlx = { version = "0.6", features = [ "runtime-tokio-native-tls" , "postgres" ] } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,138 @@ { "nodes": { "devenv": { "locked": { "dir": "src/modules", "lastModified": 1679514134, "narHash": "sha256-x6wKyiOuJJW2phDbCpmSYjRlCe4Yva4r2nkqc7aNFsI=", "owner": "cachix", "repo": "devenv", "rev": "a02418232d775e99ca349e1c8f71400aa1dd903c", "type": "github" }, "original": { "dir": "src/modules", "owner": "cachix", "repo": "devenv", "type": "github" } }, "flake-compat": { "flake": false, "locked": { "lastModified": 1673956053, "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", "owner": "edolstra", "repo": "flake-compat", "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", "type": "github" }, "original": { "owner": "edolstra", "repo": "flake-compat", "type": "github" } }, "flake-utils": { "locked": { "lastModified": 1667395993, "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", "owner": "numtide", "repo": "flake-utils", "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", "type": "github" }, "original": { "owner": "numtide", "repo": "flake-utils", "type": "github" } }, "gitignore": { "inputs": { "nixpkgs": [ "pre-commit-hooks", "nixpkgs" ] }, "locked": { "lastModified": 1660459072, "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", "owner": "hercules-ci", "repo": "gitignore.nix", "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", "type": "github" }, "original": { "owner": "hercules-ci", "repo": "gitignore.nix", "type": "github" } }, "nixpkgs": { "locked": { "lastModified": 1679553901, "narHash": "sha256-OhmJc18XNIj0wVC4ZoPnCVoY3SGfcPxaeKJOz1WHo5M=", "owner": "NixOS", "repo": "nixpkgs", "rev": "09ad6a72359f6aff0f96ce8e4d1ec2d1271ad15d", "type": "github" }, "original": { "owner": "NixOS", "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } }, "nixpkgs-stable": { "locked": { "lastModified": 1678872516, "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", "owner": "NixOS", "repo": "nixpkgs", "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", "type": "github" }, "original": { "owner": "NixOS", "ref": "nixos-22.11", "repo": "nixpkgs", "type": "github" } }, "pre-commit-hooks": { "inputs": { "flake-compat": "flake-compat", "flake-utils": "flake-utils", "gitignore": "gitignore", "nixpkgs": [ "nixpkgs" ], "nixpkgs-stable": "nixpkgs-stable" }, "locked": { "lastModified": 1678976941, "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", "type": "github" }, "original": { "owner": "cachix", "repo": "pre-commit-hooks.nix", "type": "github" } }, "root": { "inputs": { "devenv": "devenv", "nixpkgs": "nixpkgs", "pre-commit-hooks": "pre-commit-hooks" } } }, "root": "root", "version": 7 } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ { pkgs, ... }: { # https://devenv.sh/basics/ env.GREET = "devenv"; env.DATABASE_URL="postgres://postgres:password@localhost/test"; # https://devenv.sh/packages/ packages = [ pkgs.helix pkgs.git pkgs.jq pkgs.httpie pkgs.yarn pkgs.curl pkgs.fzf pkgs.just pkgs.openssl ]; # https://devenv.sh/scripts/ scripts.hello.exec = "echo hello from $GREET"; scripts.axum_test_runner.exec = "RUST_LOG=info cargo run"; enterShell = '' cargo --version npm --version http --version yarn --version curl --version git --version jq --version ''; # https://devenv.sh/languages/ languages.nix.enable = true; languages.python.enable = true; languages.rust.enable = true; languages.typescript.enable = true; languages.javascript.enable = true; # https://devenv.sh/pre-commit-hooks/ # pre-commit.hooks.shellcheck.enable = true; # https://devenv.sh/processes/ # processes.ping.exec = "ping example.com"; # See full reference at https://devenv.sh/reference/options/ } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ inputs: nixpkgs: url: github:NixOS/nixpkgs/nixpkgs-unstable This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ use sqlx::postgres::PgPoolOptions; // use sqlx::mysql::MySqlPoolOptions; // etc. #[async_std::main] // or #[tokio::main] // or #[actix_web::main] async fn main() -> Result<(), sqlx::Error> { // Create a connection pool // for MySQL, use MySqlPoolOptions::new() // for SQLite, use SqlitePoolOptions::new() // etc. let pool = PgPoolOptions::new() .max_connections(5) .connect("postgres://postgres:password@localhost/test") .await?; // Make a simple query to return the given parameter (use a question mark `?` instead of `$1` for MySQL) let row: (i64,) = sqlx::query_as("SELECT $1") .bind(150_i64) .fetch_one(&pool) .await?; assert_eq!(row.0, 150); Ok(()) } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ { devShells.default = pkgs.mkShell { buildInputs = with pkgs; [ cargo python ]; }; }