0.5.0
0.5.0
- Added a way to send dynamic key arguments as either an array or, if it's one argument, as is. For example,
User('id').yearly_bread(key: [2012]).exec()
as well asUser('id').yearly_bread(key: [2012]).exec()
. - If multiple values of a dynamic key were requested during one request, the result will be returned as an object, with the generated keys as the object keys, instead of arrays. For example:
User('radagaisus')
.books(key: 'history').smembers()
.books.key('science').smembers()
.exec ->
Will result in:
{
books: {
history: ['1776', 'The Devil in the White City']
science: ['The Selfish Gene']
}
}
Instead of:
{
books: [
['1776', 'The Devil in the White City'],
['The Selfish Gene']
]
}
- Add a new function for all dynamic key models, `key`, that stores and then uses the parameters it was supplied with as the dynamic key arguments for the command. For example:
```coffee
class User extends orpheus
constructor: ->
@set 'books', key: (genre) -> "books:#{genre}"
user = orpheus.schema.user
user(user_id)
.books.key('scifi').add('Hyperion')
.exec()
Might be more convenient than:
user(user_id)
.books.add('Hyperion', key: 'scifi')
.exec()
- Support for NodeJS 0.10 and above