Skip to content

Instantly share code, notes, and snippets.

@mattapperson
Created June 3, 2015 21:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattapperson/985ae598318b0e373704 to your computer and use it in GitHub Desktop.
Save mattapperson/985ae598318b0e373704 to your computer and use it in GitHub Desktop.
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