37 lines
574 B
Go
37 lines
574 B
Go
package user
|
|
|
|
import (
|
|
"errors"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type (
|
|
UserRepository interface {
|
|
UserByID(ID ID) (User, error)
|
|
UserByUsername(username string) (User, error)
|
|
CreateUser(user NewUserTemplate) (User, error)
|
|
}
|
|
|
|
User interface {
|
|
ID() uuid.UUID
|
|
Username() string
|
|
DisplayName() string
|
|
Roles() []Role
|
|
SetPassword() string
|
|
CheckPassword(password string) bool
|
|
}
|
|
|
|
NewUserTemplate interface {
|
|
Username() string
|
|
Password() string
|
|
DisplayName() string
|
|
}
|
|
|
|
ID uuid.UUID
|
|
Role string
|
|
)
|
|
|
|
var (
|
|
ErrUserNotFound = errors.New("user not found")
|
|
)
|