MARS documentation
Rust librariesmars-protocolMarsql

mars-protocol · marsql::parser

Public declarations and documentation for mars-protocol::marsql::parser.

Package: mars-protocol · Workspace version: 0.1.0 · Module: marsql::parser

This reference follows declared modules and public syntax, including public implementation methods. Function bodies and constant values are omitted. Feature conditions are retained. Private-module re-exports and trait resolution require the compiler; not every declaration is a root import.

marsql::parser::parse

Parse a MARS-QL query string into a [MarsQuery] AST.

Errors

Returns [MarsError::ValidationError] with a descriptive message if the input does not conform to the MARS-QL grammar.

Examples

# use mars_protocol::marsql::parser::parse;
let q = parse("DISCOVER AgentDefinition WHERE status = \"active\" LIMIT 10").unwrap();
assert_eq!(q.limit, Some(10));
pub fn parse(input: &str) -> Result<MarsQuery, MarsError>;

Source line: 35.

marsql::parser::parse_sharded

Parse a MARS-QL query string into a [ShardedQuery] with optional shard placement hints.

The grammar extends the base query with trailing hint clauses:

sharded_query = query { shard_hint } ;
shard_hint    = "SHARD" string | "CLUSTER" string | "REGION" string ;

Examples

# use mars_protocol::marsql::parser::parse_sharded;
let sq = parse_sharded(
    r#"DISCOVER AgentDefinition WHERE status = "active" SHARD "shard-01" REGION "us-east""#,
).unwrap();
assert_eq!(sq.hints.len(), 2);
#[cfg(feature = "sharding")]
pub fn parse_sharded(input: &str) -> Result<ShardedQuery, MarsError>;

Source line: 68.

Source provenance

Source: mars-protocol/src/marsql/parser.rs · SHA-256 d983f4b5650de1d699869924abdbcaa9e2cc5d31836bb7fd68b49b6ce0ee1c85. Package overview.

On this page