Module: Cuprum::Collections::Commands::AbstractFindMany

Includes:
ParameterValidation
Included in:
Basic::Commands::FindMany
Defined in:
lib/cuprum/collections/commands/abstract_find_many.rb

Overview

Abstract implementation of the FindMany command.

Instance Method Summary collapse

Instance Method Details

#call(primary_keys:, allow_partial: false, envelope: false) ⇒ 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.

Parameters:

  • allow_partial (Boolean) (defaults to: false)

    If true, passes if any of the items are found.

  • envelope (Boolean) (defaults to: false)

    If true, wraps the result value in a Hash.

  • primary_keys (Array)

    The primary keys of the requested items.

Returns:

  • (Cuprum::Result<Array<Hash{String, Object}>>)

    a result with the requested items.



33
# File 'lib/cuprum/collections/commands/abstract_find_many.rb', line 33

validate :allow_partial, :boolean, optional: true