Skip to content

SQLiteGettable

Jeff Hurray edited this page May 3, 2016 · 2 revisions

##Overview SQLiteGettable facilitates the transfer of data from the database and cache layer to the model.

##Getters

####Basic Value Getters Returns a value that can be stored in a database. O(1) time.

func get<V: Value>(column: Expression<V>) -> V
func get<V: Value>(column: Expression<V?>) -> V?

####Relationship Getters Returns SQLiteModel(s). Executed on current thread.

func get<V: SQLiteModel>(column: Relationship<V>) -> V
func get<V: SQLiteModel>(column: Relationship<V?>) -> V?
// Ordered by localID Ascending
func get<V: SQLiteModel>(column: Relationship<[V]>) -> [V]

####Background Relationship Getters Returns SQLiteModel(s). Executed on background thread.

func getInBackground<V: SQLiteModel>(column: Relationship<V>, completion: (V) -> Void)
func getInBackground<V: SQLiteModel>(column: Relationship<V?>, completion: (V?) -> Void)
// Ordered by localID Ascending
func getInBackground<V: SQLiteModel>(column: Relationship<[V]>, completion: ([V]) -> Void)

public protocol SQLiteGettable {
    func get<V: Value>(column: Expression<V>) -> V
    func get<V: Value>(column: Expression<V?>) -> V?
    
    func get<V: SQLiteModel>(column: Relationship<V>) -> V
    func get<V: SQLiteModel>(column: Relationship<V?>) -> V?
    // Ordered by localID Ascending
    func get<V: SQLiteModel>(column: Relationship<[V]>, query: QueryType?) -> [V]
    
    func getInBackground<V: SQLiteModel>(column: Relationship<V>, completion: (V) -> Void)
    func getInBackground<V: SQLiteModel>(column: Relationship<V?>, completion: (V?) -> Void)
    // Ordered by localID Ascending
    func getInBackground<V: SQLiteModel>(column: Relationship<[V]>, query: QueryType?, completion: ([V]) -> Void)
}

Clone this wiki locally