diff --git a/Sources/StructuredQueriesCore/PrimaryKeyed.swift b/Sources/StructuredQueriesCore/PrimaryKeyed.swift index 1adfb037..847d91ee 100644 --- a/Sources/StructuredQueriesCore/PrimaryKeyed.swift +++ b/Sources/StructuredQueriesCore/PrimaryKeyed.swift @@ -81,8 +81,10 @@ extension PrimaryKeyedTable { /// /// - Parameter primaryKey: A primary key identifying a table row. /// - Returns: A `WHERE` clause. - public static func find(_ primaryKey: TableColumns.PrimaryKey.QueryOutput) -> Where { - Self.where { $0.primaryKey.eq(TableColumns.PrimaryKey(queryOutput: primaryKey)) } + public static func find( + _ primaryKey: some QueryExpression + ) -> Where { + Self.where { $0.primaryKey.eq(primaryKey) } } } @@ -92,12 +94,10 @@ extension TableDraft { /// - Parameter primaryKey: A primary key identifying a table row. /// - Returns: A `WHERE` clause. public static func find( - _ primaryKey: PrimaryTable.TableColumns.PrimaryKey.QueryOutput + _ primaryKey: some QueryExpression ) -> Where { Self.where { _ in - PrimaryTable.columns.primaryKey.eq( - PrimaryTable.TableColumns.PrimaryKey(queryOutput: primaryKey) - ) + PrimaryTable.columns.primaryKey.eq(primaryKey) } } } @@ -107,8 +107,8 @@ extension Where where From: PrimaryKeyedTable { /// /// - Parameter primaryKey: A primary key. /// - Returns: A where clause with the added primary key. - public func find(_ primaryKey: From.TableColumns.PrimaryKey.QueryOutput) -> Self { - self.where { $0.primaryKey.eq(From.TableColumns.PrimaryKey(queryOutput: primaryKey)) } + public func find(_ primaryKey: some QueryExpression) -> Self { + self.where { $0.primaryKey.eq(primaryKey) } } } @@ -131,7 +131,7 @@ extension Select where From: PrimaryKeyedTable { /// /// - Parameter primaryKey: A primary key identifying a table row. /// - Returns: A select statement filtered by the given key. - public func find(_ primaryKey: From.TableColumns.PrimaryKey.QueryOutput) -> Self { + public func find(_ primaryKey: some QueryExpression) -> Self { self.and(From.find(primaryKey)) } } @@ -141,7 +141,9 @@ extension Select where From: TableDraft { /// /// - Parameter primaryKey: A primary key identifying a table row. /// - Returns: A select statement filtered by the given key. - public func find(_ primaryKey: From.PrimaryTable.TableColumns.PrimaryKey.QueryOutput) -> Self { + public func find( + _ primaryKey: some QueryExpression + ) -> Self { self.and(From.find(primaryKey)) } } @@ -151,8 +153,8 @@ extension Update where From: PrimaryKeyedTable { /// /// - Parameter primaryKey: A primary key identifying a table row. /// - Returns: An update statement filtered by the given key. - public func find(_ primaryKey: From.TableColumns.PrimaryKey.QueryOutput) -> Self { - self.where { $0.primaryKey.eq(From.TableColumns.PrimaryKey(queryOutput: primaryKey)) } + public func find(_ primaryKey: some QueryExpression) -> Self { + self.where { $0.primaryKey.eq(primaryKey) } } } @@ -175,8 +177,8 @@ extension Delete where From: PrimaryKeyedTable { /// /// - Parameter primaryKey: A primary key identifying a table row. /// - Returns: A delete statement filtered by the given key. - public func find(_ primaryKey: From.TableColumns.PrimaryKey.QueryOutput) -> Self { - self.where { $0.primaryKey.eq(From.TableColumns.PrimaryKey(queryOutput: primaryKey)) } + public func find(_ primaryKey: some QueryExpression) -> Self { + self.where { $0.primaryKey.eq(primaryKey) } } }