Class: AuctionFunCore::Repos::AuctionContext::AuctionRepository
- Inherits:
-
Object
- Object
- AuctionFunCore::Repos::AuctionContext::AuctionRepository
- Defined in:
- lib/auction_fun_core/repos/auction_context/auction_repository.rb
Overview
Repository for handling repository operations related to auctions.
This repository provides methods to interact with auction data in the database, including creating, updating, deleting, and retrieving auctions.
Instance Method Summary collapse
-
#all ⇒ Array<ROM::Struct::Auction>
Returns all auctions in the database.
-
#by_id(id) ⇒ ROM::Struct::Auction?
Retrieves an auction from the database by its primary key.
-
#by_id!(id) ⇒ ROM::Struct::Auction
Retrieves an auction from the database by its primary key, raising an error if not found.
-
#count ⇒ Integer
Returns the total number of auctions in the database.
Instance Method Details
#all ⇒ Array<ROM::Struct::Auction>
Returns all auctions in the database.
38 39 40 |
# File 'lib/auction_fun_core/repos/auction_context/auction_repository.rb', line 38 def all auctions.to_a end |
#by_id(id) ⇒ ROM::Struct::Auction?
Retrieves an auction from the database by its primary key.
55 56 57 |
# File 'lib/auction_fun_core/repos/auction_context/auction_repository.rb', line 55 def by_id(id) auctions.by_pk(id).one end |
#by_id!(id) ⇒ ROM::Struct::Auction
Retrieves an auction from the database by its primary key, raising an error if not found.
65 66 67 |
# File 'lib/auction_fun_core/repos/auction_context/auction_repository.rb', line 65 def by_id!(id) auctions.by_pk(id).one! end |
#count ⇒ Integer
Returns the total number of auctions in the database.
46 47 48 |
# File 'lib/auction_fun_core/repos/auction_context/auction_repository.rb', line 46 def count auctions.count end |