sidebar_position | sidebar_label |
---|---|
4 |
Random Time |
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
:::tip Goal
Write mask
rule logic to
- generate random times from an interval defined by
<from>
and<to>
properties - The
random-time
function generates values having standard format "HH:mm:ss" (24-hour time format)%tT
:::
<Tabs defaultValue="structure" values={[ { label: 'Structure', value: 'structure' }, { label: 'Update Example', value: 'update' }, { label: 'Create Example', value: 'create' }, ]}
...
mask <column> <rule-name>
format %tT
random-time <from> <to> // [<from>, <to>]
...
table birth_certificate
...
column time birth_time
...
...
task ... {
update birth_certificate
mask birth_time
format %tT
random-time 00:00:00 23:59:59
...
}
table birth_certificate
...
column time birth_time
...
...
task ... {
create birth_certificate minimum-rows 50
mask birth_time
format %tT
random-time 00:00:00 23:59:59
...
}
<from>
and<to>
values are included in the generated values.- Both are written using the format "HH:mm:ss" (24-hour time format)
random-time
creates values of the formatHH:mm:ss
, the%tT
will result in strings of this format.
For different formats, see Formats- Note the lack of double quotes
"
around the values after therandom-time
keyword. This is the correct syntax.