From 6c10cd195f0f735d45cf48509cc699531e9e6a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Rou=C3=A9?= Date: Fri, 1 Dec 2023 09:29:33 +0100 Subject: [PATCH] Make Value an associated type of Queryable This makes it possible to derive sub-protocols of Queryable --- Sources/GRDBQuery/Queryable.swift | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Sources/GRDBQuery/Queryable.swift b/Sources/GRDBQuery/Queryable.swift index e54e62c..604e14b 100644 --- a/Sources/GRDBQuery/Queryable.swift +++ b/Sources/GRDBQuery/Queryable.swift @@ -2,6 +2,9 @@ import Combine // See Documentation.docc/Extensions/Queryable.md public protocol Queryable: Equatable { + /// The type of the published values. + associatedtype Value + /// The type that provides database access. /// /// Any type can fit, as long as the `Queryable` type can build a Combine @@ -14,7 +17,7 @@ public protocol Queryable: Equatable { /// The type of the Combine publisher of database values, returned /// from ``publisher(in:)``. - associatedtype ValuePublisher: Publisher + associatedtype ValuePublisher: Publisher where ValuePublisher.Output == Value /// The default value, used until the Combine publisher publishes its /// initial value. @@ -28,8 +31,3 @@ public protocol Queryable: Equatable { /// - parameter database: Provides access to the database. func publisher(in database: DatabaseContext) -> ValuePublisher } - -extension Queryable { - /// The type of the published values. - public typealias Value = ValuePublisher.Output -}