Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions Sources/YData/Core/Client.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Foundation

public protocol ClientContext: EventLoopContext, LoggerContext {}

public protocol Client {
associatedtype Context: ClientContext

var context: Context { get }
}
1 change: 0 additions & 1 deletion Sources/YData/Core/Service.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Vapor

public protocol ServiceContext: EventLoopContext, LoggerContext {}

Expand Down
7 changes: 7 additions & 0 deletions Sources/YData/Database/DatabaseClient.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Foundation

public protocol DatabaseClient {
associatedtype Context: DatabaseClientContext

var context: Context { get }
}
6 changes: 6 additions & 0 deletions Sources/YData/Database/DatabaseClientContext.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Fluent
import Foundation

public protocol DatabaseClientContext {
var database: Database { get }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Fluent
import Foundation
import Vapor

extension Application: DatabaseClientContext {
public var database: Database { db }
}
3 changes: 3 additions & 0 deletions Sources/YData/Extensions/Range.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Foundation


Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Fluent
import Foundation
import Vapor

extension Request: DatabaseClientContext {}
5 changes: 5 additions & 0 deletions Sources/YData/Extensions/String+NSRange.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public extension String {
var nsRange: NSRange { NSRange(startIndex..<endIndex, in: self) }
}