Documentation ¶
Index ¶
- Variables
- type Core
- func (u *Core) Add(ctx context.Context, nu NewUser, now time.Time) (User, error)
- func (u *Core) Authenticate(ctx context.Context, name, password string) (User, error)
- func (u *Core) Count(ctx context.Context) (int, error)
- func (u *Core) GetAll(ctx context.Context) ([]User, error)
- func (u *Core) GetByID(ctx context.Context, userID uuid.UUID) (User, error)
- func (u *Core) GetByIDs(ctx context.Context, userIDs []uuid.UUID) ([]User, error)
- func (u *Core) GetByUsername(ctx context.Context, username string) (User, error)
- type Mock
- func (r *Mock) Add(ctx context.Context, nu User) error
- func (r *Mock) Count(ctx context.Context) (int, error)
- func (r *Mock) GetAll(ctx context.Context) ([]User, error)
- func (r *Mock) GetByID(ctx context.Context, userID uuid.UUID) (User, error)
- func (r *Mock) GetByIDs(ctx context.Context, userIDs []uuid.UUID) ([]User, error)
- func (r *Mock) GetByUsername(ctx context.Context, username string) (User, error)
- type NewUser
- type Repo
- type Role
- type Usecase
- type UsecaseMock
- func (r *UsecaseMock) Add(ctx context.Context, nu NewUser, now time.Time) (User, error)
- func (r *UsecaseMock) Authenticate(ctx context.Context, name, password string) (User, error)
- func (r *UsecaseMock) Count(ctx context.Context) (int, error)
- func (r *UsecaseMock) GetAll(ctx context.Context) ([]User, error)
- func (r *UsecaseMock) GetByID(ctx context.Context, userID uuid.UUID) (User, error)
- func (r *UsecaseMock) GetByIDs(ctx context.Context, userIDs []uuid.UUID) ([]User, error)
- func (r *UsecaseMock) GetByUsername(ctx context.Context, username string) (User, error)
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RoleAdmin = Role{"ADMIN"} RoleUser = Role{"USER"} )
Set of possible roles for a user.
Functions ¶
This section is empty.
Types ¶
type Core ¶
type Core struct { UserRepo Repo // contains filtered or unexported fields }
func (*Core) Authenticate ¶
Authenticate finds a user by their email and verifies their password. On success, it returns a Claims User representing this user. The claims can be used to generate a token for future authentication.
type Repo ¶
type Repo interface { Add(ctx context.Context, nu User) error Count(ctx context.Context) (int, error) GetAll(ctx context.Context) ([]User, error) GetByID(ctx context.Context, userID uuid.UUID) (User, error) GetByIDs(ctx context.Context, userIDs []uuid.UUID) ([]User, error) GetByUsername(ctx context.Context, username string) (User, error) }
Repo represents user storage interface
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
Role Represents a user role in the system.
func (Role) MarshalText ¶
MarshalText implement the marshal interface for JSON conversions.
func (*Role) UnmarshalText ¶
type Usecase ¶
type Usecase interface { Add(ctx context.Context, nu NewUser, now time.Time) (User, error) Count(ctx context.Context) (int, error) GetAll(ctx context.Context) ([]User, error) GetByID(ctx context.Context, userID uuid.UUID) (User, error) GetByIDs(ctx context.Context, userIDs []uuid.UUID) ([]User, error) GetByUsername(cxt context.Context, username string) (User, error) Authenticate(ctx context.Context, name, password string) (User, error) }
Usecase represents user use cases.
type UsecaseMock ¶
func NewUsecaseMock ¶
func NewUsecaseMock() *UsecaseMock
func (*UsecaseMock) Authenticate ¶
func (*UsecaseMock) GetByUsername ¶
Click to show internal directories.
Click to hide internal directories.