Only store empty value in datastore for record edges

This commit is contained in:
Tobie Morgan Hitchcock 2022-06-15 08:50:59 +01:00
parent a687a7f4bf
commit 1f5acefa7c

View file

@ -5,7 +5,7 @@ use crate::dbs::Transaction;
use crate::dbs::Workable;
use crate::doc::Document;
use crate::err::Error;
use crate::sql::dir::Dir;
use crate::sql::Dir;
impl<'a> Document<'a> {
pub async fn edges(
@ -29,16 +29,16 @@ impl<'a> Document<'a> {
if let Workable::Relate(l, r) = &self.extras {
// Store the left pointer edge
let key = crate::key::graph::new(opt.ns(), opt.db(), &l.tb, &l.id, &Dir::Out, rid);
run.set(key, self).await?;
run.set(key, vec![]).await?;
// Store the left inner edge
let key = crate::key::graph::new(opt.ns(), opt.db(), &rid.tb, &rid.id, &Dir::In, l);
run.set(key, self).await?;
run.set(key, vec![]).await?;
// Store the right inner edge
let key = crate::key::graph::new(opt.ns(), opt.db(), &rid.tb, &rid.id, &Dir::Out, r);
run.set(key, self).await?;
run.set(key, vec![]).await?;
// Store the right pointer edge
let key = crate::key::graph::new(opt.ns(), opt.db(), &r.tb, &r.id, &Dir::In, rid);
run.set(key, self).await?;
run.set(key, vec![]).await?;
}
// Carry on
Ok(())