atomicrecord
Version:
Super lightweight node.js ActiveRecord ORM layer for FoundationDB
28 lines (24 loc) • 703 B
text/coffeescript
module.exports = (indexName, index) ->
class AtomicIndex
name: indexName
tests: []
execute: (tr, directory, record) ->
if ( )
console.log('directory', directory)
console.log('index', )
test: (record) ->
for testName in
valid = @[testName](record)
continue if valid
return false
return true
createTest = (testName, field, value) =>
@::[testName] = (record) ->
return true if record[field] is value
return false
@::tests.push(testName)
if (index.condition)
if (typeof(index.condition) is 'function')
@::test = index.condition
else
createTest("test#{field}", field, value) for field, value of index.condition