-
-
Save mattapperson/985ae598318b0e373704 to your computer and use it in GitHub Desktop.
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
function operators(stream,operations) | |
-- operations looks like this, forgive the JS syntax: [{operator: 'not_equal', key: 'name', value: 'apperson'}] | |
local tempStream = stream | |
local currentOP | |
local _Operators = { | |
not_equal = function(record) | |
info("Hello from foo bar") | |
-- somehow also pass in the key / value of the operation | |
return record[currentOP[key]] ~= currentOP[value] | |
end | |
}; | |
for i, operation in ipairs(operations) do | |
currentOP = operation | |
tempStream = tempStream:filter(_Operators[operation.operator]) | |
end | |
return tempStream | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment