pub mod test;
pub mod test_bytes;
pub mod test_decimal;
pub mod test_enum;
pub mod test_flatten;
#[cfg(feature = "geo-types")]
pub mod test_geo;
pub mod test_into;
pub mod test_lock;
pub mod test_nested;
pub mod test_options;
pub mod test_ordering;
pub mod test_raw_string;
pub mod test_robustness;
pub mod test_serialize;
pub mod test_types;
use nativeclick::{Client, ClientOptions};
pub async fn get_client() -> Client {
let mut options = ClientOptions::default();
if let Ok(user) = std::env::var("NATIVECLICK_TEST_USER") {
options.username = user;
}
if let Ok(password) = std::env::var("NATIVECLICK_TEST_PASSWORD") {
options.password = password;
}
if let Ok(database) = std::env::var("NATIVECLICK_TEST_DATABASE") {
options.default_database = database;
}
let address =
std::env::var("NATIVECLICK_TEST_ADDR").unwrap_or_else(|_| "127.0.0.1:9000".into());
Client::connect(address, options).await.unwrap()
}
pub async fn prepare_table(table_name: &str, table_struct: &str, client: &Client) {
client
.execute(format!("DROP TABLE IF EXISTS {table_name}"))
.await
.unwrap();
client
.execute(format!(
"CREATE TABLE {table_name} ({table_struct}) ENGINE = Memory;"
))
.await
.unwrap();
}