Documentation
¶
Index ¶
- Constants
- type AdminUsersResponse
- type ChangePasswordRequest
- type CreateUserRequest
- type CreateUserResponse
- type EmailAndPasswordRequest
- type EmailAndPasswordResponse
- type UpdateAllFieldsRequest
- type UserClient
- func (u *UserClient) AllUsers() ([]AdminUsersResponse, error)
- func (u *UserClient) ChangePassword(userId string, req ChangePasswordRequest) error
- func (u *UserClient) CreateUser(cur CreateUserRequest) (*CreateUserResponse, error)
- func (u *UserClient) Delete(userId string) (bool, error)
- func (u *UserClient) DeleteUsers(ids []string) error
- func (u *UserClient) GetByEmailAndPassword(req EmailAndPasswordRequest) (*EmailAndPasswordResponse, error)
- func (u *UserClient) GetWithID(userId string) (*AdminUsersResponse, error)
- func (u *UserClient) GetWithoutID(userId string) (*UserWithoutID, error)
- func (u *UserClient) Update(userId string, req UserUpdateRequest) (bool, error)
- func (u *UserClient) UpdateAllFields(userId string, req UpdateAllFieldsRequest) error
- func (u *UserClient) UpdateLastLogin(userId string) error
- type UserController
- type UserUpdateRequest
- type UserWithoutID
Constants ¶
View Source
const ( PASSWORD_MIN_LENGTH = 8 ERROR_PASSWORD_MIN_LENGTH = "provide password with min length %d" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminUsersResponse ¶
type AdminUsersResponse struct {
ID string `json:"id" db:"id"`
Firstname string `json:"firstname" db:"firstname"`
Lastname string `json:"lastname" db:"lastname"`
Patronymic string `json:"patronymic" db:"patronymic"`
RoleId int `json:"role_id" db:"role_id"`
Email string `json:"email" db:"email"`
LastLogin *string `json:"last_login" db:"last_login"`
}
type ChangePasswordRequest ¶
type CreateUserRequest ¶
type CreateUserResponse ¶
type EmailAndPasswordRequest ¶
type EmailAndPasswordResponse ¶
type EmailAndPasswordResponse struct {
Password string `json:"password" db:"password"`
ID string `json:"id" db:"id"`
Firstname string `json:"firstname" db:"firstname"`
Lastname string `json:"lastname" db:"lastname"`
Patronymic *string `json:"patronymic" db:"patronymic"`
RoleId int `json:"role_id" db:"role_id"`
}
type UpdateAllFieldsRequest ¶
type UserClient ¶
type UserClient struct {
// contains filtered or unexported fields
}
func (*UserClient) AllUsers ¶
func (u *UserClient) AllUsers() ([]AdminUsersResponse, error)
func (*UserClient) ChangePassword ¶
func (u *UserClient) ChangePassword(userId string, req ChangePasswordRequest) error
func (*UserClient) CreateUser ¶
func (u *UserClient) CreateUser(cur CreateUserRequest) (*CreateUserResponse, error)
func (*UserClient) DeleteUsers ¶
func (u *UserClient) DeleteUsers(ids []string) error
func (*UserClient) GetByEmailAndPassword ¶
func (u *UserClient) GetByEmailAndPassword(req EmailAndPasswordRequest) (*EmailAndPasswordResponse, error)
func (*UserClient) GetWithID ¶
func (u *UserClient) GetWithID(userId string) (*AdminUsersResponse, error)
func (*UserClient) GetWithoutID ¶
func (u *UserClient) GetWithoutID(userId string) (*UserWithoutID, error)
func (*UserClient) Update ¶
func (u *UserClient) Update(userId string, req UserUpdateRequest) (bool, error)
func (*UserClient) UpdateAllFields ¶
func (u *UserClient) UpdateAllFields(userId string, req UpdateAllFieldsRequest) error
func (*UserClient) UpdateLastLogin ¶
func (u *UserClient) UpdateLastLogin(userId string) error
type UserController ¶
type UserController interface {
CreateUser(cur CreateUserRequest) (*CreateUserResponse, error)
GetByEmailAndPassword(req EmailAndPasswordRequest) (*EmailAndPasswordResponse, error)
UpdateLastLogin(userId string) error
GetWithoutID(userId string) (*UserWithoutID, error)
Update(userId string, req UserUpdateRequest) (bool, error)
Delete(userId string) (bool, error)
ChangePassword(userId string, req ChangePasswordRequest) error
AllUsers() ([]AdminUsersResponse, error)
GetWithID(userId string) (*AdminUsersResponse, error)
UpdateAllFields(userId string, req UpdateAllFieldsRequest) error
DeleteUsers(ids []string) error
}
func NewUserClient ¶
func NewUserClient(db *sqlx.DB) UserController
type UserUpdateRequest ¶
Click to show internal directories.
Click to hide internal directories.