Use Value::base() as the default record value

This commit is contained in:
Tobie Morgan Hitchcock 2022-02-09 08:23:14 +00:00
parent be7f22e35b
commit 5e0e144acb
2 changed files with 2 additions and 4 deletions

View file

@ -2,7 +2,6 @@ use crate::dbs::Executor;
use crate::dbs::Options; use crate::dbs::Options;
use crate::dbs::Runtime; use crate::dbs::Runtime;
use crate::err::Error; use crate::err::Error;
use crate::sql::object::Object;
use crate::sql::value::Value; use crate::sql::value::Value;
impl Value { impl Value {
@ -12,7 +11,7 @@ impl Value {
_opt: &Options, _opt: &Options,
_exe: &Executor<'_>, _exe: &Executor<'_>,
) -> Result<(), Error> { ) -> Result<(), Error> {
*self = Value::from(Object::default()); *self = Value::base();
Ok(()) Ok(())
} }
} }

View file

@ -3,7 +3,6 @@ use crate::dbs::Options;
use crate::dbs::Runtime; use crate::dbs::Runtime;
use crate::err::Error; use crate::err::Error;
use crate::sql::idiom::Idiom; use crate::sql::idiom::Idiom;
use crate::sql::object::Object;
use crate::sql::part::Part; use crate::sql::part::Part;
use crate::sql::value::Value; use crate::sql::value::Value;
use async_recursion::async_recursion; use async_recursion::async_recursion;
@ -27,7 +26,7 @@ impl Value {
Part::Field(p) => match v.value.get_mut(&p.name) { Part::Field(p) => match v.value.get_mut(&p.name) {
Some(v) if v.is_some() => v.set(ctx, opt, exe, &path.next(), val).await, Some(v) if v.is_some() => v.set(ctx, opt, exe, &path.next(), val).await,
_ => { _ => {
let mut obj = Value::from(Object::default()); let mut obj = Value::base();
obj.set(ctx, opt, exe, &path.next(), val).await?; obj.set(ctx, opt, exe, &path.next(), val).await?;
v.insert(&p.name, obj); v.insert(&p.name, obj);
Ok(()) Ok(())