Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couchdb2 mango query interface #128

Open
wants to merge 69 commits into
base: couchdb2
Choose a base branch
from

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 🎉

end

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