MCPcopy Create free account
hub / github.com/hashintel/hash / compile

Method compile

libs/@local/graph/postgres-store/src/store/postgres/query/mod.rs:157–195  ·  view source on GitHub ↗
(
        &'p self,
        compiler: &mut SelectCompiler<'p, 'q, Entity>,
        _: Option<&'p Self::CompilationParameters>,
        _: &QueryTemporalAxes,
    )

Source from the content-addressed store, hash-verified

155 }
156
157 fn compile<'p, 'q: 'p>(
158 &'p self,
159 compiler: &mut SelectCompiler<'p, 'q, Entity>,
160 _: Option<&'p Self::CompilationParameters>,
161 _: &QueryTemporalAxes,
162 ) -> Result<Self::Indices, Report<SelectCompilerError>>
163 where
164 's: 'q,
165 {
166 if let Some(cursor) = self.cursor() {
167 self.paths
168 .iter()
169 .zip(&cursor.values)
170 .map(|(sorting_record, parameter)| {
171 let expression = (*parameter != CursorField::Json(PropertyValue::Null))
172 .then(|| compiler.add_parameter(parameter));
173 compiler.add_cursor_selection(
174 &sorting_record.path,
175 identity,
176 expression,
177 sorting_record.ordering,
178 sorting_record.nulls,
179 )
180 })
181 .collect()
182 } else {
183 Ok(self
184 .paths
185 .iter()
186 .map(|sorting_record| {
187 compiler.add_distinct_selection_with_ordering(
188 &sorting_record.path,
189 Distinctness::Distinct,
190 Some((sorting_record.ordering, sorting_record.nulls)),
191 )
192 })
193 .collect())
194 }
195 }
196}
197
198#[cfg(test)]

Callers

nothing calls this directly

Calls 11

OkInterface · 0.85
collectMethod · 0.80
zipMethod · 0.80
thenMethod · 0.80
add_parameterMethod · 0.80
add_cursor_selectionMethod · 0.80
JsonClass · 0.50
cursorMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected