-
Notifications
You must be signed in to change notification settings - Fork 2
SQLiteInstance
Jeff Hurray edited this page Apr 25, 2016
·
1 revision
##Overview
SQLiteInstance exposes instance methods and properties that every instance of a model will have.
####init Default initializer for models. Needs to be overridden in classes.
init()####Save
Updates the row associated with the model instance with any cached setters and clears the cache for that hash value.
Executes on current thread and on background thread respectively.
mutating func save() throws
mutating func saveInBackground(completion: Completion?)####Delete
Deletes the row associated with the database and clears the cache for that hash value.
Executes on current thread and on background thread respectively.
func delete() throws
func deleteInBackground(completion: Completion?)####Count For Relationship Returns a count for any Multiple Relationship
func countForRelationship<V: SQLiteModel>(column: Relationship<[V]>) -> Int####Local Variables
-
localIDis the primary key of the row in the database -
localCreatedAtis the date that the row associated with the model instance was created -
localUpdatedAtis the date of the most recent update for the row associated with the model instance
var localID: SQLiteModelID {get set}
var localCreatedAt: NSDate? {get}
var localUpdatedAt: NSDate? {get}public protocol SQLiteInstance {
init()
mutating func save() throws
mutating func saveInBackground(completion: Completion?)
func delete() throws
func deleteInBackground(completion: Completion?)
func countForRelationship<V: SQLiteModel>(column: Relationship<[V]>) -> Int
var localID: SQLiteModelID {get set}
var localCreatedAt: NSDate? {get}
var localUpdatedAt: NSDate? {get}
}SQLiteModel