new()
Connects to a local or remote database endpoint.
Arguments
| Argument | Description |
|---|---|
endpoint
| The database endpoint to connect to. |
Example usage
Basic example
Configuring the database
The new() function takes an argument of impl IntoEndpoint, which is implemented not only for strings and string-like structs like PathBuf and SocketAddr, but also a tuple of one of these types for the address along with a second Config struct for the configuration.
Using a backend with versioning
To make a new connection that includes SurrealKV versioning, add the "kv-surrealkv" feature flag to the surrealdb dependency in Cargo.toml, add the path to the folder containing the database inside new(), and call the .versioned() method. Versioning is also available with the memory backend.