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
SQL repository for auctions.
Instance Method Summary collapse
-
#all ⇒ Array<ROM::Struct::Auction>, []
Returns all auctions in the database.
-
#by_id(id) ⇒ ROM::Struct::Auction?
Search auction in database by primary key.
-
#by_id!(id) ⇒ ROM::Struct::Auction
Search auction in database by primary key.
-
#count ⇒ Integer
Returns the total number of auctions in database.
Instance Method Details
#all ⇒ Array<ROM::Struct::Auction>, []
Returns all auctions in the database.
15 16 17 |
# File 'lib/auction_fun_core/repos/auction_context/auction_repository.rb', line 15 def all auctions.to_a end |
#by_id(id) ⇒ ROM::Struct::Auction?
Search auction in database by primary key.
28 29 30 |
# File 'lib/auction_fun_core/repos/auction_context/auction_repository.rb', line 28 def by_id(id) auctions.by_pk(id).one end |
#by_id!(id) ⇒ ROM::Struct::Auction
Search auction in database by primary key.
36 37 38 |
# File 'lib/auction_fun_core/repos/auction_context/auction_repository.rb', line 36 def by_id!(id) auctions.by_pk(id).one! end |
#count ⇒ Integer
Returns the total number of auctions in database.
21 22 23 |
# File 'lib/auction_fun_core/repos/auction_context/auction_repository.rb', line 21 def count auctions.count end |