File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Sources/StructuredQueriesCore/Statements Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1140,6 +1140,37 @@ extension Select {
11401140 return select
11411141 }
11421142
1143+ /// Creates a new select statement from this one by appending a predicate to its `WHERE` clause.
1144+ ///
1145+ /// - Parameter predicate: A closure that produces a Boolean query expression from this select's
1146+ /// tables with a single join.
1147+ /// - Returns: A new select statement that appends the given predicate to its `WHERE` clause.
1148+ public func `where`(
1149+ _ predicate: ( From . TableColumns , Joins . TableColumns ) -> some QueryExpression <
1150+ some _OptionalPromotable < Bool ? >
1151+ >
1152+ ) -> Self
1153+ where Joins: Table {
1154+ var select = self
1155+ select. where. append ( predicate ( From . columns, Joins . columns) . queryFragment)
1156+ return select
1157+ }
1158+
1159+ /// Creates a new select statement from this one by appending a predicate to its `WHERE` clause.
1160+ ///
1161+ /// - Parameter predicate: A result builder closure that returns a Boolean expression to filter
1162+ /// by.
1163+ /// - Returns: A new select statement that appends the given predicate to its `WHERE` clause.
1164+ public func `where`(
1165+ @QueryFragmentBuilder < Bool >
1166+ _ predicate: ( From . TableColumns , Joins . TableColumns ) -> [ QueryFragment ]
1167+ ) -> Self
1168+ where Joins: Table {
1169+ var select = self
1170+ select. where. append ( contentsOf: predicate ( From . columns, Joins . columns) )
1171+ return select
1172+ }
1173+
11431174 /// Creates a new select statement from this one by appending a predicate to its `WHERE` clause.
11441175 ///
11451176 /// - Parameter predicate: A closure that produces a Boolean query expression from this select's
You can’t perform that action at this time.
0 commit comments