Update sqlx to 0.7

This commit is contained in:
Natsu Kagami 2024-02-04 23:08:53 +01:00
parent a64b9e1157
commit 85954639d7
Signed by: nki
GPG key ID: 55A032EB38B49ADB
24 changed files with 1058 additions and 619 deletions

626
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,7 @@
[workspace]
resolver = "2"
members = [
"youmubot-prelude",
"youmubot-db",

View file

@ -34,7 +34,7 @@
{
inputsFrom = [ packages.youmubot ];
buildInputs = with pkgs; [ rustc rustfmt clippy ];
buildInputs = with pkgs; [ rustc rustfmt clippy sqlx-cli ];
nativeBuildInputs = nixpkgs.lib.optionals pkgs.stdenv.isLinux (with pkgs; [
pkg-config

View file

@ -0,0 +1,68 @@
{
"db_name": "SQLite",
"query": "SELECT\n user_id as \"user_id: i64\",\n username,\n id as \"id: i64\",\n last_update as \"last_update: DateTime\",\n pp_std, pp_taiko, pp_mania, pp_catch,\n failures as \"failures: u8\"\n FROM osu_users WHERE id = ?",
"describe": {
"columns": [
{
"name": "user_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "username",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "id: i64",
"ordinal": 2,
"type_info": "Int64"
},
{
"name": "last_update: DateTime",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "pp_std",
"ordinal": 4,
"type_info": "Float"
},
{
"name": "pp_taiko",
"ordinal": 5,
"type_info": "Float"
},
{
"name": "pp_mania",
"ordinal": 6,
"type_info": "Float"
},
{
"name": "pp_catch",
"ordinal": 7,
"type_info": "Float"
},
{
"name": "failures: u8",
"ordinal": 8,
"type_info": "Int64"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
true,
false,
false,
true,
true,
true,
true,
false
]
},
"hash": "08f2568a69a14ae240a24264238d4abc7aea5eee67d6062d049f0d37031e4d7a"
}

View file

@ -0,0 +1,32 @@
{
"db_name": "SQLite",
"query": "SELECT\n channel_id as \"channel_id: i64\",\n beatmap,\n mode as \"mode: u8\"\n FROM osu_last_beatmaps\n WHERE channel_id = ?",
"describe": {
"columns": [
{
"name": "channel_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "beatmap",
"ordinal": 1,
"type_info": "Blob"
},
{
"name": "mode: u8",
"ordinal": 2,
"type_info": "Int64"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false
]
},
"hash": "1bf34dddbe994d6124c9382c75e70e1347329e945de2eefad4bfcab5f81b73ce"
}

View file

@ -0,0 +1,50 @@
{
"db_name": "SQLite",
"query": "SELECT\n beatmap_id as \"beatmap_id: i64\",\n mode as \"mode: u8\",\n user_id as \"user_id: i64\",\n mods as \"mods: i64\",\n cached_at as \"cached_at: DateTime\",\n score as \"score: Vec<u8>\"\n FROM osu_user_best_scores\n WHERE\n beatmap_id = ?\n AND mode = ?\n AND user_id = ?",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "mode: u8",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "user_id: i64",
"ordinal": 2,
"type_info": "Int64"
},
{
"name": "mods: i64",
"ordinal": 3,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "score: Vec<u8>",
"ordinal": 5,
"type_info": "Blob"
}
],
"parameters": {
"Right": 3
},
"nullable": [
false,
false,
false,
false,
false,
false
]
},
"hash": "235312a1aad1a58c2f7f2d817945bbac57c38ad2c51c1924683d13d045f21ad9"
}

View file

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO\n osu_user_best_scores (beatmap_id, mode, user_id, mods, cached_at, score)\n VALUES\n (?, ?, ?, ?, ?, ?)\n ON CONFLICT (beatmap_id, mode, user_id, mods)\n DO UPDATE\n SET\n cached_at = excluded.cached_at,\n score = excluded.score\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 6
},
"nullable": []
},
"hash": "25077e7b2657eb918fa49acc16ceba14a004ed503c174073a1db184d902ee393"
}

View file

@ -0,0 +1,32 @@
{
"db_name": "SQLite",
"query": "SELECT\n beatmap_id as \"beatmap_id: i64\",\n cached_at as \"cached_at: DateTime\",\n content as \"content: Vec<u8>\"\n FROM osu_cached_beatmap_contents\n WHERE\n beatmap_id = ? ",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 1,
"type_info": "Datetime"
},
{
"name": "content: Vec<u8>",
"ordinal": 2,
"type_info": "Blob"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false
]
},
"hash": "296c95c7ead4d747a4da007b4b6e28d3c6c1c4bb654c82cc40bf61390c3dad4b"
}

