Class: AWS::DynamoDB::ItemCollection::FilterBuilder
- Inherits:
-
Object
- Object
- AWS::DynamoDB::ItemCollection::FilterBuilder
- Includes:
- Types
- Defined in:
- lib/aws/dynamo_db/item_collection.rb
Overview
Provides a convenient syntax for expressing scan filters.
table.items.where(:path).begins_with("users/")
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
-
#begins_with(value) ⇒ ItemCollection
Filters the collection to include only those items where this attribute begins with the argument.
-
#between(min, max) ⇒ ItemCollection
Filters the collection to include only those items where this attribute is between the two arguments.
-
#contains(value) ⇒ ItemCollection
Filters the collection to include only those items where this attribute contains the argument.
-
#does_not_contain(value) ⇒ ItemCollection
Filters the collection to include only those items where this attribute does not contain the argument.
-
#equals(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is equal to the argument.
-
#greater_than(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is greater than the argument.
-
#gte(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is greater than or equal to the argument.
-
#in(*values) ⇒ ItemCollection
Filters the collection to include only those items where this attribute equals one of the arguments.
-
#initialize(items, attribute) ⇒ FilterBuilder
constructor
A new instance of FilterBuilder.
-
#is_null ⇒ ItemCollection
Filters the collection to include only those items where this attribute does not exist.
-
#less_than(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is less than the argument.
-
#lte(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is less than or equal to the argument.
-
#not_equal_to(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is not equal to the argument.
-
#not_null ⇒ ItemCollection
Filters the collection to include only those items where this attribute exists.
Methods included from Types
#format_attribute_value, #value_from_response, #values_from_response_hash
Constructor Details
#initialize(items, attribute) ⇒ FilterBuilder
Returns a new instance of FilterBuilder.
263 264 265 266 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 263 def initialize(items, attribute) @items = items @attribute = attribute end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
260 261 262 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 260 def attribute @attribute end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
258 259 260 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 258 def items @items end |
Instance Method Details
#begins_with(value) ⇒ ItemCollection
Filters the collection to include only those items where this attribute begins with the argument.
393 394 395 |
# 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) ⇒ ItemCollection
Filters the collection to include only those items where this attribute is between the two arguments.
418 419 420 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 418 def between min, max @items.with_filter(attribute, "BETWEEN", min, max) end |
#contains(value) ⇒ ItemCollection
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.
366 367 368 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 366 def contains value @items.with_filter(attribute, "CONTAINS", value) end |
#does_not_contain(value) ⇒ ItemCollection
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.
382 383 384 |
# 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) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is equal to the argument.
275 276 277 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 275 def equals value @items.with_filter(attribute, "EQ", value) end |
#greater_than(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is greater than the argument.
308 309 310 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 308 def greater_than value @items.with_filter(attribute, "GT", value) end |
#gte(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is greater than or equal to the argument.
332 333 334 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 332 def gte value @items.with_filter(attribute, "GE", value) end |
#in(*values) ⇒ ItemCollection
Filters the collection to include only those items where this attribute equals one of the arguments.
405 406 407 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 405 def in *values @items.with_filter(attribute, "IN", *values) end |
#is_null ⇒ ItemCollection
Filters the collection to include only those items where this attribute does not exist.
341 342 343 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 341 def is_null @items.with_filter(attribute, "NULL") end |
#less_than(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is less than the argument.
297 298 299 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 297 def less_than value @items.with_filter(attribute, "LT", value) end |
#lte(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is less than or equal to the argument.
320 321 322 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 320 def lte value @items.with_filter(attribute, "LE", value) end |
#not_equal_to(value) ⇒ ItemCollection
Filters the collection to include only those items where the value of this attribute is not equal to the argument.
286 287 288 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 286 def not_equal_to value @items.with_filter(attribute, "NE", value) end |
#not_null ⇒ ItemCollection
Filters the collection to include only those items where this attribute exists.
350 351 352 |
# File 'lib/aws/dynamo_db/item_collection.rb', line 350 def not_null @items.with_filter(attribute, "NOT_NULL") end |