mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-27 04:14:21 +00:00
Type-safe CTE associations, part 2
This commit is contained in:
1 parent
67bc47c3b5
commit
06000abbfd
2 files changed
+7
-3
No files matched your search
@@ -88,7 +88,11 @@ extension CommonTableExpression {
|
||||
|
||||
extension _FetchRequest {
|
||||
#warning("TODO: doc")
|
||||
public func commonTableExpression<RowDecoder>(tableName: String) -> CommonTableExpression<RowDecoder> {
|
||||
public func commonTableExpression<RowDecoder>(
|
||||
tableName: String,
|
||||
type: RowDecoder.Type = RowDecoder.self)
|
||||
-> CommonTableExpression<RowDecoder>
|
||||
{
|
||||
CommonTableExpression(
|
||||
tableName: tableName,
|
||||
request: self)
|
||||
|
||||
@@ -12,8 +12,8 @@ class CommonTableExpressionTests: GRDBTestCase {
|
||||
// Just add a WITH clause: query interface request
|
||||
do {
|
||||
enum CTE { }
|
||||
let cte: CommonTableExpression<CTE> = T.all()
|
||||
.commonTableExpression(tableName: "cte")
|
||||
let cte = T.all()
|
||||
.commonTableExpression(tableName: "cte", type: CTE.self)
|
||||
let request = T.all()
|
||||
.with(cte)
|
||||
try assertEqualSQL(db, request, """
|
||||
|
||||
Reference in new issue
Block a user