Closed quinchs closed 2 years ago
Also- Maybe we should add a more DX-appealing approach to adding a multi link value rather than a STDLib func without having to make the user wrap a custom type for link properties...
Achieving this might come in IL parsing as we can use Func<T>
instead of expressions, allowing for this kind of API
await QueryBuilder
.Update<User>(user=>
{
user.SchemaHistory.Add(QueryBuilder.Insert(migration, false))
})
.Filter(x => x.UserId == id)
.ExecuteAsync(_edgedb, token: token);
Where the Add
method can be an extension method:
public static void Add<TCollection, TQueryElement>(this TCollection col, IQuery<TQueryElement> query)
where TCollection : IEnumerable<TQueryElement>
{
// impl
}
Ah the possibilities of parsing machine code, maybe the dotnet team can update the Expression
api to be more feature complete? in either case IL parsing is on the todo so this should be ultimately resolved once the parser is written and Func<T>
is the norm
Summary
Seems like the member init translator has decided to break the EdgeQL syntax rules again.. 🤷🏻
Standard libs funcs with contextual assignment operators (+=, -=, etc) NEED to preserve their set operators, which when I rewrote the init translator, got left out of the new link path.
Exception
QueryBuilder code: