< 返回版块

KKould 发表于 2024-01-29 03:15

let fnck_sql = Database::with_kipdb("./data").await?;

let tupes = db.run("select * from t1").await?;

#[derive(Default, Debug, PartialEq)]
struct MyStruct {
  c1: i32,
  c2: String,
}

implement_from_tuple!(
    MyStruct, (
        c1: i32 => |inner: &mut MyStruct, value| {
            if let DataValue::Int32(Some(val)) = value {
                inner.c1 = val;
            }
        },
        c2: String => |inner: &mut MyStruct, value| {
            if let DataValue::Utf8(Some(val)) = value {
                inner.c2 = val;
            }
        }
    )
);

https://github.com/KipData/FnckSQL


Ext Link: https://github.com/KipData/FnckSQL

评论区

写评论

还没有评论

1 共 0 条评论, 1 页