ordt:redact-us-phone( $column as item(), $options as map:map? ) as map:map
This function redacts a column with a 10-digit US phone number string by generating random numbers or replacing numbers with a masking character. This function can be used with op:bind or op:select.
Parameters | |
---|---|
$column | The name of the column to be redacted. This can be either a string or the return value from op:col, op:view-col, or op:schema-col. |
$options | The options for masking the value the column. |
The redacted column may have a phone number value with any of the following formats:
1234567890
123.456.7890
(123)456-7890
The options consist of the following properties:
full
(the default), partial
,
or full-random
;
the full
level replaces all digits with the masking character;
the partial
level retains the last 4 digits and
replaces all other digits with the masking character;
the full-random
level replaces all digits with randomly generated digits.#
default)
for the full
or partial
level;
ignored for the full-random
level.xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; import module namespace ordt="http://marklogic.com/optic/redaction" at "/MarkLogic/optic/optic-redaction.xqy"; op:from-view("main", "employees") => op:bind(( ordt:redact-us-phone(op:schema-col("main", "employees", "phone"), map:entry("level","partial")=>map:with("character","x")) )) => op:result()
xquery version "1.0-ml"; import module namespace op="http://marklogic.com/optic" at "/MarkLogic/optic.xqy"; import module namespace ordt="http://marklogic.com/optic/redaction" at "/MarkLogic/optic/optic-redaction.xqy"; op:from-view("main", "employees") => op:select(( ordt:redact-us-phone(op:schema-col("main", "employees", "phone"), map:entry("level","partial")=>map:with("character","x")) )) => op:result()