View file

@ -0,0 +1,38 @@
{
"db_name": "SQLite",
"query": "SELECT\n beatmap.beatmap_id as \"beatmap_id: i64\",\n beatmap.mode as \"mode: u8\",\n beatmap.cached_at as \"cached_at: DateTime\",\n beatmap.beatmap as \"beatmap: Vec<u8>\"\n FROM osu_cached_beatmapsets\n INNER JOIN osu_cached_beatmaps AS beatmap\n ON osu_cached_beatmapsets.beatmap_id = beatmap.beatmap_id\n AND osu_cached_beatmapsets.mode = beatmap.mode\n WHERE\n beatmapset_id = ?\n ",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "mode: u8",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "beatmap: Vec<u8>",
"ordinal": 3,
"type_info": "Blob"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false
]
},
"hash": "4b033607229deba540f80e469753e2125b6d8134346144f462325dc025221044"
}

View file

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "INSERT INTO\n osu_last_beatmaps (channel_id, beatmap, mode)\n VALUES\n (?, ?, ?)\n ON CONFLICT (channel_id) DO UPDATE\n SET\n beatmap = excluded.beatmap,\n mode = excluded.mode",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
},
"hash": "5210e3e5610bb968b0b11411b99956d1bf358f2c1e35c4eb5730388ce0c2fe09"
}

View file

@ -0,0 +1,68 @@
{
"db_name": "SQLite",
"query": "SELECT\n user_id as \"user_id: i64\",\n username,\n id as \"id: i64\",\n last_update as \"last_update: DateTime\",\n pp_std, pp_taiko, pp_mania, pp_catch,\n failures as \"failures: u8\"\n FROM osu_users",
"describe": {
"columns": [
{
"name": "user_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "username",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "id: i64",
"ordinal": 2,
"type_info": "Int64"
},
{
"name": "last_update: DateTime",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "pp_std",
"ordinal": 4,
"type_info": "Float"
},
{
"name": "pp_taiko",
"ordinal": 5,
"type_info": "Float"
},
{
"name": "pp_mania",
"ordinal": 6,
"type_info": "Float"
},
{
"name": "pp_catch",
"ordinal": 7,
"type_info": "Float"
},
{
"name": "failures: u8",
"ordinal": 8,
"type_info": "Int64"
}
],
"parameters": {
"Right": 0
},
"nullable": [
false,
true,
false,
false,
true,
true,
true,
true,
false
]
},
"hash": "5753fe315c9a55154d2d80e6d293dc8abffcf426b845624a42cd0bfefc75fb74"
}

View file

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO\n osu_cached_beatmaps (beatmap_id, mode, cached_at, beatmap)\n VALUES\n (?, ?, ?, ?)\n ON CONFLICT (beatmap_id, mode)\n DO UPDATE\n SET\n cached_at = excluded.cached_at,\n beatmap = excluded.beatmap\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 4
},
"nullable": []
},
"hash": "6125c1c187029c7ac6e1e9519445e49942ddf6068a16f000dd0750ab8a9d52c2"
}

View file

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "\n INSERT INTO\n osu_cached_beatmap_contents (beatmap_id, cached_at, content)\n VALUES\n (?, ?, ?)\n ON CONFLICT (beatmap_id)\n DO UPDATE\n SET\n cached_at = excluded.cached_at,\n content = excluded.content\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
},
"hash": "6bfd02cb36c9b74ed4c69eb694e936ba2ee8d3864e2a43b43db78afc32a47384"
}

View file

