Complex objects in WITH statements
quinchs opened this issue · comments
Quin Lynch commented
Summary
With the insane power of using json within the edgeql standard library, we can allow any arbitrary object to be included in a WITH
statement and access any property on it using json.
Example
var data = new { Name = "example", Email = "example@example.com" };
QueryBuilder
.With(new { MyObject = EdgeQL.AsJson(data) })
.Insert(ctx => new Person { Name = ctx.Variables.MyObject.Value.Name, Email = ctx.Variables.MyObject.Value.Email});
The Member translator can be adapted to add json_get
paths for any occurrence of IJsonVariable
(returned from EdgeQL.AsJson
) allowing ease of use with complex parameters within WITH
blocks.