MCPcopy Create free account
hub / github.com/GraphLite-AI/GraphLite / session_set_clause

Function session_set_clause

graphlite/src/ast/parser.rs:3188–3274  ·  view source on GitHub ↗

Parse SESSION SET clauses

(tokens: &[Token])

Source from the content-addressed store, hash-verified

3186
3187/// Parse SESSION SET clauses
3188fn session_set_clause(tokens: &[Token]) -> IResult<&[Token], SessionSetClause> {
3189 alt((
3190 // SESSION SET SCHEMA schema_reference
3191 map(
3192 tuple((expect_token(Token::Schema), catalog_path)),
3193 |(_, schema_reference)| SessionSetClause::Schema { schema_reference },
3194 ),
3195 // SESSION SET [PROPERTY] GRAPH graph_expression
3196 map(
3197 tuple((
3198 opt(expect_token(Token::Property)),
3199 expect_token(Token::Graph),
3200 graph_expression,
3201 )),
3202 |(_, _, graph_expression)| SessionSetClause::Graph { graph_expression },
3203 ),
3204 // SESSION SET TIME ZONE time_zone_string
3205 map(
3206 tuple((
3207 expect_token(Token::Time),
3208 expect_token(Token::Zone),
3209 string_literal,
3210 )),
3211 |(_, _, time_zone)| SessionSetClause::TimeZone { time_zone },
3212 ),
3213 // SESSION SET [PROPERTY] GRAPH [IF NOT EXISTS] parameter graph_initializer
3214 map(
3215 tuple((
3216 opt(expect_token(Token::Property)),
3217 expect_token(Token::Graph),
3218 opt(tuple((
3219 expect_token(Token::If),
3220 expect_token(Token::Not),
3221 expect_token(Token::Exists),
3222 ))),
3223 parameter_name,
3224 graph_initializer,
3225 )),
3226 |(_, _, if_not_exists, parameter, graph_initializer)| {
3227 SessionSetClause::GraphParameter {
3228 parameter,
3229 graph_initializer,
3230 if_not_exists: if_not_exists.is_some(),
3231 }
3232 },
3233 ),
3234 // SESSION SET [BINDING] TABLE [IF NOT EXISTS] parameter binding_table_initializer
3235 map(
3236 tuple((
3237 opt(expect_token(Token::Binding)),
3238 expect_token(Token::Table),
3239 opt(tuple((
3240 expect_token(Token::If),
3241 expect_token(Token::Not),
3242 expect_token(Token::Exists),
3243 ))),
3244 parameter_name,
3245 binding_table_initializer,

Callers

nothing calls this directly

Calls 1

expect_tokenFunction · 0.85

Tested by

no test coverage detected