Cotton code
19 lines · 885 B · SwiftRaw
// A record found by the values of its columns — the journal's page for a day,// which a route names by its date rather than by its id.import CottonValuesimport Foundationextension Records {    /// The first record of `table` whose columns hold every value in `filter`    /// (column key → value); nil when no record does. The list narrows    /// before it pages, so the first page's first record is the answer.    public func first(table: String, where filter: [String: RecordValue]) async throws -> TableRecord? {        try await list(table: table, project: nil, query: nil, page: 0, where: filter).records.first    }    /// The first record of `table` whose `column` holds `value`.    public func first(table: String, column: String, equals value: RecordValue) async throws -> TableRecord? {        try await first(table: table, where: [column: value])    }}