【大家的项目】FnckSQL 纯Rust实现的嵌入式SQL数据库

2024-01-31 11:09:43 浏览数 (1)

https://github.com/KipData/FnckSQL

代码语言:javascript复制
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;
            }
        }
    )
);

0 人点赞