sidebar_position | sidebar_label | title | description |
---|---|---|---|
1 |
SDK methods |
Rust Methods | Rust SDK | Integration | SurrealDB |
The SurrealDB SDK for Rust enables simple and advanced querying of a remote or embedded database. |
Most methods in the SurrealDB SDK involve either working with or creating an instance of the Surreal
struct, which serves as the database client instance for embedded or remote databases.
Function | Description |
---|---|
db.connect() |
Connects to a local or remote database endpoint |
Surreal::init() |
Initializes a non-connected instance of the database client |
Surreal::new() |
Initializes a connected instance of the database client |
db.set() |
Assigns a value as a parameter for this connection |
db.use_ns().use_db() |
Switch to a specific namespace and database |
db.unset() |
Removes a parameter for this connection |
Function | Description |
---|---|
db.query() |
Runs a set of [SurrealQL statements](/docs/surrealql/) against the database |
db.run() |
Runs a SurrealQL function |
db.select() |
Selects all records in a table, or a specific record |
db.select().live() |
Performs a LIVE SELECT query on the database |
Function | Description |
---|---|
db.create() |
Creates a record in the database |
db.delete() |
Deletes all records, or a specific record |
db.insert() |
Inserts one or multiple records or relations in the database |
db.update() |
Updates all records in a table, or a specific record |
db.upsert() |
Upserts all records in a table, or a specific record |
Function | Description |
---|---|
db.authenticate() |
Authenticates the current connection with a JWT token |
db.invalidate() |
Invalidates the authentication for the current connection |
db.signin() |
Signs this connection in to a specific authentication scope |
db.signup() |
Signs this connection up to a specific authentication scope |
Function | Description |
---|---|
db.export() |
Exports the database to a file or a live stream of bytes |
db.import() |
Imports the contents of another database from a file= |
Function | Description |
---|---|
db.version() |
Returns the current database version |