Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
Connect with Rust
To connect SingleStore with Rust, use SQLx with its MySQL feature.
[package]name = "rust-singlestore-connect"version = "0.1.0"edition = "2021"[dependencies]sqlx = { version = "0.5", features = ["runtime-tokio-native-tls", "mysql"] }tokio = { version = "1", features = ["full"] }
For more information, see SQLx Docs.
Here's a sample main.
use sqlx::mysql::{MySqlConnectOptions, MySqlPoolOptions};#[tokio::main]async fn main() -> Result<(), sqlx::Error> {let opts = MySqlConnectOptions::new().host("svc-ab8077f6-7b03-4ba3-b557-063c53eff943-ddl.aws-oregon-2.svc.singlestore.com").username("admin").password("PASSWORD");let pool = MySqlPoolOptions::new().connect_with(opts).await?;let row: (i64,) = sqlx::query_as("SELECT ?").bind(150_i64).fetch_one(&pool).await?;assert_eq!(row.0, 150);Ok(())}
Last modified: