rust-d1-orm 0.0.1

Query builder / ORM for Cloudflare D1, targeting wasm32-unknown-unknown
Documentation
1
2
3
4
5
6
7
8
9
10
11
use worker::wasm_bindgen::JsValue;

pub trait D1Model: Sized + for<'de> serde::Deserialize<'de> {
    const TABLE: &'static str;
    const COLUMNS: &'static [&'static str];
    fn values(&self) -> Vec<JsValue>;
}

pub fn opt_js<T: Into<JsValue>>(val: Option<T>) -> JsValue {
    val.map(Into::into).unwrap_or(JsValue::NULL)
}