首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >【大家的项目】FnckSQL 纯Rust实现的嵌入式SQL数据库

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

作者头像
MikeLoveRust
发布于 2024-01-31 11:09:43
发布于 2024-01-31 11:09:43
5620
举报

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;
            }
        }
    )
);
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2024-01-30,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档