use crate::ZeroTemporalPolicy;
#[derive(Debug, Clone)]
pub struct SurrealConfig {
pub endpoint: String,
pub username: String,
pub password: String,
pub namespace: String,
pub database: String,
pub zero_temporal: ZeroTemporalPolicy,
pub batch_size: usize,
pub dry_run: bool,
}
impl Default for SurrealConfig {
fn default() -> Self {
Self {
endpoint: "http://localhost:8000".to_string(),
username: "root".to_string(),
password: "root".to_string(),
namespace: "test".to_string(),
database: "test".to_string(),
zero_temporal: ZeroTemporalPolicy::default(),
batch_size: 1000,
dry_run: false,
}
}
}
impl SurrealConfig {
pub fn new(
endpoint: impl Into<String>,
username: impl Into<String>,
password: impl Into<String>,
namespace: impl Into<String>,
database: impl Into<String>,
) -> Self {
Self {
endpoint: endpoint.into(),
username: username.into(),
password: password.into(),
namespace: namespace.into(),
database: database.into(),
..Self::default()
}
}
}