Skip to content

Commit

Permalink
feats: add filter and mode docs (#276)
Browse files Browse the repository at this point in the history
  • Loading branch information
veezhang authored Jun 9, 2023
1 parent ed9f1f4 commit 6b7e05c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
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>

0 comments on commit 6b7e05c

Please sign in to comment.