icydb_core/db/query/plan/
model_builder.rs1use crate::db::query::plan::{DeleteSpec, FieldSlot, GroupedExecutionConfig, LoadSpec};
7
8impl LoadSpec {
9 #[must_use]
11 pub const fn new() -> Self {
12 Self {
13 limit: None,
14 offset: 0,
15 }
16 }
17}
18
19impl DeleteSpec {
20 #[must_use]
22 pub const fn new() -> Self {
23 Self {
24 limit: None,
25 offset: 0,
26 }
27 }
28}
29
30impl FieldSlot {
31 #[cfg(test)]
33 #[must_use]
34 pub(crate) fn from_parts_for_test(index: usize, field: impl Into<String>) -> Self {
35 Self {
36 index,
37 field: field.into(),
38 kind: None,
39 }
40 }
41}
42
43impl GroupedExecutionConfig {
44 #[must_use]
46 pub(crate) const fn with_hard_limits(max_groups: u64, max_group_bytes: u64) -> Self {
47 Self {
48 max_groups,
49 max_group_bytes,
50 }
51 }
52
53 #[must_use]
55 pub(crate) const fn unbounded() -> Self {
56 Self::with_hard_limits(u64::MAX, u64::MAX)
57 }
58
59 #[must_use]
61 pub(crate) const fn max_groups(&self) -> u64 {
62 self.max_groups
63 }
64
65 #[must_use]
67 pub(crate) const fn max_group_bytes(&self) -> u64 {
68 self.max_group_bytes
69 }
70}
71
72impl Default for GroupedExecutionConfig {
73 fn default() -> Self {
74 Self::unbounded()
75 }
76}