Crates.io | app-db-schema |
lib.rs | app-db-schema |
version | 0.1.2 |
source | src |
created_at | 2022-11-12 02:58:59.356491 |
updated_at | 2022-11-14 17:58:21.038252 |
description | a common package for app with surreal |
homepage | |
repository | https://github.com/seaorm-up/schema |
max_upload_size | |
id | 713302 |
size | 20,027 |
let v = "insert into mobile {id:123,num:123}"
.execute_one::<Mobile>()
.await;
or something ref to
#[async_trait]
pub trait StrDb {
async fn execute_silent(&self) -> bool;
async fn raw_execute_one(&self) -> Result<Vec<Value>, Error>;
async fn execute_one<T: TryFrom<SurrealValue>>(&self) -> Vec<T>
where
<T as TryFrom<SurrealValue>>::Error: std::error::Error,
<T as TryFrom<SurrealValue>>::Error: Send,
<T as TryFrom<SurrealValue>>::Error: Sync,
<T as TryFrom<SurrealValue>>::Error: 'static;
}
#[cfg(test)]
#[derive(SurrealDbObject, Debug, Clone)]
pub struct App {
pub name: String,
}
#[cfg(test)]
mod test {
use crate::*;
fn instance() -> App {
App {
name: "adf".to_owned(),
}
}
smethod!(
format("create app CONTENT {}", instance, instance),
App,
create_app
);
// delete would return [] all ways
// create as test would return value, so it is no need aa get_app
smethod!(
format("delete app where name='{}'", instance, instance.name),
App,
delete,
[create_app][get_app]
);
smethod!(
format(
"select * from app where name = '{}'",
instance,
instance.name
),
App,
get_app
);
}
check snapshots files to find features
cargo release publish --workspace --execute
cargo insta test --review --delete-unreferenced-snapshots