teo_runtime/model/index/
type.rs1use serde::Serialize;
2
3#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize)]
4pub enum Type {
5 Primary,
6 Index,
7 Unique,
8}
9
10impl Type {
11
12 pub fn is_primary(&self) -> bool {
13 match self {
14 Type::Primary => true,
15 _ => false,
16 }
17 }
18
19 pub fn is_unique_or_primary(&self) -> bool {
20 match self {
21 Type::Unique | Type::Primary => true,
22 _ => false,
23 }
24 }
25
26 pub fn is_unique(&self) -> bool {
27 match self {
28 Type::Unique => true,
29 _ => false,
30 }
31 }
32
33 pub fn is_index(&self) -> bool {
34 match self {
35 Type::Index => true,
36 _ => false,
37 }
38 }
39}