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

Function mz_acl_explode

src/expr/src/relation/func.rs:3509–3532  ·  view source on GitHub ↗
(
    mz_acl_items: Datum<'a>,
    temp_storage: &'a RowArena,
)

Source from the content-addressed store, hash-verified

3507}
3508
3509fn mz_acl_explode<'a>(
3510 mz_acl_items: Datum<'a>,
3511 temp_storage: &'a RowArena,
3512) -> Result<impl Iterator<Item = (Row, Diff)> + 'a, EvalError> {
3513 let mz_acl_items = mz_acl_items.unwrap_array();
3514 let mut res = Vec::new();
3515 for mz_acl_item in mz_acl_items.elements().iter() {
3516 if mz_acl_item.is_null() {
3517 return Err(EvalError::MzAclArrayNullElement);
3518 }
3519 let mz_acl_item = mz_acl_item.unwrap_mz_acl_item();
3520 for privilege in mz_acl_item.acl_mode.explode() {
3521 let row = [
3522 Datum::String(temp_storage.push_string(mz_acl_item.grantor.to_string())),
3523 Datum::String(temp_storage.push_string(mz_acl_item.grantee.to_string())),
3524 Datum::String(temp_storage.push_string(privilege.to_string())),
3525 // GRANT OPTION is not implemented, so we hardcode false.
3526 Datum::False,
3527 ];
3528 res.push((Row::pack_slice(&row), Diff::ONE));
3529 }
3530 }
3531 Ok(res.into_iter())
3532}
3533
3534/// When adding a new `TableFunc` variant, please consider adding it to
3535/// `TableFunc::with_ordinality`!

Callers 1

evalMethod · 0.85

Calls 11

StringClass · 0.85
unwrap_arrayMethod · 0.80
elementsMethod · 0.80
unwrap_mz_acl_itemMethod · 0.80
explodeMethod · 0.80
push_stringMethod · 0.80
iterMethod · 0.45
is_nullMethod · 0.45
to_stringMethod · 0.45
pushMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected