From 4411b4d71f1aec24137244941f7aa8043a26a57e Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 31 Oct 2022 23:15:08 +0000 Subject: [PATCH] Add support for accessing nested fields inside Future computed values Closes #1261 --- lib/src/sql/value/get.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/src/sql/value/get.rs b/lib/src/sql/value/get.rs index 72e28800..bf889e55 100644 --- a/lib/src/sql/value/get.rs +++ b/lib/src/sql/value/get.rs @@ -27,6 +27,16 @@ impl Value { match path.first() { // Get the current path part Some(p) => match self { + // Current path part is an object + Value::Future(v) => { + // Check how many path parts are remaining + match path.len() { + // No further embedded fields, so just return this + 0 => Ok(Value::Future(v.clone())), + // + _ => v.compute(ctx, opt, txn, None).await?.get(ctx, opt, txn, path).await, + } + } // Current path part is an object Value::Object(v) => match p { // If requesting an `id` field, check if it is a complex Record ID