MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_csr_config_option

Method parse_csr_config_option

src/sql-parser/src/parser.rs:2328–2387  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

2326 }
2327
2328 fn parse_csr_config_option(&mut self) -> Result<CsrConfigOption<Raw>, ParserError> {
2329 let name = match self.expect_one_of_keywords(&[AVRO, NULL, KEY, VALUE, DOC])? {
2330 AVRO => {
2331 let name = match self.expect_one_of_keywords(&[KEY, VALUE])? {
2332 KEY => CsrConfigOptionName::AvroKeyFullname,
2333 VALUE => CsrConfigOptionName::AvroValueFullname,
2334 _ => unreachable!(),
2335 };
2336 self.expect_keyword(FULLNAME)?;
2337 name
2338 }
2339 NULL => {
2340 self.expect_keyword(DEFAULTS)?;
2341 CsrConfigOptionName::NullDefaults
2342 }
2343 KEY => match self.expect_one_of_keywords(&[DOC, COMPATIBILITY])? {
2344 DOC => {
2345 self.expect_keyword(ON)?;
2346 let doc_on_identifier = self.parse_avro_doc_on_option_name()?;
2347 CsrConfigOptionName::AvroDocOn(AvroDocOn {
2348 identifier: doc_on_identifier,
2349 for_schema: DocOnSchema::KeyOnly,
2350 })
2351 }
2352 COMPATIBILITY => {
2353 self.expect_keyword(LEVEL)?;
2354 CsrConfigOptionName::KeyCompatibilityLevel
2355 }
2356 _ => unreachable!(),
2357 },
2358 VALUE => match self.expect_one_of_keywords(&[DOC, COMPATIBILITY])? {
2359 DOC => {
2360 self.expect_keyword(ON)?;
2361 let doc_on_identifier = self.parse_avro_doc_on_option_name()?;
2362 CsrConfigOptionName::AvroDocOn(AvroDocOn {
2363 identifier: doc_on_identifier,
2364 for_schema: DocOnSchema::ValueOnly,
2365 })
2366 }
2367 COMPATIBILITY => {
2368 self.expect_keyword(LEVEL)?;
2369 CsrConfigOptionName::ValueCompatibilityLevel
2370 }
2371 _ => unreachable!(),
2372 },
2373 DOC => {
2374 self.expect_keyword(ON)?;
2375 let doc_on_identifier = self.parse_avro_doc_on_option_name()?;
2376 CsrConfigOptionName::AvroDocOn(AvroDocOn {
2377 identifier: doc_on_identifier,
2378 for_schema: DocOnSchema::All,
2379 })
2380 }
2381 _ => unreachable!(),
2382 };
2383 Ok(CsrConfigOption {
2384 name,
2385 value: self.parse_optional_option_value()?,

Callers

nothing calls this directly

Calls 5

AvroDocOnClass · 0.85
expect_keywordMethod · 0.80

Tested by

no test coverage detected