Download the PHP package keboola/filter without Composer
On this page you can find all versions of the php package keboola/filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download keboola/filter
More information about keboola/filter
Files in keboola/filter
Package filter
Short Description Simple comparison filter
License MIT
Informations about the package filter
Filter
Description
Compare values in objects against pre-set values in the filter. The filter is constructed from a string with a key (field name in the the object), operator and a value to be compared against. Then an object is passed to the filter and evaluated whether it passes the filter or not.
Usage
- The filter is whitespace sensitive, therefore
value == 100
will look intovalue␣
for a␣100
value, instead ofvalue
and100
as likely desired. - Correct use:
value==100
- Wrong use:
value == 100
Supported comparison operators
<
-- less than>
-- greater than==
-- equals<=
-- less or equals>=
-- greater or equals!=
-- not equals~~
-- like!~
-- not like
Like operator
Like (and not like) operator allows you to use partial matching. Use a
percent %
character in the target value to match any number of characters, e.g.:
Supported logical operators
With logical operators you can combine multiple conditions together. You can combine both conditions with different values and conditions with different keys. Supported logical operators:
&
-- logical and|
-- logical or
Usage
- Case 1: Object's
status
must beenabled
andage
must be over18
status==enabled&age>18
compareObject
on this object will return true
.
compareObject
on this object will return false
.
- Case 2: Object's
status
must benew
orudated
status==new|status==updated
compareObject
on this object will return true
.
compareObject
on this object will return true
.
compareObject
on this object will return false
.
Combining logical operators
Parentheses are not supported, however the standard operator precedence is
applied (&
precedes |
). For example, the expression
a==b&c==d|e==f
is interpreted as (a==b&c==d)|e==f
and the
expression a==b&c==d|e==f&g==h
translates into (a==b&c==d)|(e==f&g==h)
.