surrealpatch/lib/src/sql/value/def.rs

23 lines
497 B
Rust
Raw Normal View History

use crate::ctx::Context;
use crate::dbs::Options;
use crate::dbs::Transaction;
use crate::err::Error;
use crate::sql::part::Part;
use crate::sql::thing::Thing;
use crate::sql::value::Value;
use once_cell::sync::Lazy;
static ID: Lazy<[Part; 1]> = Lazy::new(|| [Part::from("id")]);
impl Value {
pub async fn def(
&mut self,
ctx: &Context<'_>,
opt: &Options,
txn: &Transaction,
2022-04-01 10:17:19 +00:00
val: &Thing,
) -> Result<(), Error> {
self.set(ctx, opt, txn, ID.as_ref(), val.clone().into()).await
}
}