ms-tester/internal/services/user.go

30 lines
675 B
Go
Raw Normal View History

2024-08-20 11:18:23 +00:00
package services
import (
"context"
2024-10-05 16:05:29 +00:00
"git.sch9.ru/new_gate/models"
2024-08-20 11:18:23 +00:00
)
type UserStorage interface {
CreateUser(ctx context.Context, user *models.User) error
ReadUserById(ctx context.Context, userId int32) (*models.User, error)
}
type UserService struct {
userStorage UserStorage
}
func NewUserService(userStorage UserStorage) *UserService {
return &UserService{
userStorage: userStorage,
}
}
func (s *UserService) CreateUser(ctx context.Context, user *models.User) error {
return s.userStorage.CreateUser(ctx, user)
}
func (s *UserService) ReadUserById(ctx context.Context, userId int32) (*models.User, error) {
return s.userStorage.ReadUserById(ctx, userId)
}