-
-
Notifications
You must be signed in to change notification settings - Fork 756
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ceeb66
commit 866fdd3
Showing
35 changed files
with
1,011 additions
and
145 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/HotChocolate/Core/src/Execution/Processing/EmptySelectionCollection.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,39 @@ | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using HotChocolate.Resolvers; | ||
|
||
namespace HotChocolate.Execution.Processing; | ||
|
||
internal sealed class EmptySelectionCollection : ISelectionCollection | ||
{ | ||
private static readonly ISelection[] _empty = Array.Empty<ISelection>(); | ||
|
||
public static EmptySelectionCollection Instance { get; } = new(); | ||
|
||
public int Count => 0; | ||
|
||
public ISelection this[int index] => throw new IndexOutOfRangeException(); | ||
|
||
public ISelectionCollection Select(string fieldName) | ||
=> Instance; | ||
|
||
public bool IsSelected(string fieldName) | ||
=> false; | ||
|
||
public bool IsSelected(string fieldName1, string fieldName2) | ||
=> false; | ||
|
||
public bool IsSelected(string fieldName1, string fieldName2, string fieldName3) | ||
=> false; | ||
|
||
public bool IsSelected(ISet<string> fieldNames) | ||
=> false; | ||
|
||
public IEnumerator<ISelection> GetEnumerator() | ||
=> _empty.AsEnumerable().GetEnumerator(); | ||
|
||
IEnumerator IEnumerable.GetEnumerator() | ||
=> GetEnumerator(); | ||
} |
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
Oops, something went wrong.