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 kind: None,
36 }
37 }
38}
39
40impl GroupedExecutionConfig {
41 #[must_use]
43 pub(crate) const fn with_hard_limits(max_groups: u64, max_group_bytes: u64) -> Self {
44 Self {
45 max_groups,
46 max_group_bytes,
47 }
48 }
49
50 #[must_use]
52 pub(crate) const fn unbounded() -> Self {
53 Self::with_hard_limits(u64::MAX, u64::MAX)
54 }
55
56 #[must_use]
58 pub(crate) const fn max_groups(&self) -> u64 {
59 self.max_groups
60 }
61
62 #[must_use]
64 pub(crate) const fn max_group_bytes(&self) -> u64 {
65 self.max_group_bytes
66 }
67}
68
69impl Default for GroupedExecutionConfig {
70 fn default() -> Self {
71 Self::unbounded()
72 }
73}