Class: AuctionFunCore::Repos::StaffContext::StaffRepository
- Inherits:
-
Object
- Object
- AuctionFunCore::Repos::StaffContext::StaffRepository
- Defined in:
- lib/auction_fun_core/repos/staff_context/staff_repository.rb
Overview
SQL repository for staffs.
Instance Method Summary collapse
-
#all ⇒ Array<ROM::Struct::Staff>, []
Returns all staffs in database.
-
#by_id(id) ⇒ ROM::Struct::Staff?
Search staff in database by primary key.
-
#by_id!(id) ⇒ ROM::Struct::Auction
Search staffs in database by primary key.
-
#by_login(login) ⇒ ROM::Struct::Staff?
Search staff in database by email of phone keys.
-
#count ⇒ Integer
Returns the total number of staffs in database.
-
#exists?(conditions) ⇒ true, false
Checks if it returns any staff given one or more conditions.
-
#query(conditions) ⇒ AuctionFunCore::Relations::Staffs
Mount SQL conditions in query for search in database.
Instance Method Details
#all ⇒ Array<ROM::Struct::Staff>, []
Returns all staffs in database.
15 16 17 |
# File 'lib/auction_fun_core/repos/staff_context/staff_repository.rb', line 15 def all staffs.to_a end |
#by_id(id) ⇒ ROM::Struct::Staff?
Search staff in database by primary key.
35 36 37 |
# File 'lib/auction_fun_core/repos/staff_context/staff_repository.rb', line 35 def by_id(id) staffs.by_pk(id).one end |
#by_id!(id) ⇒ ROM::Struct::Auction
Search staffs in database by primary key.
43 44 45 |
# File 'lib/auction_fun_core/repos/staff_context/staff_repository.rb', line 43 def by_id!(id) staffs.by_pk(id).one! end |
#by_login(login) ⇒ ROM::Struct::Staff?
Search staff in database by email of phone keys.
50 51 52 |
# File 'lib/auction_fun_core/repos/staff_context/staff_repository.rb', line 50 def by_login(login) staffs.where(Sequel[email: login] | Sequel[phone: login]).one end |
#count ⇒ Integer
Returns the total number of staffs in database.
21 22 23 |
# File 'lib/auction_fun_core/repos/staff_context/staff_repository.rb', line 21 def count staffs.count end |
#exists?(conditions) ⇒ true, false
Checks if it returns any staff given one or more conditions.
58 59 60 |
# File 'lib/auction_fun_core/repos/staff_context/staff_repository.rb', line 58 def exists?(conditions) staffs.exist?(conditions) end |
#query(conditions) ⇒ AuctionFunCore::Relations::Staffs
Mount SQL conditions in query for search in database.
28 29 30 |
# File 'lib/auction_fun_core/repos/staff_context/staff_repository.rb', line 28 def query(conditions) staffs.where(conditions) end |