From 8ed0888ea808a6ff650ab282870198eb1138ab2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 8 Oct 2016 12:46:15 +0200 Subject: [PATCH] Documentation --- GRDB/FTS/FTS5.swift | 2 -- GRDB/FTS/FTS5Pattern.swift | 23 +++++++++++++++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/GRDB/FTS/FTS5.swift b/GRDB/FTS/FTS5.swift index 115cdeb7b..c4d22826f 100644 --- a/GRDB/FTS/FTS5.swift +++ b/GRDB/FTS/FTS5.swift @@ -113,8 +113,6 @@ /// https://www.sqlite.org/fts5.html#the_detail_option public var detail: String? - /// TODO: columnsize, detail - /// Appends a table column. /// /// try db.create(virtualTable: "documents", using: FTS5()) { t in diff --git a/GRDB/FTS/FTS5Pattern.swift b/GRDB/FTS/FTS5Pattern.swift index 7f72ab103..e63c2334a 100644 --- a/GRDB/FTS/FTS5Pattern.swift +++ b/GRDB/FTS/FTS5Pattern.swift @@ -93,12 +93,13 @@ } extension FTS5Pattern : DatabaseValueConvertible { - /// TODO + /// Returns a value that can be stored in the database. public var databaseValue: DatabaseValue { return rawPattern.databaseValue } - /// TODO + /// Returns an FTS5Pattern initialized from *databaseValue*, if it + /// contains a suitable value. public static func fromDatabaseValue(_ databaseValue: DatabaseValue) -> FTS5Pattern? { return String .fromDatabaseValue(databaseValue) @@ -110,7 +111,12 @@ // MARK: Full Text Search - /// TODO + /// Returns a new QueryInterfaceRequest with a matching predicate added + /// to the eventual set of already applied predicates. + /// + /// // SELECT * FROM books WHERE books MATCH '...' + /// var request = Book.all() + /// request = request.matching(pattern) public func matching(_ pattern: FTS5Pattern) -> QueryInterfaceRequest { switch query.source { case .table(let name, let alias)?: @@ -125,7 +131,16 @@ // MARK: Full Text Search - /// TODO + /// Returns a QueryInterfaceRequest with a matching predicate. + /// + /// // SELECT * FROM books WHERE books MATCH '...' + /// var request = Book.matching(pattern) + /// + /// If the `selectsRowID` type property is true, then the selection + /// includes the hidden "rowid" column: + /// + /// // SELECT *, rowid FROM books WHERE books MATCH '...' + /// var request = Book.matching(pattern) public static func matching(_ pattern: FTS5Pattern) -> QueryInterfaceRequest { return all().matching(pattern) }