MCPcopy Create free account
hub / github.com/cosdata/cosdata / parse_cosql_statement

Function parse_cosql_statement

src/cosql/mod.rs:53–86  ·  view source on GitHub ↗
(input: &str)

Source from the content-addressed store, hash-verified

51}
52
53pub fn parse_cosql_statement(input: &str) -> IResult<&str, CosQLStatement> {
54 alt((
55 preceded(
56 ws_tag("define"),
57 alt((
58 preceded(
59 ws_tag("entity"),
60 map(parse_entity_definition, |ed| {
61 CosQLStatement::EntityDefinition(ed)
62 }),
63 ),
64 preceded(
65 ws_tag("relationship"),
66 map(parse_relationship_definition, |rd| {
67 CosQLStatement::RelationshipDefinition(rd)
68 }),
69 ),
70 preceded(ws_tag("rule"), map(parse_rule, CosQLStatement::Rule)),
71 )),
72 ),
73 preceded(
74 ws_tag("insert"),
75 alt((
76 map(parse_entity_insertion, |ei| {
77 CosQLStatement::EntityInsertion(ei)
78 }),
79 map(parse_relationship_insertion, |ri| {
80 CosQLStatement::RelationshipInsertion(ri)
81 }),
82 )),
83 ),
84 preceded(ws_tag("match"), map(parse_query, CosQLStatement::Query)),
85 ))(input)
86}
87
88#[cfg(test)]
89mod tests {

Callers 1

Calls 5

ws_tagFunction · 0.70
EntityDefinitionClass · 0.50
EntityInsertionClass · 0.50

Tested by 1