Skip to content

Commit

Permalink
added unix timestamp docs
Browse files Browse the repository at this point in the history
  • Loading branch information
evisdrenova committed Nov 13, 2023
1 parent bab645d commit 618a921
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/docs/transformers/system/int-phone.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { DocsTable } from '@site/src/CustomComponents/DocsTable.tsx';

<TransformerPageHeader
title="Phone (integer)"
type="integer"
type="int64"
apiRef="https://github.com/nucleuscloud/neosync/blob/main/worker/internal/benthos/transformers/int_phone.go"
/>

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/transformers/system/random-int.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { DocsTable } from '@site/src/CustomComponents/DocsTable.tsx';

<TransformerPageHeader
title="Random Integer"
type="integer"
type="int64"
apiRef="https://github.com/nucleuscloud/neosync/blob/main/worker/internal/benthos/transformers/random_int.go"
/>

Expand Down
42 changes: 42 additions & 0 deletions docs/docs/transformers/system/state.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: State
id: state
hide_title: true
slug: /transformers/system/state
---

import { TransformerPageHeader } from '@site/src/CustomComponents/TransformerPageHeader.tsx';

import { DocsTable } from '@site/src/CustomComponents/DocsTable.tsx';

<TransformerPageHeader
title="State"
type="string"
apiRef="https://github.com/nucleuscloud/neosync/blob/main/worker/internal/benthos/transformers/state.go"
/>

## Definition

The state transformer generates a randomly selected US state. You can see the complete list of cities that are available to be randomly selected [here.](https://github.com/nucleuscloud/neosync/blob/main/worker/internal/benthos/transformers/data-sets/addresses.json).

If you'd rather not get back a real state value, you can use the [Random String Transformer](/transformers/system/random-string) to generate a random string value.

## Configurations

There are no configurations for the state transformer.

## Examples

Here are some examples of what an output state value may look like.

<DocsTable
headers={['Example Input', 'Example Output']}
rowData={[
{
data: ['Massachusetts', 'Rhode Island'],
},
{
data: ['California', 'Missouri'],
},
]}
/>
43 changes: 43 additions & 0 deletions docs/docs/transformers/system/street-address.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
title: Street Address
id: street-address
hide_title: true
slug: /transformers/system/street-address
---

import { TransformerPageHeader } from '@site/src/CustomComponents/TransformerPageHeader.tsx';

import { DocsTable } from '@site/src/CustomComponents/DocsTable.tsx';

<TransformerPageHeader
title="Street Address"
type="string"
apiRef="https://github.com/nucleuscloud/neosync/blob/main/worker/internal/benthos/transformers/street_address.go"
/>

## Definition

The street address transformer generates a randomly selects a real street address that exists in the United States. You can see the complete list of street addresses that are available to be randomly selected [here.](https://github.com/nucleuscloud/neosync/blob/main/worker/internal/benthos/transformers/data-sets/addresses.json).

The street address transformer returns a valid United States address. For example:
`123 Main Street Boston`

## Configurations

There are no configurations for the street adddress transformer.

## Examples

Here are some examples of what an output street address value may look like.

<DocsTable
headers={['Example Input', 'Example Output']}
rowData={[
{
data: ['N/A', '509 Franklin Street Northeast'],
},
{
data: ['San Francisco', '14 Huntingon Street'],
},
]}
/>
63 changes: 63 additions & 0 deletions docs/docs/transformers/system/unix-ts.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
title: Unix Timestamp
id: unix-ts
hide_title: true
slug: /transformers/system/unix-ts
---

import { TransformerPageHeader } from '@site/src/CustomComponents/TransformerPageHeader.tsx';

import { DocsTable } from '@site/src/CustomComponents/DocsTable.tsx';

<TransformerPageHeader
title="Unix Timestamp"
type="int64"
apiRef="https://github.com/nucleuscloud/neosync/blob/main/worker/internal/benthos/transformers/unix_timestamp.go"
/>

## Definition

The unix timestamp transformer randomly generates a unix timestamp in UTC timezone and returns back an int64 representation of that timestamp.

By default, the generated timestamp will always be in the **past**. To generate a timestamp that is in the future, set the `alwaysFuture` config to true.

## Configurations

Depending on your validations, you may want to configure the output unix timestamp. The unix timestamp transformer has the following configuration options:

<DocsTable
headers={[
'Name',
'Description',
'Default',
'Example Input',
'Example Output',
]}
rowData={[
{
data: [
'Always Future',
'Always generates a timestamp in the future',
'false',
'N/A',
'2524608000',
],
},
]}
/>

## Examples

Here are some examples of what an output state value may look like.

<DocsTable
headers={['Always Future', 'Example Input', 'Example Output']}
rowData={[
{
data: ['true', '946684800', '2524608000'],
},
{
data: ['false', '761684800', '946684800'],
},
]}
/>
15 changes: 15 additions & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ const sidebars = {
id: 'transformers/system/string-phone',
label: 'Phone (string)',
},
{
type: 'doc',
id: 'transformers/system/street-address',
label: 'Street Address',
},
{
type: 'doc',
id: 'transformers/system/city',
Expand All @@ -146,6 +151,11 @@ const sidebars = {
id: 'transformers/system/full-address',
label: 'Full Address',
},
{
type: 'doc',
id: 'transformers/system/state',
label: 'State',
},
{
type: 'doc',
id: 'transformers/system/card-number',
Expand Down Expand Up @@ -196,6 +206,11 @@ const sidebars = {
id: 'transformers/system/random-string',
label: 'Random String',
},
{
type: 'doc',
id: 'transformers/system/unix-ts',
label: 'Unix Timestamp',
},
],
},
{
Expand Down
10 changes: 9 additions & 1 deletion docs/src/theme/DocSidebarItem/Link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@ import {
AiOutlineMail,
AiOutlinePhone,
} from 'react-icons/ai';
import { BiLogoPostgresql, BiSolidCity } from 'react-icons/bi';
import { BiLogoPostgresql, BiSolidCity, BiTimeFive } from 'react-icons/bi';
import { BsFunnel, BsGenderAmbiguous, BsShieldCheck } from 'react-icons/bs';
import {
FaAws,
FaDocker,
FaRegAddressBook,
FaRegAddressCard,
FaStreetView,
} from 'react-icons/fa';
import { GiTexas } from 'react-icons/gi';
import { GoCode } from 'react-icons/go';
import { GrMysql } from 'react-icons/gr';
import { IoBuildOutline } from 'react-icons/io5';
Expand Down Expand Up @@ -154,6 +156,12 @@ export const RenderIcon = (name) => {
return <TiSortNumerically />;
case 'Random String':
return <RxLetterCaseCapitalize />;
case 'State':
return <GiTexas />;
case 'Street Address':
return <FaStreetView />;
case 'Unix Timestamp':
return <BiTimeFive />;
default:
return <LayersIcon />;
}
Expand Down

0 comments on commit 618a921

Please sign in to comment.