Skip to content

Allow predicate objects to contain lambdas #3485

Open

Description

@marshall007

For terms like filter, update, etc it would be nice if you could specify a callback which gets evaluated with (value, row) as its arguments. For example:

r.table('foo').filter({
  bar: function (value, row) {
    // value === row('bar')
    return value.ne('baz');
  },
  other: false
})

After support for lambdas is in place, certain RQL terms (like r.ne()) could support being partially applied, so the example above would then look like this:

r.table('foo').filter({
  bar: r.ne('baz'),
  other: false
})

Activity

  1. danielmewes commented on Jan 2, 2015

    @danielmewes
    Member

    Thanks for your suggestion @marshall007 .
    I especially like the syntax in your second example.

    Putting it into backlog for now since there are some more important changes, but we'll keep it on the list.

  2. added this to the backlog milestone on Jan 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions