ordt:redact-number( $column as item(), $options as map:map? ) as map:map
This function redacts a column by generating a random number within a configurable range either as a numeric data type or as a formatted string. 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 options consist of the following properties:
0
default).18446744073709551615
default).integer
(the default), decimal
, or double
;
the min and max values must have the same data type.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-number(op:schema-col("main", "employees", "salary"), map:entry("type","decimal")=>map:with("min",50000)=>map:with("max",500000)=>map:with("format","$###,##0.00")) )) => 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-number(op:schema-col("main", "employees", "salary"), map:entry("type","decimal")=>map:with("min",50000)=>map:with("max",500000)=>map:with("format","$###,##0.00")) )) => op:result()