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

Function acl_explode

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

Source from the content-addressed store, hash-verified

3482}
3483
3484fn acl_explode<'a>(
3485 acl_items: Datum<'a>,
3486 temp_storage: &'a RowArena,
3487) -> Result<impl Iterator<Item = (Row, Diff)> + 'a, EvalError> {
3488 let acl_items = acl_items.unwrap_array();
3489 let mut res = Vec::new();
3490 for acl_item in acl_items.elements().iter() {
3491 if acl_item.is_null() {
3492 return Err(EvalError::AclArrayNullElement);
3493 }
3494 let acl_item = acl_item.unwrap_acl_item();
3495 for privilege in acl_item.acl_mode.explode() {
3496 let row = [
3497 Datum::UInt32(acl_item.grantor.0),
3498 Datum::UInt32(acl_item.grantee.0),
3499 Datum::String(temp_storage.push_string(privilege.to_string())),
3500 // GRANT OPTION is not implemented, so we hardcode false.
3501 Datum::False,
3502 ];
3503 res.push((Row::pack_slice(&row), Diff::ONE));
3504 }
3505 }
3506 Ok(res.into_iter())
3507}
3508
3509fn mz_acl_explode<'a>(
3510 mz_acl_items: Datum<'a>,

Callers 1

evalMethod · 0.85

Calls 11

StringClass · 0.85
unwrap_arrayMethod · 0.80
elementsMethod · 0.80
unwrap_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