Check the context before processing values
This commit is contained in:
parent
50e026f859
commit
10c0b5c732
2 changed files with 32 additions and 24 deletions
|
@ -21,12 +21,14 @@ impl Value {
|
|||
txn: Transaction,
|
||||
chn: UnboundedSender<(Option<Thing>, Value)>,
|
||||
) -> Result<(), Error> {
|
||||
match self {
|
||||
Value::Array(v) => v.process(&ctx, &opt, &txn, &chn).await?,
|
||||
Value::Model(v) => v.process(&ctx, &opt, &txn, &chn).await?,
|
||||
Value::Thing(v) => v.process(&ctx, &opt, &txn, &chn).await?,
|
||||
Value::Table(v) => v.process(&ctx, &opt, &txn, &chn).await?,
|
||||
v => chn.send((None, v))?,
|
||||
if ctx.is_ok() {
|
||||
match self {
|
||||
Value::Array(v) => v.process(&ctx, &opt, &txn, &chn).await?,
|
||||
Value::Model(v) => v.process(&ctx, &opt, &txn, &chn).await?,
|
||||
Value::Thing(v) => v.process(&ctx, &opt, &txn, &chn).await?,
|
||||
Value::Table(v) => v.process(&ctx, &opt, &txn, &chn).await?,
|
||||
v => chn.send((None, v))?,
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -42,12 +44,14 @@ impl Array {
|
|||
chn: &UnboundedSender<(Option<Thing>, Value)>,
|
||||
) -> Result<(), Error> {
|
||||
for v in self.value.into_iter() {
|
||||
match v {
|
||||
Value::Array(v) => v.process(ctx, opt, txn, chn).await?,
|
||||
Value::Model(v) => v.process(ctx, opt, txn, chn).await?,
|
||||
Value::Thing(v) => v.process(ctx, opt, txn, chn).await?,
|
||||
Value::Table(v) => v.process(ctx, opt, txn, chn).await?,
|
||||
v => chn.send((None, v))?,
|
||||
if ctx.is_ok() {
|
||||
match v {
|
||||
Value::Array(v) => v.process(ctx, opt, txn, chn).await?,
|
||||
Value::Model(v) => v.process(ctx, opt, txn, chn).await?,
|
||||
Value::Thing(v) => v.process(ctx, opt, txn, chn).await?,
|
||||
Value::Table(v) => v.process(ctx, opt, txn, chn).await?,
|
||||
v => chn.send((None, v))?,
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -23,12 +23,14 @@ impl Value {
|
|||
txn: &Transaction,
|
||||
ite: &mut Iterator<'_>,
|
||||
) -> Result<(), Error> {
|
||||
match self {
|
||||
Value::Array(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Model(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Thing(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Table(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
v => ite.process(ctx, opt, txn, None, v).await,
|
||||
if ctx.is_ok() {
|
||||
match self {
|
||||
Value::Array(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Model(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Thing(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Table(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
v => ite.process(ctx, opt, txn, None, v).await,
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -45,12 +47,14 @@ impl Array {
|
|||
ite: &mut Iterator<'_>,
|
||||
) -> Result<(), Error> {
|
||||
for v in self.value.into_iter() {
|
||||
match v {
|
||||
Value::Array(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Model(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Thing(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Table(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
v => ite.process(ctx, opt, txn, None, v).await,
|
||||
if ctx.is_ok() {
|
||||
match v {
|
||||
Value::Array(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Model(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Thing(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
Value::Table(v) => v.iterate(ctx, opt, txn, ite).await?,
|
||||
v => ite.process(ctx, opt, txn, None, v).await,
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue