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