DataStoreBaseBehavior
public protocol DataStoreBaseBehavior
-
save(_:
Asynchronouswhere: ) Saves the model to storage. If sync is enabled, also initiates a sync of the mutation to the remote API
Declaration
Swift
@discardableResult func save<M: Model>(_ model: M, where condition: QueryPredicate?) async throws -> M
-
query(_:
AsynchronousbyId: ) Declaration
Swift
func query<M: Model>(_ modelType: M.Type, byId id: String) async throws -> M?
-
query(_:
AsynchronousbyIdentifier: ) Declaration
Swift
func query<M: Model>(_ modelType: M.Type, byIdentifier id: String) async throws -> M? where M: ModelIdentifiable, M.IdentifierFormat == ModelIdentifierFormat.Default
-
query(_:
AsynchronousbyIdentifier: ) Declaration
Swift
func query<M: Model>(_ modelType: M.Type, byIdentifier id: ModelIdentifier<M, M.IdentifierFormat>) async throws -> M? where M: ModelIdentifiable
-
query(_:
Asynchronouswhere: sort: paginate: ) Declaration
Swift
func query<M: Model>(_ modelType: M.Type, where predicate: QueryPredicate?, sort sortInput: QuerySortInput?, paginate paginationInput: QueryPaginationInput?) async throws -> [M]
-
delete(_:
Asynchronouswhere: ) Declaration
Swift
func delete<M: Model>(_ model: M, where predicate: QueryPredicate?) async throws
-
delete(_:
AsynchronouswithId: where: ) Declaration
Swift
func delete<M: Model>(_ modelType: M.Type, withId id: String, where predicate: QueryPredicate?) async throws
-
delete(_:
AsynchronouswithIdentifier: where: ) Declaration
Swift
func delete<M: Model>(_ modelType: M.Type, withIdentifier id: String, where predicate: QueryPredicate?) async throws where M: ModelIdentifiable, M.IdentifierFormat == ModelIdentifierFormat.Default
-
delete(_:
AsynchronouswithIdentifier: where: ) Declaration
Swift
func delete<M: Model>(_ modelType: M.Type, withIdentifier id: ModelIdentifier<M, M.IdentifierFormat>, where predicate: QueryPredicate?) async throws where M: ModelIdentifiable
-
delete(_:
Asynchronouswhere: ) Declaration
Swift
func delete<M: Model>(_ modelType: M.Type, where predicate: QueryPredicate) async throws
-
start()
AsynchronousSynchronization starts automatically whenever you run any DataStore operation (query(), save(), delete()) however, you can explicitly begin the process with DatasStore.start()
Declaration
Swift
func start() async throws
Parameters
completion
callback to be invoked on success or failure
-
stop()
AsynchronousTo stop the DataStore sync process, you can use DataStore.stop(). This ensures the real time subscription connection is closed when your app is no longer interested in updates, such as when you application is closed. This can also be used to modify DataStore sync expressions at runtime by calling stop(), then start() to force your sync expressions to be re-evaluated.
Declaration
Swift
func stop() async throws
Parameters
completion
callback to be invoked on success or failure
-
clear()
AsynchronousTo clear local data from DataStore, use the clear method.
Declaration
Swift
func clear() async throws
Parameters
completion
callback to be invoked on success or failure