SqlCrdt class abstract

Inheritance
Mixed in types
Implementers

Constructors

SqlCrdt(DatabaseApi db)
Make sure you run init after instantiation. Use changesetQueries if you want to specify a custom query to generate changesets. Defaults to a simple SELECT * for each table in the database.

Properties

allTables Future<Iterable<String>>
Returns all the user tables in this database.
getter/setter pair
canonicalTime Hlc
Represents the latest logical time seen in the stored data.
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
nodeId String
Get this CRDT's node id
no setterinherited
onTablesChanged Stream<({Hlc hlc, Iterable<String> tables})>
Emits a list of the tables affected by changes in the database and the timestamp at which they happened. Useful for guaranteeing atomic merges across multiple tables.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

execute(String sql, [List<Object?>? args]) Future<void>
Executes a SQL query with an optional args list. Use "?" placeholders for parameters to avoid injection vulnerabilities:
inherited
getChangeset({Map<String, Query>? customQueries, Iterable<String>? onlyTables, String? onlyNodeId, String? exceptNodeId, Hlc? modifiedOn, Hlc? modifiedAfter}) Future<CrdtChangeset>
Get a Changeset using the provided changesetQueries.
override
getLastModified({String? onlyNodeId, String? exceptNodeId}) Future<Hlc>
Returns the last modified timestamp, optionally filtering for or against a specific node id. Useful to get "modified since" timestamps for synchronization. Returns Hlc.zero if no timestamp is found.
override
init() Future<void>
Initialize this CRDT
merge(CrdtChangeset changeset) Future<void>
Merge changeset with the local dataset.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onDatasetChanged(Iterable<String> affectedTables, Hlc hlc) Future<void>
Notifies listeners and updates the canonical time.
override
query(String sql, [List<Object?>? args]) Future<List<Map<String, Object?>>>
Performs a SQL query with optional args and returns the result as a list of column maps. Use "?" placeholders for parameters to avoid injection vulnerabilities:
inherited
resetNodeId() Future<void>
Changes the node id. This can be useful e.g. when the user logs out and logs in with a new account without resetting the database - id avoids synchronization issues where the existing entries do not get correctly propagated to the new user id.
toString() String
A string representation of this object.
inherited
transaction(Future<void> action(TransactionCrdt txn)) Future<void>
Initiates a transaction in this database. Caution: calls to the parent crdt inside a transaction block will result in a deadlock.
validateChangeset(CrdtChangeset changeset) Hlc
Checks if changeset is valid. This method is intended for implementations and shouldn't generally be called from outside.
inherited
watch(String sql, [List<Object?> args()?]) Stream<List<Map<String, Object?>>>
Performs a live SQL query with optional args and returns the result as a list of column maps.

Operators

operator ==(Object other) bool
The equality operator.
inherited