Skip to content

Conversation

@seancookr
Copy link

@seancookr seancookr commented Jan 19, 2017

The goal of this PR is to define an api for dolly documents to build mango queries as defined here http://docs.couchdb.org/en/2.0.0/api/database/find.html

query[SELECTOR][name][first][second] = value
end

def operator_value_type_check operator, value

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good idea 🎉


def build_not_equal_selector name, value
@query[SELECTOR][name][NE_OPERATOR] = value
def build_exclusive_selector name, value, operator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very good! 👏

def mango_scope scope_name, scope
self.mango_scopes ||= {}
name = scope_name.to_sym
self.mango_scopes[name] = lambda { |query_object, args| Mango::Scope.new(query_object, scope, args)}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use the new lambda syntax here

self.mango_scopes[name] = ->(query_object, args) { Mango::Scope.new query_object, scope, args }

@brlanier brlanier mentioned this pull request Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants