Table

A Table builds database queries with the Swift language instead of SQL.

Table.swift:142
struct Table<RowDecoder>

Overview

A Table instance is similar to a TableRecord type. You will use one when the other is impractical or impossible to use.

For example:

let table = Table("player")
try dbQueue.read { db in
    // SELECT * FROM player WHERE score >= 1000
    let rows: [Row] = table.filter(Column("score") >= 1000).fetchAll(db)
}

Creating a Table

Instance Properties

Counting Rows

Testing for Row Existence

Deleting Rows

Updating Rows

Building Query Interface Requests

Table provide convenience access to most DerivableRequest and QueryInterfaceRequest methods.

Defining Associations

Fetching Database Rows

Fetching Database Values

Fetching Records

Database Observation Support