Navigation Menu

Skip to content

Commit

Permalink
Document in_values
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 13, 2017
1 parent 6e0f4ad commit 6794a20
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/groonga/client/request/select.rb
Expand Up @@ -78,6 +78,19 @@ def query(value)
# external should be escaped.
#
# Adds a `#{expression % values}` condition.
#
# @overload filter
#
# @example: Use in_values function
# request.
# filter.in_values("tags", "tag1", "tag2")
# # -> --filter 'in_values(tags, "tag1", "tag2")'
#
# Returns a request object for filter condition. It provides
# convenient methods to add a popular filter condition.
#
# @return [Groonga::Client::Request::Select::Filter]
# The new request object for setting a filter condition.
def filter(expression_or_column_name=nil, values_or_value=nil)
if expression_or_column_name.nil? and values_or_value.nil?
return Filter.new(self)
Expand Down Expand Up @@ -162,6 +175,23 @@ def initialize(request)
@request = request
end

# @example: Use in_values function
# request.
# filter.in_values("tags", "tag1", "tag2").
# # -> --filter 'in_values(tags, "tag1", "tag2")'
# filter("user", "alice")
# # -> --filter '(in_values(tags, "tag1", "tag2")) && (user == "alice")'
#
# @param [String, Symbol] column_name The target column name.
#
# @param [Object] values The column values that cover target
# column values.
#
# Adds a `in_values` condition then return a new `select`
# request object.
#
# @return [Groonga::Client::Request::Select]
# The new request with the given condition.
def in_values(column_name, *values)
add_parameter(FilterMerger,
FilterInValuesParameters.new(column_name, *values))
Expand Down

0 comments on commit 6794a20

Please sign in to comment.