21 lines
578 B
Go
21 lines
578 B
Go
package role
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
var (
|
|
ErrDuplicateCode = errors.New("role code already exists")
|
|
ErrInUse = errors.New("role is assigned to users")
|
|
)
|
|
|
|
type Repository interface {
|
|
List(ctx context.Context, filter ListFilter) (ListRoleDTO, error)
|
|
GetByID(ctx context.Context, id int64) (RoleDTO, error)
|
|
Create(ctx context.Context, dto CreateRoleDTO) (RoleDTO, error)
|
|
Update(ctx context.Context, id int64, dto UpdateRoleDTO) (RoleDTO, error)
|
|
// Delete returns ErrInUse while any live user holds the role.
|
|
Delete(ctx context.Context, id int64) error
|
|
}
|