Class: AuctionFunCore::Repos::BidContext::BidRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/auction_fun_core/repos/bid_context/bid_repository.rb

Overview

Repository for handling repository operations related to bids.

This repository provides methods to interact with bid data in the database, including creating, updating, deleting, and retrieving bids.

Examples:

bid_repo = AuctionFunCore::Repos::BidContext::BidRepository.new

# Get the total number of bids
total_bids = bid_repo.count

# Checks if a bid exists based on the provided conditions.
bid_repo.exists?(id: 123)

See Also:

Instance Method Summary collapse

Instance Method Details

#countInteger

Returns the total number of bids in the database.

Returns:

  • (Integer)

    Total number of bids.



34
35
36
# File 'lib/auction_fun_core/repos/bid_context/bid_repository.rb', line 34

def count
  bids.count
end

#exists?(conditions) ⇒ Boolean

Checks if a bid exists based on the provided conditions.

Parameters:

  • conditions (Hash)

    The conditions to check (DSL Dataset).

Returns:

  • (Boolean)

    true if a bid exists that matches the conditions, otherwise false.



43
44
45
# File 'lib/auction_fun_core/repos/bid_context/bid_repository.rb', line 43

def exists?(conditions)
  bids.exist?(conditions)
end