yugendb_core/
capabilities.rs1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub struct Capabilities {
6 pub transactions: bool,
8 pub ttl: bool,
10 pub prefix_scan: bool,
12 pub atomic_increment: bool,
14 pub batch_write: bool,
16 pub raw_sql: bool,
18 pub document_query: bool,
20 pub json_query: bool,
22 pub migrations: bool,
24 pub connection_pooling: bool,
26 pub watch: bool,
28 pub backup: bool,
30}
31
32impl Capabilities {
33 #[must_use]
35 pub const fn minimal() -> Self {
36 Self {
37 transactions: false,
38 ttl: false,
39 prefix_scan: false,
40 atomic_increment: false,
41 batch_write: false,
42 raw_sql: false,
43 document_query: false,
44 json_query: false,
45 migrations: false,
46 connection_pooling: false,
47 watch: false,
48 backup: false,
49 }
50 }
51
52 #[must_use]
54 pub const fn memory() -> Self {
55 Self {
56 transactions: false,
57 ttl: true,
58 prefix_scan: true,
59 atomic_increment: false,
60 batch_write: true,
61 raw_sql: false,
62 document_query: false,
63 json_query: false,
64 migrations: false,
65 connection_pooling: false,
66 watch: false,
67 backup: false,
68 }
69 }
70
71 #[must_use]
73 pub const fn sqlite() -> Self {
74 Self {
75 transactions: true,
76 ttl: true,
77 prefix_scan: true,
78 atomic_increment: false,
79 batch_write: true,
80 raw_sql: false,
81 document_query: false,
82 json_query: false,
83 migrations: true,
84 connection_pooling: false,
85 watch: false,
86 backup: false,
87 }
88 }
89}
90
91impl Default for Capabilities {
92 fn default() -> Self {
93 Self::minimal()
94 }
95}