AssociationAggregate

A value aggregated from a population of associated records.

AssociationAggregate.swift:371
struct AssociationAggregate<RowDecoder>

You build an AssociationAggregate from an AssociationToMany.

For example:

struct Player: TableRecord { }
struct Team: FetchableRecord, TableRecord {
    static let players = Team.hasMany(Player.self)
}

try dbQueue.read { db in
    // An association aggregate
    let playerCount = Team.players.count

    // Fetch all teams with at least ten players:
    let teams: [Team] = try Team
        .having(playerCount >= 10)
        .fetchAll(db)
}

Instance Methods

Top-Level Functions