MCPcopy Create free account
hub / github.com/AmrDeveloper/GQL / evaluate_describe_query

Function evaluate_describe_query

crates/gitql-engine/src/engine.rs:179–206  ·  view source on GitHub ↗
(
    env: &mut Environment,
    describe_query: DescribeQuery,
)

Source from the content-addressed store, hash-verified

177}
178
179fn evaluate_describe_query(
180 env: &mut Environment,
181 describe_query: DescribeQuery,
182) -> Result<EvaluationResult, String> {
183 let table_fields = env
184 .schema
185 .tables_fields_names
186 .get(&describe_query.table_name.as_str())
187 .unwrap();
188
189 let mut gitql_object = GitQLObject::default();
190 gitql_object.titles.push("field".to_owned());
191 gitql_object.titles.push("type".to_owned());
192
193 let mut rows: Vec<Row> = Vec::with_capacity(table_fields.len());
194 for field in table_fields {
195 let value = env.schema.tables_fields_types.get(field).unwrap();
196 rows.push(Row {
197 values: vec![
198 Box::new(TextValue::new(field.to_owned().to_owned())),
199 Box::new(TextValue::new(value.literal())),
200 ],
201 })
202 }
203
204 gitql_object.groups.push(Group { rows });
205 Ok(EvaluationResult::SelectedGroups(gitql_object))
206}
207
208fn evaluate_show_tables_query(env: &mut Environment) -> Result<EvaluationResult, String> {
209 let tables = env.schema.tables_fields_names.keys();

Callers 1

evaluateFunction · 0.85

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…