-
-
Notifications
You must be signed in to change notification settings - Fork 749
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added DataLoader group generator. (#7528)
(cherry picked from commit c174e86)
- Loading branch information
1 parent
6bb769c
commit b7c55f5
Showing
13 changed files
with
440 additions
and
10 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/GreenDonut/src/Core/Attributes/DataLoaderGroupAttribute.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,20 @@ | ||
namespace GreenDonut; | ||
|
||
/// <summary> | ||
/// Allows to group multiple DataLoaders together into a context class | ||
/// that can be used to inject multiple DataLoader at once into classes. | ||
/// </summary> | ||
/// <param name="groupNames"> | ||
/// The group names that are used to group multiple DataLoaders together. | ||
/// </param> | ||
[AttributeUsage( | ||
AttributeTargets.Method | ||
| AttributeTargets.Class, | ||
AllowMultiple = true)] | ||
public class DataLoaderGroupAttribute(params string[] groupNames) : Attribute | ||
{ | ||
/// <summary> | ||
/// Gets the group names that are used to group multiple DataLoaders together. | ||
/// </summary> | ||
public string[] GroupNames { get; } = groupNames; | ||
} |
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
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
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
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
20 changes: 20 additions & 0 deletions
20
src/HotChocolate/Core/src/Types.Analyzers/Models/GroupedDataLoaderInfo.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,20 @@ | ||
namespace HotChocolate.Types.Analyzers.FileBuilders; | ||
|
||
public class GroupedDataLoaderInfo | ||
{ | ||
public GroupedDataLoaderInfo(string name, string interfaceName, bool isPublic) | ||
{ | ||
Name = name; | ||
InterfaceName = interfaceName; | ||
IsPublic = isPublic; | ||
FieldName = "_" + name.Substring(0, 1).ToLowerInvariant() + name.Substring(1); | ||
} | ||
|
||
public string Name { get; } | ||
|
||
public string InterfaceName { get; } | ||
|
||
public string FieldName { get; } | ||
|
||
public bool IsPublic { get; } | ||
} |
Oops, something went wrong.