VirtualTableModule

The protocol for SQLite virtual table modules. It lets you define a DSL for the Database.create(virtualTable:using:) method:

let module = ...
try db.create(virtualTable: "item", using: module) { t in
    ...
}

GRDB ships with three concrete classes that implement this protocol: FTS3, FTS4 and FTS5.

  • The type of the closure argument in the Database.create(virtualTable:using:) method:

    try db.create(virtualTable: "item", using: module) { t in
        // t is TableDefinition
    }
    
  • The name of the module.

  • Returns a table definition that is passed as the closure argument in the Database.create(virtualTable:using:) method:

    try db.create(virtualTable: "item", using: module) { t in
        // t is the result of makeTableDefinition(configuration:)
    }
    
  • Returns the module arguments for the CREATE VIRTUAL TABLE query.

  • Execute any relevant database statement after the virtual table has been created.