class AWS::DynamoDB::ItemCollection::FilterBuilder

Provides a convenient syntax for expressing scan filters.

table.items.where(:path).begins_with("users/")

Attributes

attribute[R]
items[R]

Public Class Methods

new(items, attribute) click to toggle source

@private

# File lib/aws/dynamo_db/item_collection.rb, line 263
def initialize(items, attribute)
  @items = items
  @attribute = attribute
end

Public Instance Methods

begins_with(value) click to toggle source

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
between(min, max) click to toggle source

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
contains(value) click to toggle source

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
does_not_contain(value) click to toggle source

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
equals(value) click to toggle source

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
greater_than(value) click to toggle source

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
gte(value) click to toggle source

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
in(*values) click to toggle source

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
is_null() click to toggle source

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
less_than(value) click to toggle source

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
lte(value) click to toggle source

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
not_equal_to(value) click to toggle source

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
not_null() click to toggle source

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