Skip to content

Commit

Permalink
Add overloads for adding/removing sets for update
Browse files Browse the repository at this point in the history
  • Loading branch information
Quin Lynch committed Apr 26, 2024
1 parent 8bb87b7 commit 0df0c61
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/EdgeDB.Net.QueryBuilder/Builders/UpdateShapeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,24 @@ public UpdateShapeBuilder<T, U> Add<V>(Expression<Func<T, IEnumerable<V>?>> sele
public UpdateShapeBuilder<T, U> Add<V>(Expression<Func<T, IEnumerable<V>?>> selector, Expression<Func<T, V>> value)
=> AddElement(selector, value, ExpressionType.AddAssign);

public UpdateShapeBuilder<T, U> Add<V>(Expression<Func<T, IEnumerable<V>?>> selector,
Expression<Func<T, IEnumerable<V>>> value)
=> AddElement(selector, value, ExpressionType.AddAssign);

public UpdateShapeBuilder<T, U> Add<V>(Expression<Func<T, IEnumerable<V>?>> selector,
Expression<Func<T, U, IEnumerable<V>>> value)
=> AddElement(selector, value, ExpressionType.AddAssign);

public UpdateShapeBuilder<T, U> Remove<V>(Expression<Func<T, IEnumerable<V>?>> selector, Expression<Func<T, U, V>> value)
=> AddElement(selector, value, ExpressionType.SubtractAssign);
public UpdateShapeBuilder<T, U> Remove<V>(Expression<Func<T, IEnumerable<V>?>> selector, Expression<Func<T, V>> value)
=> AddElement(selector, value, ExpressionType.SubtractAssign);

public UpdateShapeBuilder<T, U> Remove<V>(Expression<Func<T, IEnumerable<V>?>> selector, Expression<Func<T, U, IEnumerable<V>>> value)
=> AddElement(selector, value, ExpressionType.SubtractAssign);
public UpdateShapeBuilder<T, U> Remove<V>(Expression<Func<T, IEnumerable<V>?>> selector, Expression<Func<T, IEnumerable<V>>> value)
=> AddElement(selector, value, ExpressionType.SubtractAssign);

private UpdateShapeBuilder<T, U> AddElement(LambdaExpression selector, LambdaExpression value, ExpressionType type)
{
var key = ExpressionUtils.GetMemberSelection(selector);
Expand Down

0 comments on commit 0df0c61

Please sign in to comment.