2022-05-14 12:35:08 +00:00
|
|
|
use crate::ctx::Context;
|
2024-05-28 10:43:45 +00:00
|
|
|
use crate::dbs::Options;
|
2022-02-06 01:14:56 +00:00
|
|
|
use crate::dbs::Statement;
|
|
|
|
use crate::doc::Document;
|
|
|
|
use crate::err::Error;
|
|
|
|
use crate::sql::value::Value;
|
2024-04-18 15:51:47 +00:00
|
|
|
use reblessive::tree::Stk;
|
2022-01-13 07:00:50 +00:00
|
|
|
|
2024-08-15 16:01:02 +00:00
|
|
|
impl Document {
|
2022-02-06 01:14:56 +00:00
|
|
|
pub async fn create(
|
|
|
|
&mut self,
|
2024-04-18 15:51:47 +00:00
|
|
|
stk: &mut Stk,
|
2024-08-15 16:01:02 +00:00
|
|
|
ctx: &Context,
|
2022-02-06 21:06:52 +00:00
|
|
|
opt: &Options,
|
2022-05-13 20:46:56 +00:00
|
|
|
stm: &Statement<'_>,
|
2022-02-06 01:14:56 +00:00
|
|
|
) -> Result<Value, Error> {
|
2024-08-15 16:01:02 +00:00
|
|
|
// Check if table has current relation status
|
2024-05-28 10:43:45 +00:00
|
|
|
self.relation(ctx, opt, stm).await?;
|
2022-05-30 15:32:26 +00:00
|
|
|
// Alter record data
|
2024-05-28 10:43:45 +00:00
|
|
|
self.alter(stk, ctx, opt, stm).await?;
|
2022-04-04 22:26:54 +00:00
|
|
|
// Merge fields data
|
2024-05-28 10:43:45 +00:00
|
|
|
self.field(stk, ctx, opt, stm).await?;
|
2023-03-30 18:30:46 +00:00
|
|
|
// Reset fields data
|
2024-05-28 10:43:45 +00:00
|
|
|
self.reset(ctx, opt, stm).await?;
|
2022-07-04 16:54:43 +00:00
|
|
|
// Clean fields data
|
2024-05-28 10:43:45 +00:00
|
|
|
self.clean(stk, ctx, opt, stm).await?;
|
2022-02-06 01:14:56 +00:00
|
|
|
// Check if allowed
|
2024-05-28 10:43:45 +00:00
|
|
|
self.allow(stk, ctx, opt, stm).await?;
|
2022-02-06 01:14:56 +00:00
|
|
|
// Store record data
|
2024-05-28 10:43:45 +00:00
|
|
|
self.store(ctx, opt, stm).await?;
|
2023-11-20 18:13:34 +00:00
|
|
|
// Store index data
|
2024-05-28 10:43:45 +00:00
|
|
|
self.index(stk, ctx, opt, stm).await?;
|
2022-02-06 01:14:56 +00:00
|
|
|
// Run table queries
|
2024-05-28 10:43:45 +00:00
|
|
|
self.table(stk, ctx, opt, stm).await?;
|
2022-02-06 01:14:56 +00:00
|
|
|
// Run lives queries
|
2024-05-28 10:43:45 +00:00
|
|
|
self.lives(stk, ctx, opt, stm).await?;
|
2023-07-24 16:15:20 +00:00
|
|
|
// Run change feeds queries
|
2024-05-28 10:43:45 +00:00
|
|
|
self.changefeeds(ctx, opt, stm).await?;
|
2022-02-06 01:14:56 +00:00
|
|
|
// Run event queries
|
2024-05-28 10:43:45 +00:00
|
|
|
self.event(stk, ctx, opt, stm).await?;
|
2022-02-06 01:14:56 +00:00
|
|
|
// Yield document
|
2024-05-28 10:43:45 +00:00
|
|
|
self.pluck(stk, ctx, opt, stm).await
|
2022-02-06 01:14:56 +00:00
|
|
|
}
|
|
|
|
}
|