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 { limit: None }
24 }
25}
26
27impl FieldSlot {
28 #[cfg(test)]
30 #[must_use]
31 pub(crate) fn from_parts_for_test(index: usize, field: impl Into<String>) -> Self {
32 Self {
33 index,
34 field: field.into(),
35 }
36 }
37}
38
39impl GroupedExecutionConfig {
40 #[must_use]
42 pub(crate) const fn with_hard_limits(max_groups: u64, max_group_bytes: u64) -> Self {
43 Self {
44 max_groups,
45 max_group_bytes,
46 }
47 }
48
49 #[must_use]
51 pub(crate) const fn unbounded() -> Self {
52 Self::with_hard_limits(u64::MAX, u64::MAX)
53 }
54
55 #[must_use]
57 pub(crate) const fn max_groups(&self) -> u64 {
58 self.max_groups
59 }
60
61 #[must_use]
63 pub(crate) const fn max_group_bytes(&self) -> u64 {
64 self.max_group_bytes
65 }
66}
67
68impl Default for GroupedExecutionConfig {
69 fn default() -> Self {
70 Self::unbounded()
71 }
72}