@ -0,0 +1,68 @@
{
"db_name": "SQLite",
"query": "SELECT\n user_id as \"user_id: i64\",\n username,\n id as \"id: i64\",\n last_update as \"last_update: DateTime\",\n pp_std, pp_taiko, pp_mania, pp_catch,\n failures as \"failures: u8\"\n FROM osu_users WHERE user_id = ?",
"describe": {
"columns": [
{
"name": "user_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "username",
"ordinal": 1,
"type_info": "Text"
},
{
"name": "id: i64",
"ordinal": 2,
"type_info": "Int64"
},
{
"name": "last_update: DateTime",
"ordinal": 3,
"type_info": "Datetime"
},
{
"name": "pp_std",
"ordinal": 4,
"type_info": "Float"
},
{
"name": "pp_taiko",
"ordinal": 5,
"type_info": "Float"
},
{
"name": "pp_mania",
"ordinal": 6,
"type_info": "Float"
},
{
"name": "pp_catch",
"ordinal": 7,
"type_info": "Float"
},
{
"name": "failures: u8",
"ordinal": 8,
"type_info": "Int64"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
true,
false,
false,
true,
true,
true,
true,
false
]
},
"hash": "700ec95294d9a4f21e3d7ff53f15f5dc739bffe8fedc19e35cbb576b6dd2e948"
}

View file

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "INSERT INTO osu_cached_beatmapsets(beatmapset_id, beatmap_id, mode)\n VALUES (?, ?, ?)\n ON CONFLICT DO NOTHING",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
},
"hash": "8b9ad43442b7fa520f2eae498d2ee08264810e49c28bd8ddffaa9f444cada1b5"
}

View file

@ -0,0 +1,50 @@
{
"db_name": "SQLite",
"query": "SELECT\n beatmap_id as \"beatmap_id: i64\",\n mode as \"mode: u8\",\n user_id as \"user_id: i64\",\n mods as \"mods: i64\",\n cached_at as \"cached_at: DateTime\",\n score as \"score: Vec<u8>\"\n FROM osu_user_best_scores\n WHERE\n beatmap_id = ?\n AND mode = ?",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "mode: u8",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "user_id: i64",
"ordinal": 2,
"type_info": "Int64"
},
{
"name": "mods: i64",
"ordinal": 3,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "score: Vec<u8>",
"ordinal": 5,
"type_info": "Blob"
}
],
"parameters": {
"Right": 2
},
"nullable": [
false,
false,
false,
false,
false,
false
]
},
"hash": "95541f737a8dfc7f440840617bed87ebde6dabdd70e2ba7b110ebec91e7feda7"
}

View file

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "DELETE FROM osu_user_best_scores WHERE user_id = ?",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "c83421661626cffd81d5590035ae5283a5b0e8a03696ae479b3d275b81b8af83"
}

View file

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "DELETE FROM osu_users WHERE user_id = ?",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
},
"hash": "d428568e88b653317cbe2c5336e6cdee0862df09faaa6c1fa09869d79438e427"
}

View file

@ -0,0 +1,38 @@
{
"db_name": "SQLite",
"query": "SELECT\n beatmap_id as \"beatmap_id: i64\",\n mode as \"mode: u8\",\n cached_at as \"cached_at: DateTime\",\n beatmap as \"beatmap: Vec<u8>\"\n FROM osu_cached_beatmaps\n WHERE\n beatmap_id = ?\n AND mode = ?\n ",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "mode: u8",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "beatmap: Vec<u8>",
"ordinal": 3,
"type_info": "Blob"
}
],
"parameters": {
"Right": 2
},
"nullable": [
false,
false,
false,
false
]
},
"hash": "d7c91077f904543740a12185fac7756346aa50a63b911414ee8f7a4a0d6dd1cc"
}

View file

@ -0,0 +1,12 @@
{
"db_name": "SQLite",
"query": "INSERT\n INTO osu_users(user_id, username, id, last_update, pp_std, pp_taiko, pp_mania, pp_catch, failures)\n VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (user_id) WHERE id = ? DO UPDATE\n SET\n last_update = excluded.last_update,\n pp_std = excluded.pp_std,\n pp_taiko = excluded.pp_taiko,\n pp_mania = excluded.pp_mania,\n pp_catch = excluded.pp_catch,\n failures = excluded.failures\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 10
},
"nullable": []
},
"hash": "e17f70eb4375790907c7ecec1132cab859a7a18a8ce636f0b39c0b5387d9dffc"
}

View file

@ -7,7 +7,7 @@ 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-rustls", "sqlite", "chrono", "offline"] }
sqlx = { version = "0.7", features = ["runtime-tokio", "sqlite", "chrono"] }
thiserror = "1.0.31"
chrono = "0.4.19"
futures-util = "0.3.21"

View file

