Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrUserNotFound = errors.New("user not found")
Functions ¶
This section is empty.
Types ¶
type UserRepository ¶
type UserRepository interface {
FindAll() []*User
FindByID(id string) (*User, error)
Create(u *User) *User
Update(id string, u *User) (*User, error)
Delete(id string) error
}
UserRepository is the port — domain defines what it needs.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService contains business logic. Depends only on interfaces.
func NewUserService ¶
func NewUserService(repo UserRepository) *UserService
func (*UserService) Create ¶
func (s *UserService) Create(u *User) *User
func (*UserService) Delete ¶
func (s *UserService) Delete(id string) error
func (*UserService) List ¶
func (s *UserService) List() []*User
Click to show internal directories.
Click to hide internal directories.