SurrealClient class

Client for a SurrealDB instance.

Connects to a specific database endpoint.

Constructors

SurrealClient({required String url, String token = '', IdGenerator? idGenerator})
Requires url for target SurrealDB instance. url have to be a full path to the RPC endpoint so provide it like eg. https://your.instance/rpc.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

authenticate(String token) Future<void>
Authenticates the current connection with a JWT token.
change(String thing, Map<String, dynamic> data) Future
Modifies all records in a table, or a specific record.
close() → void
Closes the persistent connection to the database.
connect(String url) Future<void>
Connects to a local or remote database endpoint.
create(String thing, Map<String, dynamic> data) Future
Creates a record in the database.
delete(String thing) Future
Deletes all records, or a specific record.
emit(dynamic event, dynamic arg) → void
inherited
info() Future
invalidate() Future
Invalidates the authentication for the current connection.
kill(String query) Future
let(String key, Map<String, dynamic> val) Future
Assigns a value as a parameter for this connection.
live(String table) Future
modify(String thing, List<Map<String, dynamic>> data) Future
Applies JSON Patch changes to all records in a table, or a specific record.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
off(dynamic event, Function func) → void
inherited
on(dynamic event, Function func) → void
inherited
once(dynamic event, Function func) → void
inherited
ping() Future<void>
Pings the instance to maintain proxy connection.
query(String query, [Map<String, dynamic> vars = const {}]) Future
Runs a set of SurrealQL statements against the database.
removeAllListeners() → void
inherited
select(String thing) Future
Selects all records in a table, or a specific record.
signIn(Map<String, dynamic> vars) Future
Signs this connection in to a specific authentication scope.
signUp(Map<String, dynamic> vars) Future
Signs this connection up to a specific authentication scope.
sync(String query, [Map<String, dynamic> vars = const {}]) → Live
toString() String
A string representation of this object.
inherited
update(String thing, Map<String, dynamic> data) Future
Updates all records in a table, or a specific record.
use(String ns, String db) Future
Switch to a specific namespace and database.
wait() Future<void>
Waits for the connection to the database to succeed.

Operators

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