use crate::reflection::column::Column;
use serde::{Deserialize, Serialize};
use std::sync::Arc;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct Index {
name: Arc<String>,
column: Arc<Column>,
primary: bool,
unique: bool,
}
impl Index {
pub fn new(name: impl ToString, column: Arc<Column>, primary: bool, unique: bool) -> Self {
Index {
name: Arc::new(name.to_string()),
column,
primary,
unique,
}
}
pub fn name(&self) -> Arc<String> {
self.name.clone()
}
pub fn column(&self) -> &Column {
&self.column
}
pub fn primary(&self) -> bool {
self.primary
}
pub fn unique(&self) -> bool {
self.unique
}
}