Don’t set meta field on records
This commit is contained in:
parent
41c44ea709
commit
bf1a833a79
2 changed files with 6 additions and 18 deletions
|
@ -16,10 +16,10 @@ impl<'a> Document<'a> {
|
|||
txn: &Transaction,
|
||||
stm: &Statement,
|
||||
) -> Result<(), Error> {
|
||||
// Get the ID reference
|
||||
let id = self.id.as_ref();
|
||||
// Get the record id
|
||||
let rid = self.id.as_ref().unwrap();
|
||||
// Set default field values
|
||||
self.current.to_mut().def(ctx, opt, txn, id).await?;
|
||||
self.current.to_mut().def(ctx, opt, txn, rid).await?;
|
||||
// The statement has a data clause
|
||||
if let Some(v) = stm.data() {
|
||||
match v {
|
||||
|
@ -55,7 +55,7 @@ impl<'a> Document<'a> {
|
|||
};
|
||||
};
|
||||
// Set default field values
|
||||
self.current.to_mut().def(ctx, opt, txn, id).await?;
|
||||
self.current.to_mut().def(ctx, opt, txn, rid).await?;
|
||||
// Carry on
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@ use crate::sql::value::Value;
|
|||
use once_cell::sync::Lazy;
|
||||
|
||||
static RID: Lazy<[Part; 1]> = Lazy::new(|| [Part::from("id")]);
|
||||
static MTB: Lazy<[Part; 2]> = Lazy::new(|| [Part::from("meta"), Part::from("tb")]);
|
||||
static MID: Lazy<[Part; 2]> = Lazy::new(|| [Part::from("meta"), Part::from("id")]);
|
||||
|
||||
impl Value {
|
||||
pub async fn def(
|
||||
|
@ -17,18 +15,8 @@ impl Value {
|
|||
ctx: &Runtime,
|
||||
opt: &Options,
|
||||
txn: &Transaction,
|
||||
val: Option<&Thing>,
|
||||
val: &Thing,
|
||||
) -> Result<(), Error> {
|
||||
match val {
|
||||
Some(id) => {
|
||||
let id = id.clone();
|
||||
let md = id.clone();
|
||||
self.set(ctx, opt, txn, RID.as_ref(), id.into()).await?;
|
||||
self.set(ctx, opt, txn, MTB.as_ref(), md.tb.into()).await?;
|
||||
self.set(ctx, opt, txn, MID.as_ref(), md.id.into()).await?;
|
||||
Ok(())
|
||||
}
|
||||
None => unreachable!(),
|
||||
}
|
||||
self.set(ctx, opt, txn, RID.as_ref(), val.clone().into()).await
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue