From 8000332ec4968a680d4fef24ec3116a713c8be77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Tue, 1 Dec 2020 19:29:39 +0100 Subject: [PATCH] Gather CTE methods --- .../Request/CommonTableExpression.swift | 18 ++++++++++++++++++ .../Request/QueryInterfaceRequest.swift | 14 -------------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/GRDB/QueryInterface/Request/CommonTableExpression.swift b/GRDB/QueryInterface/Request/CommonTableExpression.swift index f2d838918..6b6b891bd 100644 --- a/GRDB/QueryInterface/Request/CommonTableExpression.swift +++ b/GRDB/QueryInterface/Request/CommonTableExpression.swift @@ -75,6 +75,24 @@ extension _FetchRequest { } } +// MARK: - QueryInterfaceRequest + +extension QueryInterfaceRequest { + #warning("TODO: doc") + public func with(_ ctes: CommonTableExpression...) -> Self { + with(ctes) + } + + #warning("TODO: doc") + public func with(_ ctes: [CommonTableExpression]) -> Self { + mapInto(\.query.ctes) { + for cte in ctes { + $0[cte.tableName] = cte.request + } + } + } +} + // MARK: - _AllCTEColumns /// :nodoc: diff --git a/GRDB/QueryInterface/Request/QueryInterfaceRequest.swift b/GRDB/QueryInterface/Request/QueryInterfaceRequest.swift index dbd0ef434..2e4a426b3 100644 --- a/GRDB/QueryInterface/Request/QueryInterfaceRequest.swift +++ b/GRDB/QueryInterface/Request/QueryInterfaceRequest.swift @@ -336,20 +336,6 @@ extension QueryInterfaceRequest { map(\.query) { $0.limit(limit, offset: offset) } } - #warning("TODO: doc") - public func with(_ ctes: CommonTableExpression...) -> Self { - with(ctes) - } - - #warning("TODO: doc") - public func with(_ ctes: [CommonTableExpression]) -> Self { - mapInto(\.query.ctes) { - for cte in ctes { - $0[cte.tableName] = cte.request - } - } - } - /// Creates a request bound to type RowDecoder. /// /// The returned request can fetch if the type RowDecoder is fetchable (Row,