Skip to content

Concepts

Executing queries

The Rust SDK runs SurrealQL with query(), which takes one or more statements and binds variables to them, and calls a function defined in the database with run(). set() keeps a parameter on the connection for the queries that follow, and unset() removes it. api() invokes the endpoints defined with DEFINE API.

To read and write records without writing SurrealQL, see data manipulation. How results are read into Rust types is covered in value types and flexible typing, and fetching linked records shows how to follow record links in a query.

MethodDescription
db.query()Runs one or more SurrealQL statements against the database
db.run()Runs a SurrealQL function
db.set()Assigns a value as a parameter for this connection
db.unset()Removes a parameter from this connection
db.api()Invokes the endpoints defined with DEFINE API on the selected namespace and database

Was this page helpful?

Last updated