@ -1,491 +0,0 @@
{
"db": "SQLite",
"1bf34dddbe994d6124c9382c75e70e1347329e945de2eefad4bfcab5f81b73ce": {
"query": "SELECT\n channel_id as \"channel_id: i64\",\n beatmap,\n mode as \"mode: u8\"\n FROM osu_last_beatmaps\n WHERE channel_id = ?",
"describe": {
"columns": [
{
"name": "channel_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "beatmap",
"ordinal": 1,
"type_info": "Blob"
},
{
"name": "mode: u8",
"ordinal": 2,
"type_info": "Int64"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false
]
}
},
"235312a1aad1a58c2f7f2d817945bbac57c38ad2c51c1924683d13d045f21ad9": {
"query": "SELECT\n beatmap_id as \"beatmap_id: i64\",\n mode as \"mode: u8\",\n user_id as \"user_id: i64\",\n mods as \"mods: i64\",\n cached_at as \"cached_at: DateTime\",\n score as \"score: Vec<u8>\"\n FROM osu_user_best_scores\n WHERE\n beatmap_id = ?\n AND mode = ?\n AND user_id = ?",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "mode: u8",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "user_id: i64",
"ordinal": 2,
"type_info": "Int64"
},
{
"name": "mods: i64",
"ordinal": 3,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "score: Vec<u8>",
"ordinal": 5,
"type_info": "Blob"
}
],
"parameters": {
"Right": 3
},
"nullable": [
false,
false,
false,
false,
false,
false
]
}
},
"25077e7b2657eb918fa49acc16ceba14a004ed503c174073a1db184d902ee393": {
"query": "\n INSERT INTO\n osu_user_best_scores (beatmap_id, mode, user_id, mods, cached_at, score)\n VALUES\n (?, ?, ?, ?, ?, ?)\n ON CONFLICT (beatmap_id, mode, user_id, mods)\n DO UPDATE\n SET\n cached_at = excluded.cached_at,\n score = excluded.score\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 6
},
"nullable": []
}
},
"27edec2f76b1bc48e87b66e6d27e6784e0b0c17dec013feb05c4b7291b8b4a5f": {
"query": "SELECT\n user_id as \"user_id: i64\",\n id as \"id: i64\",\n last_update as \"last_update: DateTime\",\n pp_std, pp_taiko, pp_mania, pp_catch,\n failures as \"failures: u8\"\n FROM osu_users WHERE id = ?",
"describe": {
"columns": [
{
"name": "user_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "id: i64",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "last_update: DateTime",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "pp_std",
"ordinal": 3,
"type_info": "Float"
},
{
"name": "pp_taiko",
"ordinal": 4,
"type_info": "Float"
},
{
"name": "pp_mania",
"ordinal": 5,
"type_info": "Float"
},
{
"name": "pp_catch",
"ordinal": 6,
"type_info": "Float"
},
{
"name": "failures: u8",
"ordinal": 7,
"type_info": "Int64"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
true,
true,
true,
true,
false
]
}
},
"296c95c7ead4d747a4da007b4b6e28d3c6c1c4bb654c82cc40bf61390c3dad4b": {
"query": "SELECT\n beatmap_id as \"beatmap_id: i64\",\n cached_at as \"cached_at: DateTime\",\n content as \"content: Vec<u8>\"\n FROM osu_cached_beatmap_contents\n WHERE\n beatmap_id = ? ",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 1,
"type_info": "Datetime"
},
{
"name": "content: Vec<u8>",
"ordinal": 2,
"type_info": "Blob"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false
]
}
},
"3c9d163aa2b752afc74e7b0909a9c1995cd019d9798a992eddc2e778f36f2d4c": {
"query": "SELECT\n user_id as \"user_id: i64\",\n id as \"id: i64\",\n last_update as \"last_update: DateTime\",\n pp_std, pp_taiko, pp_mania, pp_catch,\n failures as \"failures: u8\"\n FROM osu_users",
"describe": {
"columns": [
{
"name": "user_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "id: i64",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "last_update: DateTime",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "pp_std",
"ordinal": 3,
"type_info": "Float"
},
{
"name": "pp_taiko",
"ordinal": 4,
"type_info": "Float"
},
{
"name": "pp_mania",
"ordinal": 5,
"type_info": "Float"
},
{
"name": "pp_catch",
"ordinal": 6,
"type_info": "Float"
},
{
"name": "failures: u8",
"ordinal": 7,
"type_info": "Int64"
}
],
"parameters": {
"Right": 0
},
"nullable": [
false,
false,
false,
true,
true,
true,
true,
false
]
}
},
"4b033607229deba540f80e469753e2125b6d8134346144f462325dc025221044": {
"query": "SELECT\n beatmap.beatmap_id as \"beatmap_id: i64\",\n beatmap.mode as \"mode: u8\",\n beatmap.cached_at as \"cached_at: DateTime\",\n beatmap.beatmap as \"beatmap: Vec<u8>\"\n FROM osu_cached_beatmapsets\n INNER JOIN osu_cached_beatmaps AS beatmap\n ON osu_cached_beatmapsets.beatmap_id = beatmap.beatmap_id\n AND osu_cached_beatmapsets.mode = beatmap.mode\n WHERE\n beatmapset_id = ?\n ",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "mode: u8",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "beatmap: Vec<u8>",
"ordinal": 3,
"type_info": "Blob"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
false
]
}
},
"5210e3e5610bb968b0b11411b99956d1bf358f2c1e35c4eb5730388ce0c2fe09": {
"query": "INSERT INTO\n osu_last_beatmaps (channel_id, beatmap, mode)\n VALUES\n (?, ?, ?)\n ON CONFLICT (channel_id) DO UPDATE\n SET\n beatmap = excluded.beatmap,\n mode = excluded.mode",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
}
},
"55fc5c2846680c32a2c9646e45cc578cff25cde57cca19f5fb53dceacc154954": {
"query": "SELECT\n user_id as \"user_id: i64\",\n id as \"id: i64\",\n last_update as \"last_update: DateTime\",\n pp_std, pp_taiko, pp_mania, pp_catch,\n failures as \"failures: u8\"\n FROM osu_users WHERE user_id = ?",
"describe": {
"columns": [
{
"name": "user_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "id: i64",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "last_update: DateTime",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "pp_std",
"ordinal": 3,
"type_info": "Float"
},
{
"name": "pp_taiko",
"ordinal": 4,
"type_info": "Float"
},
{
"name": "pp_mania",
"ordinal": 5,
"type_info": "Float"
},
{
"name": "pp_catch",
"ordinal": 6,
"type_info": "Float"
},
{
"name": "failures: u8",
"ordinal": 7,
"type_info": "Int64"
}
],
"parameters": {
"Right": 1
},
"nullable": [
false,
false,
false,
true,
true,
true,
true,
false
]
}
},
"6125c1c187029c7ac6e1e9519445e49942ddf6068a16f000dd0750ab8a9d52c2": {
"query": "\n INSERT INTO\n osu_cached_beatmaps (beatmap_id, mode, cached_at, beatmap)\n VALUES\n (?, ?, ?, ?)\n ON CONFLICT (beatmap_id, mode)\n DO UPDATE\n SET\n cached_at = excluded.cached_at,\n beatmap = excluded.beatmap\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 4
},
"nullable": []
}
},
"6bfd02cb36c9b74ed4c69eb694e936ba2ee8d3864e2a43b43db78afc32a47384": {
"query": "\n INSERT INTO\n osu_cached_beatmap_contents (beatmap_id, cached_at, content)\n VALUES\n (?, ?, ?)\n ON CONFLICT (beatmap_id)\n DO UPDATE\n SET\n cached_at = excluded.cached_at,\n content = excluded.content\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
}
},
"6c95dc522e1e8490358ce4c5fea08fe50300ab4092b33eef44aba85f4a43c818": {
"query": "INSERT\n INTO osu_users(user_id, id, last_update, pp_std, pp_taiko, pp_mania, pp_catch, failures)\n VALUES(?, ?, ?, ?, ?, ?, ?, ?)\n ON CONFLICT (user_id) WHERE id = ? DO UPDATE\n SET\n last_update = excluded.last_update,\n pp_std = excluded.pp_std,\n pp_taiko = excluded.pp_taiko,\n pp_mania = excluded.pp_mania,\n pp_catch = excluded.pp_catch,\n failures = excluded.failures\n ",
"describe": {
"columns": [],
"parameters": {
"Right": 9
},
"nullable": []
}
},
"8b9ad43442b7fa520f2eae498d2ee08264810e49c28bd8ddffaa9f444cada1b5": {
"query": "INSERT INTO osu_cached_beatmapsets(beatmapset_id, beatmap_id, mode)\n VALUES (?, ?, ?)\n ON CONFLICT DO NOTHING",
"describe": {
"columns": [],
"parameters": {
"Right": 3
},
"nullable": []
}
},
"95541f737a8dfc7f440840617bed87ebde6dabdd70e2ba7b110ebec91e7feda7": {
"query": "SELECT\n beatmap_id as \"beatmap_id: i64\",\n mode as \"mode: u8\",\n user_id as \"user_id: i64\",\n mods as \"mods: i64\",\n cached_at as \"cached_at: DateTime\",\n score as \"score: Vec<u8>\"\n FROM osu_user_best_scores\n WHERE\n beatmap_id = ?\n AND mode = ?",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "mode: u8",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "user_id: i64",
"ordinal": 2,
"type_info": "Int64"
},
{
"name": "mods: i64",
"ordinal": 3,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 4,
"type_info": "Datetime"
},
{
"name": "score: Vec<u8>",
"ordinal": 5,
"type_info": "Blob"
}
],
"parameters": {
"Right": 2
},
"nullable": [
false,
false,
false,
false,
false,
false
]
}
},
"c83421661626cffd81d5590035ae5283a5b0e8a03696ae479b3d275b81b8af83": {
"query": "DELETE FROM osu_user_best_scores WHERE user_id = ?",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
}
},
"d428568e88b653317cbe2c5336e6cdee0862df09faaa6c1fa09869d79438e427": {
"query": "DELETE FROM osu_users WHERE user_id = ?",
"describe": {
"columns": [],
"parameters": {
"Right": 1
},
"nullable": []
}
},
"d7c91077f904543740a12185fac7756346aa50a63b911414ee8f7a4a0d6dd1cc": {
"query": "SELECT\n beatmap_id as \"beatmap_id: i64\",\n mode as \"mode: u8\",\n cached_at as \"cached_at: DateTime\",\n beatmap as \"beatmap: Vec<u8>\"\n FROM osu_cached_beatmaps\n WHERE\n beatmap_id = ?\n AND mode = ?\n ",
"describe": {
"columns": [
{
"name": "beatmap_id: i64",
"ordinal": 0,
"type_info": "Int64"
},
{
"name": "mode: u8",
"ordinal": 1,
"type_info": "Int64"
},
{
"name": "cached_at: DateTime",
"ordinal": 2,
"type_info": "Datetime"
},
{
"name": "beatmap: Vec<u8>",
"ordinal": 3,
"type_info": "Blob"
}
],
"parameters": {
"Right": 2
},
"nullable": [
false,
false,
false,
false
]
}
}
}

