surrealpatch/lib/tests/parse.rs
2022-07-28 10:00:06 +01:00

20 lines
337 B
Rust

use surrealdb::sql::json;
use surrealdb::sql::thing;
use surrealdb::sql::Thing;
use surrealdb::sql::Value;
pub trait Parse<T> {
fn parse(val: &str) -> T;
}
impl Parse<Value> for Value {
fn parse(val: &str) -> Value {
json(val).unwrap()
}
}
impl Parse<Thing> for Thing {
fn parse(val: &str) -> Thing {
thing(val).unwrap()
}
}