-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
c92029e
commit 87c66ff
Showing
2 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
Sources/GraphZahl/Resolution/OutputResolvable/DelegatedOutputResolvable.swift
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,52 @@ | ||
|
||
import Foundation | ||
import ContextKit | ||
import NIO | ||
import GraphQL | ||
|
||
protocol DelegatedOutputResolvable: OutputResolvable { | ||
associatedtype Output: OutputResolvable | ||
|
||
func resolve(source: Any, | ||
arguments: [String : Map], | ||
context: MutableContext, | ||
eventLoop: EventLoopGroup) throws -> Output | ||
} | ||
|
||
extension DelegatedOutputResolvable { | ||
|
||
/** | ||
- Warning: default implementation from `GraphZahl`. Do not override unless you know exactly what you are doing. | ||
*/ | ||
public static var additionalArguments: [String : InputResolvable.Type] { | ||
return Output.additionalArguments | ||
} | ||
|
||
/** | ||
- Warning: default implementation from `GraphZahl`. Do not override unless you know exactly what you are doing. | ||
*/ | ||
public static func reference(using context: inout Resolution.Context) throws -> GraphQLOutputType { | ||
return try context.reference(for: Output.self) | ||
} | ||
|
||
/** | ||
- Warning: default implementation from `GraphZahl`. Do not override unless you know exactly what you are doing. | ||
*/ | ||
public static func resolve(using context: inout Resolution.Context) throws -> GraphQLOutputType { | ||
return try context.resolve(type: Output.self) | ||
} | ||
|
||
/** | ||
- Warning: default implementation from `GraphZahl`. Do not override unless you know exactly what you are doing. | ||
*/ | ||
public func resolve(source: Any, | ||
arguments: [String : Map], | ||
context: MutableContext, | ||
eventLoop: EventLoopGroup) throws -> EventLoopFuture<Any?> { | ||
|
||
return try resolve(source: source, arguments: arguments, context: context, eventLoop: eventLoop) | ||
.resolve(source: source, arguments: arguments, context: context, eventLoop: eventLoop) | ||
} | ||
|
||
|
||
} |
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