From 26bcac6513ad268347a408d3915a499fd298f45a Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Tue, 4 Jul 2023 19:13:57 +0200 Subject: [PATCH] sqlx: 0.6 -> 0.7 Signed-off-by: Igor Pashev --- ...bcfe5f968b31500e8c8cf97fe16814bc04164.json | 20 ++ ...766573c91b2775a086c65bc9a5fdc91300bb0.json | 17 ++ ...36247a328db780a48da47c9402e1d3ebd80c9.json | 12 + ...44610fb79a1b9330730c65953f0c1b88c2a53.json | 20 ++ ...b209a7e1f0974242ecd0f55e5b0098152bad5.json | 62 ++++ ...806b4c78b7aa2a9609c4eccb941c7dff7b107.json | 12 + ...7cb75a999041a3eb6a8f8177bebfa3c30d56f.json | 16 + ...b89853785c32a5f83cb0b25609329c760428a.json | 19 ++ ...226ba97993ede9988a4c57d58bd066500a119.json | 20 ++ ...21e00c42a3fad8082cf15c2af88cd8388f41b.json | 18 ++ ...b37d46c5a2f4202e1b8dce1f66a65069beb0b.json | 15 + ...c1b90b67b053add3d4cffb8d579bfc8f08345.json | 75 +++++ Cargo.toml | 12 +- sqlx-data.json | 285 ------------------ src/actions.rs | 30 +- src/adapter.rs | 12 - 16 files changed, 323 insertions(+), 322 deletions(-) create mode 100644 .sqlx/query-1cabd2f674da323da9e0da724d3bcfe5f968b31500e8c8cf97fe16814bc04164.json create mode 100644 .sqlx/query-1f299262f01a2c9d2ee94079a12766573c91b2775a086c65bc9a5fdc91300bb0.json create mode 100644 .sqlx/query-24876462291b90324dfe3682e9f36247a328db780a48da47c9402e1d3ebd80c9.json create mode 100644 .sqlx/query-2872b56bbc5bed96b1a303bf9cf44610fb79a1b9330730c65953f0c1b88c2a53.json create mode 100644 .sqlx/query-3022cb733970ae5836ab3891367b209a7e1f0974242ecd0f55e5b0098152bad5.json create mode 100644 .sqlx/query-438ee38e669be96e562d09d3bc5806b4c78b7aa2a9609c4eccb941c7dff7b107.json create mode 100644 .sqlx/query-4acfe0086a593b08177791bb3b47cb75a999041a3eb6a8f8177bebfa3c30d56f.json create mode 100644 .sqlx/query-4e7b82d256f7298564f46af6a45b89853785c32a5f83cb0b25609329c760428a.json create mode 100644 .sqlx/query-f130c22d14ee2a99b9220ac1a45226ba97993ede9988a4c57d58bd066500a119.json create mode 100644 .sqlx/query-f8611a862ed1d3b982e8aa5ccab21e00c42a3fad8082cf15c2af88cd8388f41b.json create mode 100644 .sqlx/query-fa51ae7af271fc17c848694fbf1b37d46c5a2f4202e1b8dce1f66a65069beb0b.json create mode 100644 .sqlx/query-fb7ce69e70b345d2cf0ca017523c1b90b67b053add3d4cffb8d579bfc8f08345.json delete mode 100644 sqlx-data.json diff --git a/.sqlx/query-1cabd2f674da323da9e0da724d3bcfe5f968b31500e8c8cf97fe16814bc04164.json b/.sqlx/query-1cabd2f674da323da9e0da724d3bcfe5f968b31500e8c8cf97fe16814bc04164.json new file mode 100644 index 0000000..eb3a84f --- /dev/null +++ b/.sqlx/query-1cabd2f674da323da9e0da724d3bcfe5f968b31500e8c8cf97fe16814bc04164.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO casbin_rule ( ptype, v0, v1, v2, v3, v4, v5 )\n VALUES ( $1, $2, $3, $4, $5, $6, $7 )", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Varchar", + "Varchar", + "Varchar", + "Varchar", + "Varchar", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "1cabd2f674da323da9e0da724d3bcfe5f968b31500e8c8cf97fe16814bc04164" +} diff --git a/.sqlx/query-1f299262f01a2c9d2ee94079a12766573c91b2775a086c65bc9a5fdc91300bb0.json b/.sqlx/query-1f299262f01a2c9d2ee94079a12766573c91b2775a086c65bc9a5fdc91300bb0.json new file mode 100644 index 0000000..1ea12e3 --- /dev/null +++ b/.sqlx/query-1f299262f01a2c9d2ee94079a12766573c91b2775a086c65bc9a5fdc91300bb0.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v3 is NULL OR v3 = COALESCE($2,v3)) AND\n (v4 is NULL OR v4 = COALESCE($3,v4)) AND\n (v5 is NULL OR v5 = COALESCE($4,v5))", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Varchar", + "Varchar", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "1f299262f01a2c9d2ee94079a12766573c91b2775a086c65bc9a5fdc91300bb0" +} diff --git a/.sqlx/query-24876462291b90324dfe3682e9f36247a328db780a48da47c9402e1d3ebd80c9.json b/.sqlx/query-24876462291b90324dfe3682e9f36247a328db780a48da47c9402e1d3ebd80c9.json new file mode 100644 index 0000000..8046c5d --- /dev/null +++ b/.sqlx/query-24876462291b90324dfe3682e9f36247a328db780a48da47c9402e1d3ebd80c9.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM casbin_rule", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "24876462291b90324dfe3682e9f36247a328db780a48da47c9402e1d3ebd80c9" +} diff --git a/.sqlx/query-2872b56bbc5bed96b1a303bf9cf44610fb79a1b9330730c65953f0c1b88c2a53.json b/.sqlx/query-2872b56bbc5bed96b1a303bf9cf44610fb79a1b9330730c65953f0c1b88c2a53.json new file mode 100644 index 0000000..e246e53 --- /dev/null +++ b/.sqlx/query-2872b56bbc5bed96b1a303bf9cf44610fb79a1b9330730c65953f0c1b88c2a53.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n v0 = $2 AND\n v1 = $3 AND\n v2 = $4 AND\n v3 = $5 AND\n v4 = $6 AND\n v5 = $7", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "2872b56bbc5bed96b1a303bf9cf44610fb79a1b9330730c65953f0c1b88c2a53" +} diff --git a/.sqlx/query-3022cb733970ae5836ab3891367b209a7e1f0974242ecd0f55e5b0098152bad5.json b/.sqlx/query-3022cb733970ae5836ab3891367b209a7e1f0974242ecd0f55e5b0098152bad5.json new file mode 100644 index 0000000..4d06843 --- /dev/null +++ b/.sqlx/query-3022cb733970ae5836ab3891367b209a7e1f0974242ecd0f55e5b0098152bad5.json @@ -0,0 +1,62 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * FROM casbin_rule", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "ptype", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "v0", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "v1", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "v2", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "v3", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "v4", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "v5", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "3022cb733970ae5836ab3891367b209a7e1f0974242ecd0f55e5b0098152bad5" +} diff --git a/.sqlx/query-438ee38e669be96e562d09d3bc5806b4c78b7aa2a9609c4eccb941c7dff7b107.json b/.sqlx/query-438ee38e669be96e562d09d3bc5806b4c78b7aa2a9609c4eccb941c7dff7b107.json new file mode 100644 index 0000000..75c6da3 --- /dev/null +++ b/.sqlx/query-438ee38e669be96e562d09d3bc5806b4c78b7aa2a9609c4eccb941c7dff7b107.json @@ -0,0 +1,12 @@ +{ + "db_name": "PostgreSQL", + "query": "CREATE TABLE IF NOT EXISTS casbin_rule (\n id SERIAL PRIMARY KEY,\n ptype VARCHAR NOT NULL,\n v0 VARCHAR NOT NULL,\n v1 VARCHAR NOT NULL,\n v2 VARCHAR NOT NULL,\n v3 VARCHAR NOT NULL,\n v4 VARCHAR NOT NULL,\n v5 VARCHAR NOT NULL,\n CONSTRAINT unique_key_sqlx_adapter UNIQUE(ptype, v0, v1, v2, v3, v4, v5)\n );\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [] + }, + "nullable": [] + }, + "hash": "438ee38e669be96e562d09d3bc5806b4c78b7aa2a9609c4eccb941c7dff7b107" +} diff --git a/.sqlx/query-4acfe0086a593b08177791bb3b47cb75a999041a3eb6a8f8177bebfa3c30d56f.json b/.sqlx/query-4acfe0086a593b08177791bb3b47cb75a999041a3eb6a8f8177bebfa3c30d56f.json new file mode 100644 index 0000000..ce229dc --- /dev/null +++ b/.sqlx/query-4acfe0086a593b08177791bb3b47cb75a999041a3eb6a8f8177bebfa3c30d56f.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v4 is NULL OR v4 = COALESCE($2,v4)) AND\n (v5 is NULL OR v5 = COALESCE($3,v5))", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Varchar", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "4acfe0086a593b08177791bb3b47cb75a999041a3eb6a8f8177bebfa3c30d56f" +} diff --git a/.sqlx/query-4e7b82d256f7298564f46af6a45b89853785c32a5f83cb0b25609329c760428a.json b/.sqlx/query-4e7b82d256f7298564f46af6a45b89853785c32a5f83cb0b25609329c760428a.json new file mode 100644 index 0000000..4c4c1df --- /dev/null +++ b/.sqlx/query-4e7b82d256f7298564f46af6a45b89853785c32a5f83cb0b25609329c760428a.json @@ -0,0 +1,19 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v1 is NULL OR v1 = COALESCE($2,v1)) AND\n (v2 is NULL OR v2 = COALESCE($3,v2)) AND\n (v3 is NULL OR v3 = COALESCE($4,v3)) AND\n (v4 is NULL OR v4 = COALESCE($5,v4)) AND\n (v5 is NULL OR v5 = COALESCE($6,v5))", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Varchar", + "Varchar", + "Varchar", + "Varchar", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "4e7b82d256f7298564f46af6a45b89853785c32a5f83cb0b25609329c760428a" +} diff --git a/.sqlx/query-f130c22d14ee2a99b9220ac1a45226ba97993ede9988a4c57d58bd066500a119.json b/.sqlx/query-f130c22d14ee2a99b9220ac1a45226ba97993ede9988a4c57d58bd066500a119.json new file mode 100644 index 0000000..ef54cdb --- /dev/null +++ b/.sqlx/query-f130c22d14ee2a99b9220ac1a45226ba97993ede9988a4c57d58bd066500a119.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v0 is NULL OR v0 = COALESCE($2,v0)) AND\n (v1 is NULL OR v1 = COALESCE($3,v1)) AND\n (v2 is NULL OR v2 = COALESCE($4,v2)) AND\n (v3 is NULL OR v3 = COALESCE($5,v3)) AND\n (v4 is NULL OR v4 = COALESCE($6,v4)) AND\n (v5 is NULL OR v5 = COALESCE($7,v5))", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Varchar", + "Varchar", + "Varchar", + "Varchar", + "Varchar", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "f130c22d14ee2a99b9220ac1a45226ba97993ede9988a4c57d58bd066500a119" +} diff --git a/.sqlx/query-f8611a862ed1d3b982e8aa5ccab21e00c42a3fad8082cf15c2af88cd8388f41b.json b/.sqlx/query-f8611a862ed1d3b982e8aa5ccab21e00c42a3fad8082cf15c2af88cd8388f41b.json new file mode 100644 index 0000000..0daaa8a --- /dev/null +++ b/.sqlx/query-f8611a862ed1d3b982e8aa5ccab21e00c42a3fad8082cf15c2af88cd8388f41b.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v2 is NULL OR v2 = COALESCE($2,v2)) AND\n (v3 is NULL OR v3 = COALESCE($3,v3)) AND\n (v4 is NULL OR v4 = COALESCE($4,v4)) AND\n (v5 is NULL OR v5 = COALESCE($5,v5))", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Varchar", + "Varchar", + "Varchar", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "f8611a862ed1d3b982e8aa5ccab21e00c42a3fad8082cf15c2af88cd8388f41b" +} diff --git a/.sqlx/query-fa51ae7af271fc17c848694fbf1b37d46c5a2f4202e1b8dce1f66a65069beb0b.json b/.sqlx/query-fa51ae7af271fc17c848694fbf1b37d46c5a2f4202e1b8dce1f66a65069beb0b.json new file mode 100644 index 0000000..4a5f7e8 --- /dev/null +++ b/.sqlx/query-fa51ae7af271fc17c848694fbf1b37d46c5a2f4202e1b8dce1f66a65069beb0b.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v5 is NULL OR v5 = COALESCE($2,v5))", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "fa51ae7af271fc17c848694fbf1b37d46c5a2f4202e1b8dce1f66a65069beb0b" +} diff --git a/.sqlx/query-fb7ce69e70b345d2cf0ca017523c1b90b67b053add3d4cffb8d579bfc8f08345.json b/.sqlx/query-fb7ce69e70b345d2cf0ca017523c1b90b67b053add3d4cffb8d579bfc8f08345.json new file mode 100644 index 0000000..897ae52 --- /dev/null +++ b/.sqlx/query-fb7ce69e70b345d2cf0ca017523c1b90b67b053add3d4cffb8d579bfc8f08345.json @@ -0,0 +1,75 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT * from casbin_rule WHERE (\n ptype LIKE 'g%' AND v0 LIKE $1 AND v1 LIKE $2 AND v2 LIKE $3 AND v3 LIKE $4 AND v4 LIKE $5 AND v5 LIKE $6 )\n OR (\n ptype LIKE 'p%' AND v0 LIKE $7 AND v1 LIKE $8 AND v2 LIKE $9 AND v3 LIKE $10 AND v4 LIKE $11 AND v5 LIKE $12 );\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Int4" + }, + { + "ordinal": 1, + "name": "ptype", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "v0", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "v1", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "v2", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "v3", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "v4", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "v5", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [ + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "fb7ce69e70b345d2cf0ca017523c1b90b67b053add3d4cffb8d579bfc8f08345" +} diff --git a/Cargo.toml b/Cargo.toml index 9680a23..e8c4a2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,15 +10,14 @@ readme= "README.md" [dependencies] casbin = { version = "2.0.8", default-features = false } -sqlx = { version = "0.6", default-features = false, features = [ "macros" ] } +sqlx = { version = "0.7", default-features = false, features = [ "macros" ] } async-trait = "0.1.51" dotenv = { version = "0.15.0", default-features = false } tokio = { version = "1.10.0", default-features = false, optional = true } async-std = { version = "1.9.0", default-features = false, optional = true } -actix-rt = { version = "2.2.0", default-features = false, optional = true } [features] -default = ["postgres", "runtime-tokio-native-tls", "offline"] +default = ["postgres", "runtime-tokio-native-tls"] #databases postgres = ["sqlx/postgres"] @@ -32,17 +31,10 @@ runtime-async-std-rustls = ["casbin/runtime-async-std", "sqlx/runtime-async-std- # tokio runtime-tokio-native-tls = ["casbin/runtime-tokio", "sqlx/runtime-tokio-native-tls"] runtime-tokio-rustls = ["casbin/runtime-tokio", "sqlx/runtime-tokio-rustls"] -# actix (actually based on tokio) -runtime-actix-native-tls = ["casbin/runtime-tokio", "sqlx/runtime-actix-native-tls"] -runtime-actix-rustls = ["casbin/runtime-tokio", "sqlx/runtime-actix-rustls"] - -#offline mode for sqlx -offline = ["sqlx/offline"] [dev-dependencies] async-std = { version = "1.9.0", features = [ "attributes" ] } tokio = { version = "1.10.0", features = [ "full" ] } -actix-rt = { version = "2.2.0" } [profile.release] codegen-units = 1 diff --git a/sqlx-data.json b/sqlx-data.json deleted file mode 100644 index 4952883..0000000 --- a/sqlx-data.json +++ /dev/null @@ -1,285 +0,0 @@ -{ - "db": "PostgreSQL", - "1cabd2f674da323da9e0da724d3bcfe5f968b31500e8c8cf97fe16814bc04164": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar" - ] - } - }, - "query": "INSERT INTO casbin_rule ( ptype, v0, v1, v2, v3, v4, v5 )\n VALUES ( $1, $2, $3, $4, $5, $6, $7 )" - }, - "1f299262f01a2c9d2ee94079a12766573c91b2775a086c65bc9a5fdc91300bb0": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Varchar", - "Varchar", - "Varchar" - ] - } - }, - "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v3 is NULL OR v3 = COALESCE($2,v3)) AND\n (v4 is NULL OR v4 = COALESCE($3,v4)) AND\n (v5 is NULL OR v5 = COALESCE($4,v5))" - }, - "24876462291b90324dfe3682e9f36247a328db780a48da47c9402e1d3ebd80c9": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [] - } - }, - "query": "DELETE FROM casbin_rule" - }, - "2872b56bbc5bed96b1a303bf9cf44610fb79a1b9330730c65953f0c1b88c2a53": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text" - ] - } - }, - "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n v0 = $2 AND\n v1 = $3 AND\n v2 = $4 AND\n v3 = $5 AND\n v4 = $6 AND\n v5 = $7" - }, - "3022cb733970ae5836ab3891367b209a7e1f0974242ecd0f55e5b0098152bad5": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "ptype", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "v0", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "v1", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "v2", - "ordinal": 4, - "type_info": "Varchar" - }, - { - "name": "v3", - "ordinal": 5, - "type_info": "Varchar" - }, - { - "name": "v4", - "ordinal": 6, - "type_info": "Varchar" - }, - { - "name": "v5", - "ordinal": 7, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [] - } - }, - "query": "SELECT * FROM casbin_rule" - }, - "438ee38e669be96e562d09d3bc5806b4c78b7aa2a9609c4eccb941c7dff7b107": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [] - } - }, - "query": "CREATE TABLE IF NOT EXISTS casbin_rule (\n id SERIAL PRIMARY KEY,\n ptype VARCHAR NOT NULL,\n v0 VARCHAR NOT NULL,\n v1 VARCHAR NOT NULL,\n v2 VARCHAR NOT NULL,\n v3 VARCHAR NOT NULL,\n v4 VARCHAR NOT NULL,\n v5 VARCHAR NOT NULL,\n CONSTRAINT unique_key_sqlx_adapter UNIQUE(ptype, v0, v1, v2, v3, v4, v5)\n );\n " - }, - "4acfe0086a593b08177791bb3b47cb75a999041a3eb6a8f8177bebfa3c30d56f": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Varchar", - "Varchar" - ] - } - }, - "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v4 is NULL OR v4 = COALESCE($2,v4)) AND\n (v5 is NULL OR v5 = COALESCE($3,v5))" - }, - "4e7b82d256f7298564f46af6a45b89853785c32a5f83cb0b25609329c760428a": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar" - ] - } - }, - "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v1 is NULL OR v1 = COALESCE($2,v1)) AND\n (v2 is NULL OR v2 = COALESCE($3,v2)) AND\n (v3 is NULL OR v3 = COALESCE($4,v3)) AND\n (v4 is NULL OR v4 = COALESCE($5,v4)) AND\n (v5 is NULL OR v5 = COALESCE($6,v5))" - }, - "f130c22d14ee2a99b9220ac1a45226ba97993ede9988a4c57d58bd066500a119": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar", - "Varchar" - ] - } - }, - "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v0 is NULL OR v0 = COALESCE($2,v0)) AND\n (v1 is NULL OR v1 = COALESCE($3,v1)) AND\n (v2 is NULL OR v2 = COALESCE($4,v2)) AND\n (v3 is NULL OR v3 = COALESCE($5,v3)) AND\n (v4 is NULL OR v4 = COALESCE($6,v4)) AND\n (v5 is NULL OR v5 = COALESCE($7,v5))" - }, - "f8611a862ed1d3b982e8aa5ccab21e00c42a3fad8082cf15c2af88cd8388f41b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Varchar", - "Varchar", - "Varchar", - "Varchar" - ] - } - }, - "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v2 is NULL OR v2 = COALESCE($2,v2)) AND\n (v3 is NULL OR v3 = COALESCE($3,v3)) AND\n (v4 is NULL OR v4 = COALESCE($4,v4)) AND\n (v5 is NULL OR v5 = COALESCE($5,v5))" - }, - "fa51ae7af271fc17c848694fbf1b37d46c5a2f4202e1b8dce1f66a65069beb0b": { - "describe": { - "columns": [], - "nullable": [], - "parameters": { - "Left": [ - "Text", - "Varchar" - ] - } - }, - "query": "DELETE FROM casbin_rule WHERE\n ptype = $1 AND\n (v5 is NULL OR v5 = COALESCE($2,v5))" - }, - "fb7ce69e70b345d2cf0ca017523c1b90b67b053add3d4cffb8d579bfc8f08345": { - "describe": { - "columns": [ - { - "name": "id", - "ordinal": 0, - "type_info": "Int4" - }, - { - "name": "ptype", - "ordinal": 1, - "type_info": "Varchar" - }, - { - "name": "v0", - "ordinal": 2, - "type_info": "Varchar" - }, - { - "name": "v1", - "ordinal": 3, - "type_info": "Varchar" - }, - { - "name": "v2", - "ordinal": 4, - "type_info": "Varchar" - }, - { - "name": "v3", - "ordinal": 5, - "type_info": "Varchar" - }, - { - "name": "v4", - "ordinal": 6, - "type_info": "Varchar" - }, - { - "name": "v5", - "ordinal": 7, - "type_info": "Varchar" - } - ], - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false - ], - "parameters": { - "Left": [ - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text", - "Text" - ] - } - }, - "query": "SELECT * from casbin_rule WHERE (\n ptype LIKE 'g%' AND v0 LIKE $1 AND v1 LIKE $2 AND v2 LIKE $3 AND v3 LIKE $4 AND v4 LIKE $5 AND v5 LIKE $6 )\n OR (\n ptype LIKE 'p%' AND v0 LIKE $7 AND v1 LIKE $8 AND v2 LIKE $9 AND v3 LIKE $10 AND v4 LIKE $11 AND v5 LIKE $12 );\n " - } -} \ No newline at end of file diff --git a/src/actions.rs b/src/actions.rs index b8c5319..3bfb8c6 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -194,7 +194,7 @@ pub async fn remove_policies( rule[4], rule[5] ) - .execute(&mut transaction) + .execute(&mut *transaction) .await .and_then(|n| { if PgQueryResult::rows_affected(&n) == 1 { @@ -241,7 +241,7 @@ pub async fn remove_policies( rule[4], rule[5] ) - .execute(&mut transaction) + .execute(&mut *transaction) .await .and_then(|n| { if SqliteQueryResult::rows_affected(&n) == 1 { @@ -288,7 +288,7 @@ pub async fn remove_policies( rule[4], rule[5] ) - .execute(&mut transaction) + .execute(&mut *transaction) .await .and_then(|n| { if MySqlQueryResult::rows_affected(&n) == 1 { @@ -717,7 +717,7 @@ pub(crate) async fn save_policy( .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; sqlx::query!("DELETE FROM casbin_rule") - .execute(&mut transaction) + .execute(&mut *transaction) .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; for rule in rules { @@ -732,7 +732,7 @@ pub(crate) async fn save_policy( rule.v4, rule.v5 ) - .execute(&mut transaction) + .execute(&mut *transaction) .await .and_then(|n| { if PgQueryResult::rows_affected(&n) == 1 { @@ -760,7 +760,7 @@ pub(crate) async fn save_policy( .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; sqlx::query!("DELETE FROM casbin_rule") - .execute(&mut transaction) + .execute(&mut *transaction) .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; for rule in rules { @@ -775,7 +775,7 @@ pub(crate) async fn save_policy( rule.v4, rule.v5 ) - .execute(&mut transaction) + .execute(&mut *transaction) .await .and_then(|n| { if SqliteQueryResult::rows_affected(&n) == 1 { @@ -803,7 +803,7 @@ pub(crate) async fn save_policy<'a>( .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; sqlx::query!("DELETE FROM casbin_rule") - .execute(&mut transaction) + .execute(&mut *transaction) .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; for rule in rules { @@ -818,7 +818,7 @@ pub(crate) async fn save_policy<'a>( rule.v4, rule.v5 ) - .execute(&mut transaction) + .execute(&mut *transaction) .await .and_then(|n| { if MySqlQueryResult::rows_affected(&n) == 1 { @@ -920,7 +920,7 @@ pub(crate) async fn add_policies( rule.v4, rule.v5 ) - .execute(&mut transaction) + .execute(&mut *transaction) .await .and_then(|n| { if PgQueryResult::rows_affected(&n) == 1 { @@ -959,7 +959,7 @@ pub(crate) async fn add_policies( rule.v4, rule.v5 ) - .execute(&mut transaction) + .execute(&mut *transaction) .await .and_then(|n| { if SqliteQueryResult::rows_affected(&n) == 1 { @@ -998,7 +998,7 @@ pub(crate) async fn add_policies( rule.v4, rule.v5 ) - .execute(&mut transaction) + .execute(&mut *transaction) .await .and_then(|n| { if MySqlQueryResult::rows_affected(&n) == 1 { @@ -1023,7 +1023,7 @@ pub(crate) async fn clear_policy(conn: &ConnectionPool) -> Result<()> { .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; sqlx::query!("DELETE FROM casbin_rule") - .execute(&mut transaction) + .execute(&mut *transaction) .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; transaction @@ -1040,7 +1040,7 @@ pub(crate) async fn clear_policy(conn: &ConnectionPool) -> Result<()> { .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; sqlx::query!("DELETE FROM casbin_rule") - .execute(&mut transaction) + .execute(&mut *transaction) .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; transaction @@ -1057,7 +1057,7 @@ pub(crate) async fn clear_policy(conn: &ConnectionPool) -> Result<()> { .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; sqlx::query!("DELETE FROM casbin_rule") - .execute(&mut transaction) + .execute(&mut *transaction) .await .map_err(|err| CasbinError::from(AdapterError(Box::new(Error::SqlxError(err)))))?; transaction diff --git a/src/adapter.rs b/src/adapter.rs index d8ead51..840882b 100644 --- a/src/adapter.rs +++ b/src/adapter.rs @@ -286,10 +286,6 @@ mod tests { any(feature = "runtime-tokio-native-tls", feature = "runtime-tokio-rustls"), tokio::test(flavor = "multi_thread") )] - #[cfg_attr( - any(feature = "runtime-actix-native-tls", feature = "runtime-actix-rustls"), - actix_rt::test - )] async fn test_create() { use casbin::prelude::*; @@ -332,10 +328,6 @@ mod tests { any(feature = "runtime-tokio-native-tls", feature = "runtime-tokio-rustls"), tokio::test(flavor = "multi_thread") )] - #[cfg_attr( - any(feature = "runtime-actix-native-tls", feature = "runtime-actix-rustls"), - actix_rt::test - )] async fn test_create_with_pool() { use casbin::prelude::*; @@ -387,10 +379,6 @@ mod tests { any(feature = "runtime-tokio-native-tls", feature = "runtime-tokio-rustls"), tokio::test(flavor = "multi_thread") )] - #[cfg_attr( - any(feature = "runtime-actix-native-tls", feature = "runtime-actix-rustls"), - actix_rt::test - )] async fn test_adapter() { use casbin::prelude::*;