Documentation ¶
Index ¶
- func InitHTTPEndpoints(g *echo.Group, cnt *HTTPController)
- type HTTPController
- type LoginRequest
- type NewUserOpts
- type PostgresRepo
- func (r *PostgresRepo) Create(ctx context.Context, user *User) error
- func (r *PostgresRepo) Delete(ctx context.Context, id string) error
- func (r *PostgresRepo) Get(ctx context.Context, id string) (*User, error)
- func (r *PostgresRepo) GetByUsername(ctx context.Context, username string) (*User, error)
- func (r *PostgresRepo) Update(ctx context.Context, user *User) error
- type RegisterRequest
- type Repo
- type Service
- func (s *Service) CheckPassword(ctx context.Context, username string, password string) error
- func (s *Service) Create(ctx context.Context, dto NewUserOpts) error
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) Get(ctx context.Context, id string) (UserResponse, error)
- func (s *Service) GetByUsername(ctx context.Context, username string) (UserResponse, error)
- type User
- type UserResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitHTTPEndpoints ¶
func InitHTTPEndpoints(g *echo.Group, cnt *HTTPController)
Types ¶
type HTTPController ¶
type HTTPController struct {
// contains filtered or unexported fields
}
func NewHTTPController ¶
func NewHTTPController(svc *Service) *HTTPController
func (*HTTPController) Login ¶
func (cnt *HTTPController) Login(c echo.Context) error
func (*HTTPController) Register ¶
func (cnt *HTTPController) Register(c echo.Context) error
type LoginRequest ¶
type NewUserOpts ¶
type PostgresRepo ¶
type PostgresRepo struct {
// contains filtered or unexported fields
}
func NewPostgresRepo ¶
func NewPostgresRepo(db *pgxpool.Pool) *PostgresRepo
func (*PostgresRepo) GetByUsername ¶
type RegisterRequest ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CheckPassword ¶
func (*Service) GetByUsername ¶
type User ¶
type User struct { ID string Username string Email string HashedPassword []byte About string CreatedAt time.Time UpdatedAt time.Time DeletedAt *time.Time }
func NewUser ¶
func NewUser(opts NewUserOpts) *User
func (*User) UpdateAbout ¶
func (*User) UpdateEmail ¶
func (*User) UpdatePassword ¶
type UserResponse ¶
type UserResponse struct { ID string `json:"id"` Username string `json:"username"` Email string `json:"email"` About string `json:"about"` CreatedAt time.Time `json:"createdAt"` }
UserResponse represent user information that will be sent to outside of this module
func ToUserResponse ¶
func ToUserResponse(u *User) UserResponse
Click to show internal directories.
Click to hide internal directories.