Documentation ¶
Index ¶
- Constants
- func ChangePassword(c *gin.Context)
- func CreateUser(c *gin.Context)
- func CreateUserProject(c *gin.Context)
- func DeleteUser(c *gin.Context)
- func DeleteUserProject(c *gin.Context)
- func ForgotPassword(c *gin.Context)
- func GetUserInfo(c *gin.Context)
- func Init(c *gin.Context)
- func List(c *gin.Context)
- func RestPassword(c *gin.Context)
- func UpdateUser(c *gin.Context)
- func UserProjectList(c *gin.Context)
- type User
- type UserLoginInfo
- type UserProject
- type UserProjectVO
- type UserService
Constants ¶
View Source
const ( SuperManager = 1 Manager = 2 Developer = 3 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type User ¶
type User struct { ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key"` UserName string `json:"username" gorm:"type:varchar(10);unique_index"` Email string `json:"email"` Password string `json:"password"` Status int `json:"status"` RoleNum int `` /* 143-byte string literal not displayed */ CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
type UserLoginInfo ¶
type UserProject ¶
type UserProject struct { ID int `json:"id" gorm:"AUTO_INCREMENT;primary_key"` UserID int `json:"userID"` ProjectID int `json:"projectID"` CreateUser int `json:"createUser"` }
func (UserProject) TableName ¶
func (UserProject) TableName() string
设置UserProject的表名为`user_project`
type UserProjectVO ¶
type UserService ¶
type UserService interface { GetUserInfo(userObj User) (user User, err error) //获取登录用户信息,包含权限信息 GetLoginUserInfo(userObj User) (user UserLoginInfo, err error) GetUserList(offset, limit int, userObj User) (user []User, count int, err error) GetUserProjects(offset, limit int, userObj User) (userProjects []UserProjectVO, count int, err error) CreateUser(user *User) (err error) CreateUserProject(userProject *UserProject) (err error) UpdateUser(userID int, user *User) (err error) DeleteUser(userID int) (err error) DeleteUserProject(upID int) (err error) //获取项目关联用户 GetProjectUsersEmail(projectName string) (emails []string, err error) }
*
面向接口开发: 面向接口开发的好处是要对下面的函数进行测试时,不需要依赖一个全局的mysql连接,只需要调用NewService传一个mysql连接参数即可测试
Click to show internal directories.
Click to hide internal directories.