Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feats: add filter and mode docs #276

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* Support multiple file formats, currently only `csv` files are supported.
* Support files containing multiple tags, multiple edges, and a mixture of both.
* Support data transformations.
* Support record filtering.
* Support multiple modes, including `INSERT`, `UPDATE`, `DELETE`.
* Support connect multiple Garph with automatically load balance.
* Support retry after failure.
* Humanized status printing.
Expand Down Expand Up @@ -298,6 +300,9 @@ csv:
```yaml
tags:
- name: Person
mode: INSERT
filter:
expr: (Record[1] == "Mahinda" or Record[1] == "Michael") and Record[3] == "male"
id:
type: "STRING"
function: "hash"
Expand Down Expand Up @@ -345,6 +350,9 @@ tags:
```

* `name`: **Required**. The tag name.
* `mode`: **Optional**. The mode for processing data, optional values is `INSERT`, `UPDATE` or `DELETE`, default `INSERT`.
* `filter`: **Optional**. The data filtering configuration.
* `expr`: **Required**. The filter expression. See the [Filter Expression](docs/filter-expression.md) for details.
* `id`: **Required**. Describes the tag ID information.
* `type`: **Optional**. The type for ID. The default value is `STRING`.
* `index`: **Optional**. The column number in the records. Required if `concatItems` is not configured.
Expand All @@ -365,6 +373,9 @@ tags:
```yaml
edges:
- name: KNOWS
mode: INSERT
filter:
expr: (Record[1] == "Mahinda" or Record[1] == "Michael") and Record[3] == "male"
src:
id:
type: "INT"
Expand All @@ -386,6 +397,8 @@ edges:
```

* `name`: **Required**. The edge name.
* `mode`: **Optional**. The `mode` here is similar to `mode` in the `tags` above.
* `filter`: **Optional**. The `filter` here is similar to `filter` in the `tags` above.
* `src`: **Required**. Describes the source definition for the edge.
* `src.id`: **Required**. The `id` here is similar to `id` in the `tags` above.
* `dst`: **Required**. Describes the destination definition for the edge.
Expand Down
35 changes: 35 additions & 0 deletions docs/filter-expression.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Filter Expression

## Operators

<table>
<tr>
<td>Comparison</td>
<td>
<code>==</code>, <code>!=</code>, <code>&lt;</code>, <code>&gt;</code>, <code>&lt;=</code>, <code>&gt;=</code>
</td>
</tr>
<tr>
<td>Logical</td>
<td>
<code>not</code> or <code>!</code>, <code>and</code> or <code>&amp;&amp;</code>, <code>or</code> or <code>||</code>
</td>
</tr>
<tr>
<td>Membership</td>
<td>
<code>[]</code>
</td>
</tr>
</table>

## Built-in

<table>
<tr>
<td>Record</td>
<td>
<code>`Record` is the currently processed data, which is an array of strings. </code>
</td>
</tr>
</table>