Я такая тупая блин клас
parent
c92819cda9
commit
7e1fd4f5df
|
|
@ -445,6 +445,19 @@ version = "1.8.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06"
|
||||
|
||||
[[package]]
|
||||
name = "bigdecimal"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d6867f1565b3aad85681f1015055b087fcfd840d6aeee6eee7f2da317603695"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"libm",
|
||||
"num-bigint",
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bit-set"
|
||||
version = "0.9.1"
|
||||
|
|
@ -2340,6 +2353,16 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"
|
||||
dependencies = [
|
||||
"num-integer",
|
||||
"num-traits",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-bigint-dig"
|
||||
version = "0.8.6"
|
||||
|
|
@ -3777,6 +3800,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"bigdecimal",
|
||||
"bytes",
|
||||
"crc",
|
||||
"crossbeam-queue",
|
||||
|
|
@ -3850,6 +3874,7 @@ checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526"
|
|||
dependencies = [
|
||||
"atoi",
|
||||
"base64",
|
||||
"bigdecimal",
|
||||
"bitflags 2.11.1",
|
||||
"byteorder",
|
||||
"bytes",
|
||||
|
|
@ -3892,6 +3917,7 @@ checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46"
|
|||
dependencies = [
|
||||
"atoi",
|
||||
"base64",
|
||||
"bigdecimal",
|
||||
"bitflags 2.11.1",
|
||||
"byteorder",
|
||||
"crc",
|
||||
|
|
@ -3908,6 +3934,7 @@ dependencies = [
|
|||
"log",
|
||||
"md-5",
|
||||
"memchr",
|
||||
"num-bigint",
|
||||
"once_cell",
|
||||
"rand",
|
||||
"serde",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ egui = "0.34.2"
|
|||
egui_dock = "0.19.1"
|
||||
egui_extras = "0.34.2"
|
||||
rust_decimal = {version = "1.42.0", features = ["macros"]}
|
||||
sqlx = {version="0.8.6", features = ["runtime-tokio", "mysql"]}
|
||||
sqlx = {version="0.8.6", features = ["runtime-tokio", "mysql","bigdecimal"]}
|
||||
|
||||
[target.'cfg(target_os="windows")'.dependencies]
|
||||
eframe = {version ="0.34.2",default-features=false, features=["glow"]}
|
||||
|
|
|
|||
|
|
@ -21,15 +21,14 @@ impl DBOperator{
|
|||
|
||||
}
|
||||
|
||||
async fn get_position(pool: &MySqlPool) -> anyhow::Result<()>{
|
||||
let rets = sqlx::query!(r#"SELECT * FROM position"#)
|
||||
.fetch_all(*pool)
|
||||
.await?;
|
||||
Ok(())
|
||||
async fn get_position(pool: &MySqlPool) -> Result<Vec<Position>, sqlx::Error>{
|
||||
let rets: Vec<Position> = sqlx::query_as:: <_, Position>("SELECT * FROM `position`").fetch_all(pool).await?;
|
||||
Ok(rets)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
pub async fn estabilish_connection() -> Result<(), sqlx::Error>{
|
||||
dotenv().ok();
|
||||
let db_url = dotenv::var("DATABASE_URL").expect("DATABASE_URL установи!");
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
use sqlx::types::BigDecimal;
|
||||
|
||||
|
||||
#[derive(Default, Clone, Hash, sqlx::FromRow)]
|
||||
pub struct Position{
|
||||
id: i32,
|
||||
name: String,
|
||||
wage: rust_decimal::Decimal,
|
||||
wage: BigDecimal,
|
||||
}
|
||||
#[derive(Default, Clone, Hash)]
|
||||
pub struct Worker{
|
||||
|
|
|
|||
Loading…
Reference in New Issue