model

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPasswordTooLong        = errors.New("password too long")
	ErrPasswordHasInvalidChar = errors.New("password has invalid char")

	ErrEmptyUserId            = errors.New("empty user id")
	ErrEmptyUsername          = errors.New("empty username")
	ErrUsernameTooLong        = errors.New("username too long")
	ErrUsernameHasInvalidChar = errors.New("username has invalid char")
)

Functions

func Decode

func Decode(ctx *gin.Context, decoder Decoder) error

Types

type ApiResp

type ApiResp struct {
	Error string `json:"error,omitempty"`
	Data  any    `json:"data,omitempty"`
}

func NewApiDataResp

func NewApiDataResp(data any) *ApiResp

func NewApiErrorResp

func NewApiErrorResp(err error) *ApiResp

func NewApiErrorStringResp

func NewApiErrorStringResp(err string) *ApiResp

func (*ApiResp) SetDate

func (ar *ApiResp) SetDate(data any)

func (*ApiResp) SetError

func (ar *ApiResp) SetError(err error)

type CreateUserReq

type CreateUserReq user.CreateUserReq

func (*CreateUserReq) Decode

func (r *CreateUserReq) Decode(ctx *gin.Context) error

func (*CreateUserReq) Validate

func (r *CreateUserReq) Validate() error

type Decoder

type Decoder interface {
	Decode(ctx *gin.Context) error
	Validate() error
}

type FormatEmptyPasswordError

type FormatEmptyPasswordError string

func (FormatEmptyPasswordError) Error

func (f FormatEmptyPasswordError) Error() string

type ListUserReq

type ListUserReq user.ListUserReq

func (*ListUserReq) Decode

func (r *ListUserReq) Decode(ctx *gin.Context) error

func (*ListUserReq) Validate

func (r *ListUserReq) Validate() error

type LoginUserReq

type LoginUserReq struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

func (*LoginUserReq) Decode

func (l *LoginUserReq) Decode(ctx *gin.Context) error

func (*LoginUserReq) Validate

func (l *LoginUserReq) Validate() error

type SetUserPasswordReq

type SetUserPasswordReq struct {
	Password string `json:"password"`
}

func (*SetUserPasswordReq) Decode

func (s *SetUserPasswordReq) Decode(ctx *gin.Context) error

func (*SetUserPasswordReq) Validate

func (s *SetUserPasswordReq) Validate() error

type SetUsernameReq

type SetUsernameReq struct {
	Username string `json:"username"`
}

func (*SetUsernameReq) Decode

func (s *SetUsernameReq) Decode(ctx *gin.Context) error

func (*SetUsernameReq) Validate

func (s *SetUsernameReq) Validate() error

type UserIDReq

type UserIDReq struct {
	ID string `json:"id"`
}

func (*UserIDReq) Decode

func (u *UserIDReq) Decode(ctx *gin.Context) error

func (*UserIDReq) Validate

func (u *UserIDReq) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL