Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrated projections into new configuration API
- Loading branch information
1 parent
baef95e
commit 014784c
Showing
13 changed files
with
126 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldDescriptorExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 0 additions & 23 deletions
23
src/HotChocolate/Data/src/Data/Filters/Extensions/FilterFieldExtensions.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...ers/Extensions/SchemaBuilderExtensions.cs → ...tensions/FilterSchemaBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/HotChocolate/Data/src/Data/Filters/Types/ComparableOperationFilterInput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System.Collections.Generic; | ||
using HotChocolate.Types; | ||
|
||
namespace HotChocolate.Data.Filters | ||
{ | ||
|
1 change: 1 addition & 0 deletions
1
src/HotChocolate/Data/src/Data/Filters/Types/EnumOperationFilterInput.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System.Collections.Generic; | ||
using HotChocolate.Types; | ||
|
||
namespace HotChocolate.Data.Filters | ||
{ | ||
|
5 changes: 3 additions & 2 deletions
5
...ons/Extensions/SchemaBuilderExtensions.cs → ...ons/ProjectionsSchemaBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/HotChocolate/Data/src/Data/Projections/ProjectionOptimizer.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System.Collections.Generic; | ||
using HotChocolate.Execution.Processing; | ||
using HotChocolate.Language; | ||
|
||
namespace HotChocolate.Data.Projections | ||
{ | ||
public class ProjectionOptimizer : ISelectionOptimizer | ||
{ | ||
private readonly IProjectionProvider _convention; | ||
|
||
public ProjectionOptimizer( | ||
IProjectionProvider convention) | ||
{ | ||
_convention = convention; | ||
} | ||
|
||
public void OptimizeSelectionSet(SelectionOptimizerContext context) | ||
{ | ||
var processedFields = new HashSet<string>(); | ||
while (!processedFields.SetEquals(context.Fields.Keys)) | ||
{ | ||
var fieldsToProcess = new HashSet<string>(context.Fields.Keys); | ||
fieldsToProcess.ExceptWith(processedFields); | ||
foreach (var field in fieldsToProcess) | ||
{ | ||
context.Fields[field] = | ||
_convention.RewriteSelection(context, context.Fields[field]); | ||
processedFields.Add(field); | ||
} | ||
} | ||
} | ||
|
||
public bool AllowFragmentDeferral( | ||
SelectionOptimizerContext context, | ||
InlineFragmentNode fragment) | ||
{ | ||
return false; | ||
} | ||
|
||
public bool AllowFragmentDeferral( | ||
SelectionOptimizerContext context, | ||
FragmentSpreadNode fragmentSpread, | ||
FragmentDefinitionNode fragmentDefinition) | ||
{ | ||
return false; | ||
} | ||
} | ||
} |
24 changes: 0 additions & 24 deletions
24
src/HotChocolate/Data/src/Data/Sorting/Extensions/SortFieldExtensions.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 3 additions & 2 deletions
5
...ing/Extensions/SchemaBuilderExtensions.cs → ...ensions/SortingSchemaBuilderExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters