mirror of
https://codeberg.org/icewind/log-normalizer.git
synced 2026-06-03 13:54:11 +02:00
bumb dependencies
This commit is contained in:
parent
506de3f06e
commit
87ff3a084b
6 changed files with 973 additions and 482 deletions
991
Cargo.lock
generated
991
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
18
Cargo.toml
18
Cargo.toml
|
|
@ -9,16 +9,16 @@ name = "log-normalizer"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
sqlx = { version = "0.3", default_features = false, features = ["macros", "postgres", "json", "runtime-tokio", "chrono"] }
|
sqlx = { version = "0.5.11", default_features = false, features = ["macros", "postgres", "json", "chrono", "runtime-tokio-rustls", "offline"] }
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
main_error = "0.1.0"
|
main_error = "0.1.2"
|
||||||
tokio = { version = "0.2.13", features = ["macros", "time"] }
|
tokio = { version = "1.17.0", features = ["macros", "time"] }
|
||||||
reqwest = { version = "0.10.4", features = [] }
|
reqwest = { version = "0.11.10", features = [] }
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0.136", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0.79"
|
||||||
chrono = { version = "0.4", features = ["serde"] }
|
chrono = { version = "0.4.19", features = ["serde"] }
|
||||||
steamid-ng = "0.3.4"
|
steamid-ng = "1.0.0"
|
||||||
test-case = "1.0.0"
|
test-case = "2.0.2"
|
||||||
tracing = "0.1.33"
|
tracing = "0.1.33"
|
||||||
tracing-subscriber = "0.3.11"
|
tracing-subscriber = "0.3.11"
|
||||||
|
|
||||||
|
|
|
||||||
446
sqlx-data.json
Normal file
446
sqlx-data.json
Normal file
|
|
@ -0,0 +1,446 @@
|
||||||
|
{
|
||||||
|
"db": "PostgreSQL",
|
||||||
|
"0000e8f1c60464bde61980810f4013b3ff71d318291de9d8cf595474f4ee8f32": {
|
||||||
|
"query": "INSERT INTO events_round_win(round_id, time, team)VALUES($1, $2, $3)",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "team",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"blue",
|
||||||
|
"red",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"094070119b4aeddc0bc17bfd96d96a23a31b08a425569ea95f9c9f32cb1d02aa": {
|
||||||
|
"query": "SELECT MIN(id) as id from logs WHERE version < $1",
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"ordinal": 0,
|
||||||
|
"name": "id",
|
||||||
|
"type_info": "Int4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": [
|
||||||
|
null
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"253ca64f81921ad7351335d8b47967a4b6831b16d8128a11b40daa63b31f5a4c": {
|
||||||
|
"query": "INSERT INTO players (log_id, steam_id, name, team, kills, deaths, assists,suicides, dmg, damage_taken, ubers, medigun_ubers,kritzkrieg_ubers, quickfix_ubers, vaccinator_ubers,drops, medkits, medkits_hp, backstabs, headshots,heal, heals_received,scout_kills, soldier_kills, pyro_kills, demoman_kills,heavy_kills, engineer_kills, medic_kills, sniper_kills, spy_kills,\n scout_deaths, soldier_deaths, pyro_deaths, demoman_deaths,heavy_deaths, engineer_deaths, medic_deaths, sniper_deaths, spy_deaths\n )VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,$11, $12, $13, $14, $15, $16, $17, $18, $19, $20,$21, $22, $23, $24, $25, $26, $27, $28, $29, $30,$31, $32, $33, $34, $35, $36, $37, $38, $39, $40)RETURNING id",
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"ordinal": 0,
|
||||||
|
"name": "id",
|
||||||
|
"type_info": "Int8"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int4",
|
||||||
|
"Int8",
|
||||||
|
"Text",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "team",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"blue",
|
||||||
|
"red",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": [
|
||||||
|
false
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"417cfaecb2cb45d16c9da2dc2f8e6d1a37280842a5fc9ffb85b5d1955a54670d": {
|
||||||
|
"query": "INSERT INTO logs(id, red_score, blue_score, length, game_mode, map, type, date, version)VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "game_mode",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"ultiduo",
|
||||||
|
"4v4",
|
||||||
|
"6v6",
|
||||||
|
"7v7",
|
||||||
|
"9v9",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Text",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "map_type",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"stopwatch",
|
||||||
|
"cp",
|
||||||
|
"koth",
|
||||||
|
"ctf",
|
||||||
|
"ultiduo",
|
||||||
|
"bball",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Timestamp",
|
||||||
|
"Int2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"425af9e4b088335acabe4bf74c3b11c0cab5f033b57197c992533889a4d1300d": {
|
||||||
|
"query": "INSERT INTO player_weapon_stats(class_stat_id, weapon, kills, shots, hits, dmg)VALUES($1, $2, $3, $4, $5, $6)",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int8",
|
||||||
|
"Text",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"4dcd86f5ef23f46b5c6cd391522791a609e04e068009678ba95b81cb385b9e89": {
|
||||||
|
"query": "INSERT INTO events_charge(round_id, time, team, medigun, steam_id)VALUES($1, $2, $3, $4, $5)",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "team",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"blue",
|
||||||
|
"red",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "medigun",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"medigun",
|
||||||
|
"kritzkrieg",
|
||||||
|
"quickfix",
|
||||||
|
"vaccinator"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Int8"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"581b192c18e54b711d0e3b6d38490984c48320fe4607c7eacc7b9002daaf7771": {
|
||||||
|
"query": "INSERT INTO kill_streaks(log_id, steam_id, time, streak)VALUES($1, $2, $3, $4)",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int4",
|
||||||
|
"Int8",
|
||||||
|
"Int4",
|
||||||
|
"Int4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"7669da21c453d1d4e5d5e7aead5a0fbc4307aba66debd679159374c5647fd0fe": {
|
||||||
|
"query": "INSERT INTO events_medic_death(round_id, time, team, steam_id, killer)VALUES($1, $2, $3, $4, $5)",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "team",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"blue",
|
||||||
|
"red",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Int8",
|
||||||
|
"Int8"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"982bc615a035019855317b3b47a3ac10159d81318db323c2d076c9b4c04a4e02": {
|
||||||
|
"query": "INSERT INTO events_drop(round_id, time, team, steam_id)VALUES($1, $2, $3, $4)",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "team",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"blue",
|
||||||
|
"red",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Int8"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"c9f31bcb2cb8b76f7cd2e66284b70f79e462ac70f94cdab022bdce63929731b1": {
|
||||||
|
"query": "UPDATE logs SET version = $1 WHERE id = $2",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int2",
|
||||||
|
"Int4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"d4d72675d0a0792d14472c6bfc00454791dea1eae933818d168171f818bb7dc9": {
|
||||||
|
"query": "INSERT INTO class_stats(player_id, type, time, kills, deaths, assists, dmg)VALUES($1, $2, $3, $4, $5, $6, $7)RETURNING id",
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"ordinal": 0,
|
||||||
|
"name": "id",
|
||||||
|
"type_info": "Int8"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int8",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "class_type",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"scout",
|
||||||
|
"soldier",
|
||||||
|
"pyro",
|
||||||
|
"demoman",
|
||||||
|
"heavyweapons",
|
||||||
|
"engineer",
|
||||||
|
"medic",
|
||||||
|
"sniper",
|
||||||
|
"spy",
|
||||||
|
"unknown"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": [
|
||||||
|
false
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"eab40a01c0df317cdfb97eb4f88884f6776897ec2c2ecb8cae05748c8d087711": {
|
||||||
|
"query": "INSERT INTO rounds(\n round, log_id, length, winner, first_cap, red_score, blue_score,\n red_kills, blue_kills, red_dmg, blue_dmg, red_ubers, blue_ubers\n )\n VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)\n RETURNING id",
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"ordinal": 0,
|
||||||
|
"name": "id",
|
||||||
|
"type_info": "Int4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "team",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"blue",
|
||||||
|
"red",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "team",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"blue",
|
||||||
|
"red",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
"Int4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": [
|
||||||
|
false
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"f4daaeeaaf227491627c0bb54319a5f356028a591fdac2f41ba2dce1c5053d4a": {
|
||||||
|
"query": "SELECT MAX(id) as id from logs",
|
||||||
|
"describe": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"ordinal": 0,
|
||||||
|
"name": "id",
|
||||||
|
"type_info": "Int4"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"parameters": {
|
||||||
|
"Left": []
|
||||||
|
},
|
||||||
|
"nullable": [
|
||||||
|
null
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"f8be06a1f3b2b9755faf3ca32921528528240308ed036cd6cf320ca4d31438b9": {
|
||||||
|
"query": "INSERT INTO events_point_cap(round_id, time, team, point)VALUES($1, $2, $3, $4)",
|
||||||
|
"describe": {
|
||||||
|
"columns": [],
|
||||||
|
"parameters": {
|
||||||
|
"Left": [
|
||||||
|
"Int4",
|
||||||
|
"Int4",
|
||||||
|
{
|
||||||
|
"Custom": {
|
||||||
|
"name": "team",
|
||||||
|
"kind": {
|
||||||
|
"Enum": [
|
||||||
|
"blue",
|
||||||
|
"red",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Int4"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"nullable": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Eq, PartialEq)]
|
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Eq, PartialEq)]
|
||||||
#[sqlx(rename = "team")]
|
#[sqlx(type_name = "team")]
|
||||||
#[sqlx(rename_all = "lowercase")]
|
#[sqlx(rename_all = "lowercase")]
|
||||||
pub enum TeamId {
|
pub enum TeamId {
|
||||||
Blue,
|
Blue,
|
||||||
|
|
@ -19,7 +19,7 @@ impl Default for TeamId {
|
||||||
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Eq, PartialEq)]
|
#[derive(Debug, Clone, Copy, sqlx::Type, Deserialize, Eq, PartialEq)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
#[sqlx(rename_all = "lowercase")]
|
#[sqlx(rename_all = "lowercase")]
|
||||||
#[sqlx(rename = "class_type")]
|
#[sqlx(type_name = "class_type")]
|
||||||
pub enum Class {
|
pub enum Class {
|
||||||
Scout,
|
Scout,
|
||||||
Soldier,
|
Soldier,
|
||||||
|
|
@ -35,7 +35,7 @@ pub enum Class {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, sqlx::Type, Eq, PartialEq)]
|
#[derive(Debug, Clone, Copy, sqlx::Type, Eq, PartialEq)]
|
||||||
#[sqlx(rename = "game_mode")]
|
#[sqlx(type_name = "game_mode")]
|
||||||
pub enum GameMode {
|
pub enum GameMode {
|
||||||
#[sqlx(rename = "ultiduo")]
|
#[sqlx(rename = "ultiduo")]
|
||||||
UltiDuo,
|
UltiDuo,
|
||||||
|
|
@ -80,7 +80,7 @@ impl Default for Medigun {
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, sqlx::Type, Eq, PartialEq)]
|
#[derive(Debug, Clone, Copy, sqlx::Type, Eq, PartialEq)]
|
||||||
#[sqlx(rename_all = "lowercase")]
|
#[sqlx(rename_all = "lowercase")]
|
||||||
#[sqlx(rename = "map_type")]
|
#[sqlx(type_name = "map_type")]
|
||||||
pub enum MapType {
|
pub enum MapType {
|
||||||
Stopwatch,
|
Stopwatch,
|
||||||
Cp,
|
Cp,
|
||||||
|
|
|
||||||
18
src/main.rs
18
src/main.rs
|
|
@ -6,8 +6,9 @@ mod raw;
|
||||||
use crate::database::{store_log, upgrade};
|
use crate::database::{store_log, upgrade};
|
||||||
use crate::normalized::NormalizedLog;
|
use crate::normalized::NormalizedLog;
|
||||||
use main_error::MainError;
|
use main_error::MainError;
|
||||||
use sqlx::{postgres::PgQueryAs, PgPool};
|
use sqlx::pool::PoolOptions;
|
||||||
use tokio::time::{delay_for, Duration};
|
use sqlx::PgPool;
|
||||||
|
use tokio::time::{sleep, Duration};
|
||||||
use tracing::{error, info, instrument};
|
use tracing::{error, info, instrument};
|
||||||
|
|
||||||
const OLD_VERSION: i16 = 1;
|
const OLD_VERSION: i16 = 1;
|
||||||
|
|
@ -21,15 +22,18 @@ async fn main() -> Result<(), MainError> {
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
normalize(&database_url, &raw_database_url).await?;
|
normalize(&database_url, &raw_database_url).await?;
|
||||||
delay_for(Duration::from_secs(15 * 60)).await;
|
sleep(Duration::from_secs(15 * 60)).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn normalize(database_url: &str, raw_database_url: &str) -> Result<(), MainError> {
|
async fn normalize(database_url: &str, raw_database_url: &str) -> Result<(), MainError> {
|
||||||
let pool = PgPool::builder().max_size(2).build(database_url).await?;
|
let pool = PoolOptions::new()
|
||||||
let raw_pool = PgPool::builder()
|
.max_connections(2)
|
||||||
.max_size(2)
|
.connect(database_url)
|
||||||
.build(raw_database_url)
|
.await?;
|
||||||
|
let raw_pool = PoolOptions::new()
|
||||||
|
.max_connections(2)
|
||||||
|
.connect(raw_database_url)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let max = get_max_log(&raw_pool).await?;
|
let max = get_max_log(&raw_pool).await?;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::data::{Class, Medigun, TeamId};
|
use crate::data::{Class, Medigun, TeamId};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::convert::TryFrom;
|
use std::convert::{TryFrom, TryInto};
|
||||||
use steamid_ng::SteamID;
|
use steamid_ng::SteamID;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Deserialize)]
|
#[derive(Debug, Clone, Deserialize)]
|
||||||
|
|
@ -284,13 +284,13 @@ pub enum ChatFrom {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<String> for ChatFrom {
|
impl TryFrom<String> for ChatFrom {
|
||||||
type Error = steamid_ng::SteamIDParseError;
|
type Error = steamid_ng::SteamIDError;
|
||||||
|
|
||||||
fn try_from(value: String) -> Result<Self, Self::Error> {
|
fn try_from(value: String) -> Result<Self, Self::Error> {
|
||||||
if value == "Console" {
|
if value == "Console" {
|
||||||
Ok(ChatFrom::Console)
|
Ok(ChatFrom::Console)
|
||||||
} else {
|
} else {
|
||||||
value.parse().map(ChatFrom::Player)
|
value.as_str().try_into().map(ChatFrom::Player)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue