database_reflection/reflection/
index.rs1use crate::reflection::column::Column;
2use serde::{Deserialize, Serialize};
3use std::sync::Arc;
4
5#[derive(Clone, Debug, Serialize, Deserialize)]
6pub struct Index {
7 name: Arc<String>,
8 column: Arc<Column>,
9 primary: bool,
10 unique: bool,
11}
12
13impl Index {
14 pub fn new(name: impl ToString, column: Arc<Column>, primary: bool, unique: bool) -> Self {
16 Index {
17 name: Arc::new(name.to_string()),
18 column,
19 primary,
20 unique,
21 }
22 }
23
24 pub fn name(&self) -> Arc<String> {
26 self.name.clone()
27 }
28
29 pub fn column(&self) -> &Column {
31 &self.column
32 }
33
34 pub fn primary(&self) -> bool {
36 self.primary
37 }
38
39 pub fn unique(&self) -> bool {
41 self.unique
42 }
43}