0001 /** 0002 Base model for all Fluent entities. 0003 0004 Override the `table()`, `serialize()`, and `init(serialized:)` 0005 methods on your subclass. 0006 */ 0007 public protocol Model{ 0008 ///The entities database identifier. `nil` when not saved yet. 0009 var id
Model.swift:24 extension Model {: String? { get } 0010 0011 ///The database table in which entities are stored. 0012 static var table
Query.swift:71 if let id = model.id {Query.swift:80 guard let id = model.id else {: String { get } 0013 0014 /** 0015 This method will be called when the entity is saved. 0016 The keys of the dictionary are the column names 0017 in the database. 0018 */ 0019 func serialize
Query.swift:117 self.table = T.table() -> [String: String] 0020 0021 init
Query.swift:69 let data = model.serialize()(serialized: [String: String]) 0022 } 0023 0024 extension Model { 0025 0026 public func save() { 0027 Query().save(self) 0028 } 0029 0030 public func delete() { 0031 Query().delete(self) 0032 } 0033 0034 public static func find(id: Int) -> Self? { 0035 return Query().find(id) 0036 } 0037 0038 }
Query.swift:9 return T(serialized: serialized)Query.swift:21 let model = T(serialized: serialized)