Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove params keywords from inner GremlinQuery methods #1926

Merged
merged 3 commits into from
Mar 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions src/Core/Queries/GremlinQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ private TTargetQuery Choose<TTargetQuery>(Func<IChooseBuilder<GremlinQuery<T1, T
return continuation(new ChooseBuilder<GremlinQuery<T1, T2, T3, T4>, object>(this)).TargetQuery;
}

private TReturnQuery Coalesce<TTargetQuery, TReturnQuery>(params Func<GremlinQuery<T1, T2, T3, T4>, TTargetQuery>[] continuations)
private TReturnQuery Coalesce<TTargetQuery, TReturnQuery>(Func<GremlinQuery<T1, T2, T3, T4>, TTargetQuery>[] continuations)
where TTargetQuery : IGremlinQueryBase
where TReturnQuery : IGremlinQueryBase => this
.Continue()
Expand Down Expand Up @@ -546,14 +546,14 @@ private GremlinQuery<T1, T2, T3, T4> Coin(double probability) => this
.AddStep(new CoinStep(probability)),
probability);

private GremlinQuery<T1, T2, T3, T4> Concat(params string[] strings) => this
private GremlinQuery<T1, T2, T3, T4> Concat(string[] strings) => this
.Continue()
.Build(
static (builder, strings) => builder
.AddStep(new ConcatStringsStep(strings.ToImmutableArray())),
strings);

private GremlinQuery<T1, T2, T3, T4> Concat(params Func<IStringGremlinQuery<T1>, IGremlinQueryBase<T1>>[] stringTraversals) => this
private GremlinQuery<T1, T2, T3, T4> Concat(Func<IStringGremlinQuery<T1>, IGremlinQueryBase<T1>>[] stringTraversals) => this
.Continue()
.With(stringTraversals)
.Build(static (builder, stringTraversals) => builder
Expand Down Expand Up @@ -1117,7 +1117,7 @@ private IMapGremlinQuery<TResult> Project<TResult>(Func<IProjectBuilder<GremlinQ
.Build();
}

private GremlinQuery<TNewElement, TNewPropertyValue, TNewMeta, IGremlinQueryBase> Properties<TNewElement, TNewPropertyValue, TNewMeta>(Projection projection, params Expression[] projections) => Properties<TNewElement, TNewPropertyValue, TNewMeta>(
private GremlinQuery<TNewElement, TNewPropertyValue, TNewMeta, IGremlinQueryBase> Properties<TNewElement, TNewPropertyValue, TNewMeta>(Projection projection, Expression[] projections) => Properties<TNewElement, TNewPropertyValue, TNewMeta>(
projection,
projections
.Select(projection => GetKey(projection).RawKey)
Expand Down Expand Up @@ -1210,23 +1210,14 @@ private TNewQuery Select<TNewQuery>(StepLabel stepLabel) where TNewQuery : IGrem
.As<TNewQuery>(),
(stepLabel, stepLabelProjection: GetLabelProjection(stepLabel)));

private TTargetQuery Select<TTargetQuery>(params Expression[] projections) where TTargetQuery : IGremlinQueryBase => this
private TTargetQuery Select<TTargetQuery>(Expression expression) where TTargetQuery : IGremlinQueryBase => this
.Continue()
.Build(
static (builder, projections) =>
static (builder, expression) =>
{
var keys = projections
.Select(static expression =>
{
if (expression is LambdaExpression { Parameters: [var singleParameter], Body: { } lambdaBody } && lambdaBody.IsIndexerGet(out var target, out var indexerArgument) && target == singleParameter)
{
if (indexerArgument.GetValue() is string indexerArgumentValue)
return indexerArgumentValue;
}

return (Key)expression.AssumePropertyOrFieldMemberExpression().Member.Name;
})
.ToImmutableArray();
var keys = ImmutableArray.Create(expression is LambdaExpression { Parameters: [var singleParameter], Body: { } lambdaBody } && lambdaBody.IsIndexerGet(out var target, out var indexerArgument) && target == singleParameter && indexerArgument.GetValue() is string indexerArgumentValue
? indexerArgumentValue
: (Key)expression.AssumePropertyOrFieldMemberExpression().Member.Name);

return builder
.AddStep(new SelectKeysStep(keys))
Expand All @@ -1235,7 +1226,7 @@ private TTargetQuery Select<TTargetQuery>(params Expression[] projections) where
keys)
.As<TTargetQuery>();
},
projections);
expression);

private GremlinQuery<T1, T2, T3, T4> SideEffect(Func<GremlinQuery<T1, T2, T3, T4>, IGremlinQueryBase> sideEffectContinuation) => this
.Continue()
Expand Down Expand Up @@ -1328,11 +1319,10 @@ private GremlinQuery<T1, T2, T3, T4> Unfold() => this

private TTargetQuery Unfold<TTargetQuery>() => Unfold().CloneAs<TTargetQuery>();

private TTargetQuery Union<TTargetQuery>(params Func<GremlinQuery<T1, T2, T3, T4>, TTargetQuery>[] unionTraversals)
where TTargetQuery : IGremlinQueryBase =>
Union<TTargetQuery, TTargetQuery>(unionTraversals);
private TTargetQuery Union<TTargetQuery>(Func<GremlinQuery<T1, T2, T3, T4>, TTargetQuery>[] unionTraversals)
where TTargetQuery : IGremlinQueryBase => Union<TTargetQuery, TTargetQuery>(unionTraversals);

private TReturnQuery Union<TTargetQuery, TReturnQuery>(params Func<GremlinQuery<T1, T2, T3, T4>, TTargetQuery>[] unionContinuations)
private TReturnQuery Union<TTargetQuery, TReturnQuery>(Func<GremlinQuery<T1, T2, T3, T4>, TTargetQuery>[] unionContinuations)
where TTargetQuery : IGremlinQueryBase
where TReturnQuery : IGremlinQueryBase => this
.Continue()
Expand Down
Loading