View file

@ -106,9 +106,9 @@ impl BeatmapMetaCache {
let mut t = self.pool.begin().await?;
for b in &beatmaps {
let mut b = Self::to_cached_beatmap(b, None);
b.store(&mut t).await?;
b.store(&mut *t).await?;
// Save the beatmapset mapping.
b.link_beatmapset(id as i64, &mut t).await?;
b.link_beatmapset(id as i64, &mut *t).await?;
}
t.commit().await?;
}

View file

@ -26,7 +26,7 @@ impl OsuSavedUsers {
/// Get all users
pub async fn all(&self) -> Result<Vec<OsuUser>> {
let mut conn = self.pool.acquire().await?;
model::OsuUser::all(&mut conn)
model::OsuUser::all(&mut *conn)
.map(|v| v.map(OsuUser::from).map_err(Error::from))
.try_collect()
.await
@ -35,7 +35,7 @@ impl OsuSavedUsers {
/// Get an user by their user_id.
pub async fn by_user_id(&self, user_id: UserId) -> Result<Option<OsuUser>> {
let mut conn = self.pool.acquire().await?;
let u = model::OsuUser::by_user_id(user_id.0 as i64, &mut conn)
let u = model::OsuUser::by_user_id(user_id.0 as i64, &mut *conn)
.await?
.map(OsuUser::from);
Ok(u)
@ -44,14 +44,14 @@ impl OsuSavedUsers {
/// Save the given user.
pub async fn save(&self, u: OsuUser) -> Result<()> {
let mut conn = self.pool.acquire().await?;
Ok(model::OsuUser::from(u).store(&mut conn).await?)
Ok(model::OsuUser::from(u).store(&mut *conn).await?)
}
/// Save the given user as a completely new user.
pub async fn new_user(&self, u: OsuUser) -> Result<()> {
let mut t = self.pool.begin().await?;
model::OsuUser::delete(u.user_id.0 as i64, &mut t).await?;
model::OsuUser::from(u).store(&mut t).await?;
model::OsuUser::delete(u.user_id.0 as i64, &mut *t).await?;
model::OsuUser::from(u).store(&mut *t).await?;
t.commit().await?;
Ok(())
}