Class: Cuprum::Collections::Basic::Commands::FindMany
- Inherits:
-
Cuprum::Collections::Basic::Command
- Object
- Cuprum::Command
- Command
- Cuprum::Collections::Basic::Command
- Cuprum::Collections::Basic::Commands::FindMany
- Includes:
- Commands::AbstractFindMany
- Defined in:
- lib/cuprum/collections/basic/commands/find_many.rb
Overview
Command for finding multiple collection items by primary key.
Instance Attribute Summary
Attributes inherited from Cuprum::Collections::Basic::Command
#collection_name, #data, #default_contract, #member_name, #options, #primary_key_name, #primary_key_type
Instance Method Summary collapse
-
#call(primary_keys: , allow_partial: false, envelope: false, scope: nil) ⇒ Cuprum::Result<Array<Hash{String, Object}>>
Queries the collection for the items with the given primary keys.
Methods inherited from Cuprum::Collections::Basic::Command
Constructor Details
This class inherits a constructor from Cuprum::Collections::Basic::Command
Instance Method Details
#call(primary_keys: , allow_partial: false, envelope: false, scope: nil) ⇒ Cuprum::Result<Array<Hash{String, Object}>>
Queries the collection for the items with the given primary keys.
The command will find and return the entities with the given primary keys. If any of the items are not found, the command will fail and return a NotFound error. If the :allow_partial option is set, the command will return a partial result unless none of the requested items are found.
When the :envelope option is true, the command wraps the items in a Hash, using the name of the collection as the key.
35 36 37 38 39 40 |
# File 'lib/cuprum/collections/basic/commands/find_many.rb', line 35 validate_parameters :call do keyword :allow_partial, Stannum::Constraints::Boolean.new, default: true keyword :envelope, Stannum::Constraints::Boolean.new, default: true keyword :primary_keys, Array keyword :scope, Cuprum::Collections::Basic::Query, optional: true end |