Add support for accessing nested fields inside Future computed values

Closes #1261
This commit is contained in:
Tobie Morgan Hitchcock 2022-10-31 23:15:08 +00:00
parent 426fce00a8
commit 4411b4d71f

View file

@ -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