ordt:redact-datetime( $column as item(), $options as map:map? ) as map:map
This function redacts a column with date or datetime values either by masking part of the existing value or by generating a random value. 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:
parsed
(the default) or random
;
the parsed
level formats the existing datetime value (which may be parsed from a string);
the random
level generates a random datetime value.parsed
level;
allowed for the random
level;
specify the picture as with the
fn:format-dateTime
function.parsed
level;
ignored for the random
level;
specify the picture as with the
xdmp:parse-dateTime
function.parsed
level;
allowed for the random
level
(defaulting to 1582 and the current year).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", "expenses") => op:bind(( ordt:redact-datetime(op:schema-col("main", "expenses", "expenseDate"), map:entry("level","parsed")=>map:with("format","[M01]/[D01]/xx")) )) => 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", "expenses") => op:select(( ordt:redact-datetime(op:schema-col("main", "expenses", "expenseDate"), map:entry("level","parsed")=>map:with("format","[M01]/[D01]/xx")) )) => op:result()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.