Skip to content

Commit

Permalink
🗃️ Remove CountUser function
Browse files Browse the repository at this point in the history
  • Loading branch information
0x46616c6b committed Oct 23, 2023
1 parent 8d52e40 commit 4fe63cc
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 42 deletions.
24 changes: 0 additions & 24 deletions internal/storage/mock_Storage.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions internal/storage/sql_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ func NewSqlStorage(db *gorm.DB, uploadPath string) *SqlStorage {
}
}

func (s *SqlStorage) CountUser() (int, error) {
var count int64
err := s.DB.Model(&User{}).Count(&count).Error

return int(count), err
}

func (s *SqlStorage) FindUsers() ([]User, error) {
users := make([]User, 0)
err := s.DB.Find(&users).Error
Expand Down
10 changes: 0 additions & 10 deletions internal/storage/sql_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ var _ = Describe("SqlStorage", func() {
db.Exec("DELETE FROM uploads")
})

Describe("CountUser", func() {
It("returns the number of users", func() {
Expect(store.CountUser()).To(Equal(0))

err := db.Create(&User{}).Error
Expect(err).ToNot(HaveOccurred())
Expect(store.CountUser()).To(Equal(1))
})
})

Describe("FindUsers", func() {
It("returns all users", func() {
users, err := store.FindUsers()
Expand Down
1 change: 0 additions & 1 deletion internal/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
var log = logrus.WithField("package", "storage")

type Storage interface {
CountUser() (int, error)
FindUsers() ([]User, error)
FindUserByID(id int) (User, error)
FindUsersByIDs(ids []int) ([]User, error)
Expand Down

0 comments on commit 4fe63cc

Please sign in to comment.