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

Method parse_role_attributes

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

Source from the content-addressed store, hash-verified

4398 }
4399
4400 fn parse_role_attributes(&mut self) -> Result<Vec<RoleAttribute>, ParserError> {
4401 let mut options = vec![];
4402 loop {
4403 match self.parse_one_of_keywords(&[
4404 SUPERUSER,
4405 NOSUPERUSER,
4406 LOGIN,
4407 NOLOGIN,
4408 INHERIT,
4409 NOINHERIT,
4410 CREATECLUSTER,
4411 NOCREATECLUSTER,
4412 CREATEDB,
4413 NOCREATEDB,
4414 CREATEROLE,
4415 NOCREATEROLE,
4416 PASSWORD,
4417 ]) {
4418 None => break,
4419 Some(SUPERUSER) => options.push(RoleAttribute::SuperUser),
4420 Some(NOSUPERUSER) => options.push(RoleAttribute::NoSuperUser),
4421 Some(LOGIN) => options.push(RoleAttribute::Login),
4422 Some(NOLOGIN) => options.push(RoleAttribute::NoLogin),
4423 Some(INHERIT) => options.push(RoleAttribute::Inherit),
4424 Some(NOINHERIT) => options.push(RoleAttribute::NoInherit),
4425 Some(CREATECLUSTER) => options.push(RoleAttribute::CreateCluster),
4426 Some(NOCREATECLUSTER) => options.push(RoleAttribute::NoCreateCluster),
4427 Some(CREATEDB) => options.push(RoleAttribute::CreateDB),
4428 Some(NOCREATEDB) => options.push(RoleAttribute::NoCreateDB),
4429 Some(CREATEROLE) => options.push(RoleAttribute::CreateRole),
4430 Some(NOCREATEROLE) => options.push(RoleAttribute::NoCreateRole),
4431 Some(PASSWORD) => {
4432 if self.parse_keyword(NULL) {
4433 options.push(RoleAttribute::Password(None));
4434 continue;
4435 }
4436 let password = self.parse_literal_string()?;
4437 options.push(RoleAttribute::Password(Some(password)));
4438 }
4439 Some(_) => unreachable!(),
4440 }
4441 }
4442 Ok(options)
4443 }
4444
4445 fn parse_create_secret(&mut self) -> Result<Statement<Raw>, ParserError> {
4446 self.expect_keyword(SECRET)?;

Callers 2

parse_create_roleMethod · 0.80
parse_alter_roleMethod · 0.80

Calls 5

PasswordClass · 0.85
parse_one_of_keywordsMethod · 0.80
parse_keywordMethod · 0.80
parse_literal_stringMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected