fix issue with NewService and remove unused GetById/Username
This commit is contained in:
@@ -6,7 +6,7 @@ type Service struct {
|
|||||||
store UserCRUD
|
store UserCRUD
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewService(store UserCRUD) (UserCRUD, error) {
|
func NewService(store UserCRUD) (*Service, error) {
|
||||||
if store == nil {
|
if store == nil {
|
||||||
return nil, fmt.Errorf("store is nil")
|
return nil, fmt.Errorf("store is nil")
|
||||||
}
|
}
|
||||||
@@ -19,12 +19,8 @@ func (s *Service) Create(user *User) error {
|
|||||||
return s.store.Create(user)
|
return s.store.Create(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) GetByID(id int64) (*User, error) {
|
func (s *Service) GetBy(by, value string) (*User, error) {
|
||||||
return s.store.GetByID(id)
|
return s.store.GetBy(by, value)
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Service) GetByUsername(username string) (*User, error) {
|
|
||||||
return s.store.GetByUsername(username)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) Update(user *User) error {
|
func (s *Service) Update(user *User) error {
|
||||||
|
|||||||
Reference in New Issue
Block a user