-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changed the processing order - now: spel, regex, filters
- Loading branch information
Showing
2 changed files
with
31 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,44 @@ | ||
The following processors can be applied to records in that order: | ||
|
||
* Filters | ||
* Transforms | ||
* Regular expressions | ||
==== Filter | ||
|
||
Keep records that match a https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions[Spring Expression Language] (SpEL) boolean expression | ||
|
||
`--filter "name matches '[a-zA-Z\\s]+'"` | ||
* Filters | ||
==== Transform | ||
|
||
Produce key/value pairs using SpEL: `field1=<exp>`, `field2=<exp>`, ... | ||
Produce key/value pairs using https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#expressions[Spring Expression Language] (SpEL): `field1=<exp>`, `field2=<exp>`, ... | ||
|
||
For example `--spel field1=' generates a field named `field1` with always the same value `foo`. | ||
For example `--spel "field1='foo'"` generates a field named `field1` with always the same value `foo`. | ||
|
||
Input fields are accessed by name (e.g. `field3=field1+field2`). | ||
|
||
The processor also exposes the following variables that can be called with the `#` prefix: | ||
|
||
* `redis` : Redis connection to issue any command, e.g. `name=#redis.hgetall('person1').lastName` | ||
* `date` : date parser/formatter, e.g. `epoch=#date.parse(mydate).getTime()` | ||
* `index` : sequence number of the item being generated, e.g. `id=#index` | ||
===== redis | ||
Redis connection to issue any command: | ||
|
||
`--spel "name=#redis.hgetall('person1').lastName"` | ||
|
||
===== date | ||
Date parser/formatter: | ||
|
||
`--spel "epoch=#date.parse(mydate).getTime()"` | ||
|
||
===== index | ||
Sequence number of the item being generated: | ||
|
||
`--spel "id=#index"` | ||
|
||
==== Regex | ||
|
||
Extract patterns from source fields using regular expressions: | ||
|
||
`--regex "name=(?<first>\w+)\/(?<last>\w+)"` | ||
`--regex "name=(?<first>\w+)\/(?<last>\w+)"` | ||
|
||
==== Filter | ||
|
||
Keep records that match a SpEL boolean expression. | ||
|
||
`--filter "value matches '\\d+'"` will only keep records where the `value` field is a series of digits. | ||
|
||
|