From bef13a7d0e5e0304953843700409c6ce6bc430f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Tue, 28 May 2019 19:41:51 +0200 Subject: [PATCH] Update the List of Record Methods --- README.md | 47 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 67f47e52a..64a684df9 100644 --- a/README.md +++ b/README.md @@ -2778,7 +2778,7 @@ protocol FetchableRecord { static func databaseJSONDecoder(for column: String) -> JSONDecoder } -protocol MutablePersistableRecord { +protocol EncodableRecord { static func databaseJSONEncoder(for column: String) -> JSONEncoder } ``` @@ -2799,7 +2799,7 @@ protocol FetchableRecord { static var databaseDateDecodingStrategy: DatabaseDateDecodingStrategy { get } } -protocol MutablePersistableRecord { +protocol EncodableRecord { static var databaseDateEncodingStrategy: DatabaseDateEncodingStrategy { get } static var databaseUUIDEncodingStrategy: DatabaseUUIDEncodingStrategy { get } } @@ -2821,7 +2821,7 @@ protocol FetchableRecord { static var databaseDecodingUserInfo: [CodingUserInfoKey: Any] { get } } -protocol MutablePersistableRecord { +protocol EncodableRecord { static var databaseEncodingUserInfo: [CodingUserInfoKey: Any] { get } } ``` @@ -3551,7 +3551,7 @@ This is the list of record methods, along with their required protocols. The [Re | **Check Record Existence** | | | | `record.exists(db)` | [PersistableRecord] | | | **Convert Record to Dictionary** | | | -| `record.databaseDictionary` | [PersistableRecord] | | +| `record.databaseDictionary` | [EncodableRecord] | | | **Count Records** | | | | `Type.fetchCount(db)` | [TableRecord] | | | `Type.filter(...).fetchCount(db)` | [TableRecord] | ² | @@ -3573,9 +3573,44 @@ This is the list of record methods, along with their required protocols. The [Re | `Type.fetchOne(db, sql: sql)` | [FetchableRecord] | ³ | | `Type.fetchOne(statement)` | [FetchableRecord] | ⁴ | | `Type.filter(...).fetchOne(db)` | [FetchableRecord] & [TableRecord] | ² | +| **[Codable Records]** | | | +| `Type.databaseDecodingUserInfo` | [FetchableRecord] | [*](#the-userinfo-dictionary) | +| `Type.databaseEncodingUserInfo` | [EncodableRecord] | [*](#the-userinfo-dictionary) | +| `Type.databaseJSONDecoder(for:)` | [FetchableRecord] | [*](#json-columns) | +| `Type.databaseJSONEncoder(for:)` | [EncodableRecord] | [*](#json-columns) | +| `Type.databaseDateDecodingStrategy` | [FetchableRecord] | [*](#date-and-uuid-coding-strategies) | +| `Type.databaseDateEncodingStrategy` | [EncodableRecord] | [*](#date-and-uuid-coding-strategies) | +| `Type.databaseUUIDEncodingStrategy` | [EncodableRecord] | [*](#date-and-uuid-coding-strategies) | +| **Define [Associations]** | | | +| `Type.belongsTo(...)` | [TableRecord] | [*](Documentation/AssociationsBasics.md) | +| `Type.hasMany(...)` | [TableRecord] | [*](Documentation/AssociationsBasics.md) | +| `Type.hasOne(...)` | [TableRecord] | [*](Documentation/AssociationsBasics.md) | +| `Type.hasManyThrough(...)` | [TableRecord] | [*](Documentation/AssociationsBasics.md) | +| `Type.hasOneThrough(...)` | [TableRecord] | [*](Documentation/AssociationsBasics.md) | +| **Building Query Interface [Requests]** | | | +| `record.request(for:...)` | [TableRecord] & [EncodableRecord] | [*](Documentation/AssociationsBasics.md) | +| `Type.all()` | [TableRecord] | ² | +| `Type.none()` | [TableRecord] | ² | +| `Type.select(...)` | [TableRecord] | ² | +| `Type.annotated(with:...)` | [TableRecord] | ² | +| `Type.filter(_:)` | [TableRecord] | ² | +| `Type.filter(key:)` | [TableRecord] | ² | +| `Type.filter(keys:)` | [TableRecord] | ² | +| `Type.filter(sql:arguments:)` | [TableRecord] | ² | +| `Type.filter(literal:)` | [TableRecord] | ² | +| `Type.matching(_:)` | [TableRecord] | ² | +| `Type.including(all:)` | [TableRecord] | ² | +| `Type.including(optional:)` | [TableRecord] | ² | +| `Type.including(required:)` | [TableRecord] | ² | +| `Type.joining(optional:)` | [TableRecord] | ² | +| `Type.joining(required:)` | [TableRecord] | ² | +| `Type.order(...)` | [TableRecord] | ² | +| `Type.orderByPrimaryKey()` | [TableRecord] | ² | +| `Type.having(...)` | [TableRecord] | ² | +| `Type.limit(...)` | [TableRecord] | ² | | **[Record Comparison]** | | | -| `record.databaseEquals(...)` | [PersistableRecord] | | -| `record.databaseChanges(from:...)` | [PersistableRecord] | | +| `record.databaseEquals(...)` | [EncodableRecord] | | +| `record.databaseChanges(from:...)` | [EncodableRecord] | | | `record.updateChanges(db, from:...)` | [PersistableRecord] | | | `record.updateChanges(db) { ... }` | [PersistableRecord] | | | `record.hasDatabaseChanges` | [Record](#record-class) | |