Matcher

Summary

The Matcher class encapsulates a particular comparison clause on an {Attribute}. Matchers can evaluate whether or not an object matches them, and also compose SQL clauses for the DatabaseStore. Each matcher has a reference to a model attribute, a comparator and a value.


// Retrieving Matchers

isUnread = Thread.attributes.unread.equal(true)

hasLabel = Thread.attributes.categories.contains('label-id-123')

// Using Matchers in Database Queries

DatabaseStore.findAll(Thread).where(isUnread)...

// Using Matchers to test Models

threadA = new Thread(unread: true)
threadB = new Thread(unread: false)

isUnread.evaluate(threadA)
// => true
isUnread.evaluate(threadB)
// => false

results matching ""

    No results matching ""