Provides a convenient syntax for expressing scan filters.
table.items.where(:path).begins_with("users/")
@private
# File lib/aws/dynamo_db/item_collection.rb, line 263 def initialize(items, attribute) @items = items @attribute = attribute end
Filters the collection to include only those items where this attribute begins with the argument.
@param [String] value The value to compare against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 393 def begins_with value @items.with_filter(attribute, "BEGINS_WITH", value) end
Filters the collection to include only those items where this attribute is between the two arguments.
@param [String, Numeric] min The minimum value.
@param [String, Numeric] max The maximum value.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 418 def between min, max @items.with_filter(attribute, "BETWEEN", min, max) end
Filters the collection to include only those items where this attribute contains the argument. If the attribute value is a set, this filter matches items where the argument is one of the values in the set. If the attribute value is a string, this filter matches items where the argument (which must be a string) is a substring of the attribute value.
@param [String, Numeric] value The value to compare against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 366 def contains value @items.with_filter(attribute, "CONTAINS", value) end
Filters the collection to include only those items where this attribute does not contain the argument. If the attribute value is a set, this filter matches items where the argument is not present in the set. If the attribute value is a string, this filter matches items where the argument (which must be a string) is not a substring of the attribute value.
@param [String, Numeric] value The value to compare against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 382 def does_not_contain value @items.with_filter(attribute, "NOT_CONTAINS", value) end
Filters the collection to include only those items where the value of this attribute is equal to the argument.
@param [String, Numeric] value The value to compare against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 275 def equals value @items.with_filter(attribute, "EQ", value) end
Filters the collection to include only those items where the value of this attribute is greater than the argument.
@param [String, Numeric] value The value to compare against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 308 def greater_than value @items.with_filter(attribute, "GT", value) end
Filters the collection to include only those items where the value of this attribute is greater than or equal to the argument.
@param [String, Numeric] value The value to compare against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 332 def gte value @items.with_filter(attribute, "GE", value) end
Filters the collection to include only those items where this attribute equals one of the arguments.
@param [Array<String, Numeric>] values The values to compare
against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 405 def in *values @items.with_filter(attribute, "IN", *values) end
Filters the collection to include only those items where this attribute does not exist.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 341 def is_null @items.with_filter(attribute, "NULL") end
Filters the collection to include only those items where the value of this attribute is less than the argument.
@param [String, Numeric] value The value to compare against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 297 def less_than value @items.with_filter(attribute, "LT", value) end
Filters the collection to include only those items where the value of this attribute is less than or equal to the argument.
@param [String, Numeric] value The value to compare against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 320 def lte value @items.with_filter(attribute, "LE", value) end
Filters the collection to include only those items where the value of this attribute is not equal to the argument.
@param [String, Numeric] value The value to compare against.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 286 def not_equal_to value @items.with_filter(attribute, "NE", value) end
Filters the collection to include only those items where this attribute exists.
@return [ItemCollection] A new item collection filtered by
this condition.
# File lib/aws/dynamo_db/item_collection.rb, line 350 def not_null @items.with_filter(attribute, "NOT_NULL") end