surrealpatch/lib/src/doc/store.rs

23 lines
497 B
Rust
Raw Normal View History

use crate::dbs::Options;
use crate::dbs::Runtime;
use crate::dbs::Statement;
use crate::dbs::Transaction;
use crate::doc::Document;
use crate::err::Error;
2022-03-07 18:11:44 +00:00
use crate::key::thing;
impl<'a> Document<'a> {
pub async fn store(
&self,
_ctx: &Runtime,
2022-03-07 18:11:44 +00:00
opt: &Options,
txn: &Transaction,
2022-02-26 23:30:19 +00:00
_stm: &Statement,
) -> Result<(), Error> {
2022-03-07 18:11:44 +00:00
let md = self.id.as_ref().unwrap();
let key = thing::new(opt.ns(), opt.db(), &md.tb, &md.id);
txn.clone().lock().await.set(key, self).await?;
Ok(())
}
}