user

package
v0.0.0-...-3839eb7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Count

func Count(db *gorm.DB) (int64, error)

func CreateUser

func CreateUser(db *gorm.DB, user entity.User) error

func GenerateUserId

func GenerateUserId() string

func GetUserByEmail

func GetUserByEmail(db *gorm.DB, email string) (entity.User, bool, error)

func GetUserById

func GetUserById(db *gorm.DB, id uint) (entity.User, bool, error)

func GetUserByName

func GetUserByName(db *gorm.DB, username string) (entity.User, bool, error)

func GetUserByUUID

func GetUserByUUID(db *gorm.DB, uuid string) (entity.User, bool, error)

func ListAllUserRoles

func ListAllUserRoles(db *gorm.DB, userId uint) ([]entity.Role, error)

func ListAllUsers

func ListAllUsers(db *gorm.DB) ([]entity.User, error)

ListAllUsers in most time, you should use ListByPage

func ListByPage

func ListByPage(db *gorm.DB, pageOpt user.PageOption) ([]entity.User, error)

func RemoveByUUID

func RemoveByUUID(db *gorm.DB, uuid string) error

func RemoveUser

func RemoveUser(db *gorm.DB, id uint) error

func UpdateUserInfo

func UpdateUserInfo(db *gorm.DB, user entity.User) error

Types

type AdminHandler

type AdminHandler struct {
	// contains filtered or unexported fields
}

func NewAdminHandler

func NewAdminHandler(info UserInfo, modify UserModify) AdminHandler

func (AdminHandler) CreateUser

func (a AdminHandler) CreateUser(ctx *gin.Context)

CreateUser @Summary CreateUser @Description [admin] @Description create new user @Tags user @Accept json @Produce json @Param createOpt body user.CreateUserOption true "CreateUserOption" @Success 200 {object} types.Response @Router /user/admin/create [POST] @security BearerAuth

func (AdminHandler) GetSpecUserInfo

func (a AdminHandler) GetSpecUserInfo(ctx *gin.Context)

GetSpecUserInfo @Summary GetSpecUserInfo @Description [admin] @Description get specified user information @Tags user @Accept json @Produce json @Param uuid query system.Uid true "user uuid" @Success 200 {object} types.Response @Router /user/admin/profile [GET] @security BearerAuth

func (AdminHandler) GetUserInfoList

func (a AdminHandler) GetUserInfoList(ctx *gin.Context)

GetUserInfoList @Summary GetUserInfoList @Description [admin] @Description get specific user list @Tags user @Accept json @Produce json @Param userPageOptIon query user.PageOption true "comment" @Success 200 {object} types.Response{data=[]user.Info} @Router /user/admin/list [GET] @security BearerAuth

func (AdminHandler) RemoveUser

func (a AdminHandler) RemoveUser(ctx *gin.Context)

RemoveUser @Summary RemoveUser @Description [admin] @Description Remove the specific user @Tags user @Accept json @Produce json @Param uuid query system.Uid true "uuid" @Success 200 {object} types.Response @Router /user/admin/remove [DELETE] @security BearerAuth

func (AdminHandler) SaveUser

func (a AdminHandler) SaveUser(ctx *gin.Context)

SaveUser @Summary SaveUser @Description [admin] @Description save specified user information @Tags user @Accept json @Produce json @Param updateInfoOption body user.SaveUserDetailOption true "updateInfoOption" @Success 200 {object} types.Response @Router /user/admin/profile [POST] @security BearerAuth

type Handler

type Handler struct {
	Info  InfoHandler
	Admin AdminHandler
}

type HandlerRouter

type HandlerRouter types.NopType

HandlerRouter just for wire injection, no real influence

func SetupRouter

func SetupRouter(api *ginx.RouterGroup, handler Handler) HandlerRouter

type InfoHandler

type InfoHandler struct {
	// contains filtered or unexported fields
}

func NewInfoHandler

func NewInfoHandler(info UserInfo, modify UserModify) InfoHandler

func (InfoHandler) GetUserInfo

func (i InfoHandler) GetUserInfo(ctx *gin.Context)

GetUserInfo @Summary GetUserInfo @Description user @Description get own user info @Tags user @Accept json @Produce json @Success 200 {object} types.Response{data=user.Info} @Router /user/profile [GET] @security BearerAuth

func (InfoHandler) UpdateUserInfo

func (i InfoHandler) UpdateUserInfo(ctx *gin.Context)

UpdateUserInfo @Summary UpdateUserInfo @Description user @Description update own user info @Tags user @Accept json @Produce json @Param updateInfoOption body user.UpdateInfoOption true "updateInfoOption" @Success 200 {object} types.Response @Router /user/profile [POST] @security BearerAuth

type Sha256UUIDGen

type Sha256UUIDGen struct{}

func (Sha256UUIDGen) Generate

func (s Sha256UUIDGen) Generate() string

type UserIdGenerator

type UserIdGenerator interface {
	Generate() string
}

type UserInfo

type UserInfo struct {
	// contains filtered or unexported fields
}

func NewUserInfo

func NewUserInfo(ds *data.DataSource) UserInfo

func (UserInfo) GetUserInfoByEmail

func (u UserInfo) GetUserInfoByEmail(email string) (user.Info, error)

func (UserInfo) GetUserInfoById

func (u UserInfo) GetUserInfoById(userId uint) (user.Info, error)

func (UserInfo) GetUserInfoByName

func (u UserInfo) GetUserInfoByName(name string) (user.Info, error)

func (UserInfo) GetUserInfoByUUID

func (u UserInfo) GetUserInfoByUUID(uuid string) (user.Info, error)

func (UserInfo) GetUserInfoList

func (u UserInfo) GetUserInfoList(opt user.PageOption) ([]user.Info, error)

func (UserInfo) GetUserRoleCodes

func (u UserInfo) GetUserRoleCodes(uuid string) ([]string, error)

func (UserInfo) GetUserRoles

func (u UserInfo) GetUserRoles(uuid string) ([]role.RoleInfo, error)

type UserModify

type UserModify struct {
	// contains filtered or unexported fields
}

func NewUserModify

func NewUserModify(ds *data.DataSource, userInfo UserInfo) UserModify

func (UserModify) Create

func (u UserModify) Create(createOpt user.CreateUserOption) error

func (UserModify) Remove

func (u UserModify) Remove(uuid string) error

func (UserModify) Save

func (u UserModify) Save(saveOpt user.SaveUserDetailOption) error

func (UserModify) SaveRoles

func (u UserModify) SaveRoles(uuid string, saveRoleIds []uint) error

func (UserModify) SaveRolesByCode

func (u UserModify) SaveRolesByCode(uuid string, codes []string) error

func (UserModify) Update

func (u UserModify) Update(updateOpt user.UpdateInfoOption) error

Jump to

Keyboard shortcuts

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