Documentation
¶
Index ¶
Constants ¶
View Source
const (
AppName = "user"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateUserRequest ¶
type CreateUserRequest struct { Username string `json:"username" gorm:"column:username"` Password string `json:"password" gorm:"column:password"` Role Role `json:"role"` Label map[string]string `json:"label" gorm:"serializer:json"` IsHashed bool `json:"is_hashed" gorm:"column:is_hashed"` }
func NewCreateUserRequest ¶
func NewCreateUserRequest() *CreateUserRequest
func (*CreateUserRequest) PasswordHash ¶
func (req *CreateUserRequest) PasswordHash()
func (*CreateUserRequest) Validate ¶
func (req *CreateUserRequest) Validate() error
type DeleteUserRequest ¶
type DeleteUserRequest struct {
Id int64 `json:"id"`
}
type QueryUserRequest ¶
type QueryUserRequest struct { Queryby QueryBy `json:"query_by"` QueryValue string `json:"query_value"` }
func NewQueryUserRequestById ¶
func NewQueryUserRequestById(id string) *QueryUserRequest
func NewQueryUserRequestByUsername ¶
func NewQueryUserRequestByUsername(username string) *QueryUserRequest
type Service ¶
type Service interface { CreateUser(context.Context, *CreateUserRequest) (*User, error) DeleteUser(context.Context, *DeleteUserRequest) error QueryUser(context.Context, *QueryUserRequest) (*User, error) }
type User ¶
type User struct { Id int64 `json:"id"` CreatedAt int64 `json:"created_at"` //not datetime as it increases complexity (timezones, etc.) UpdatedAt int64 `json:"updated_at"` *CreateUserRequest }
User represents the user entity
func NewUser ¶
func NewUser(req *CreateUserRequest) *User
func (*User) ValidatePassword ¶
Click to show internal directories.
Click to hide internal directories.