Documentation ¶
Index ¶
- Constants
- func MustAdmin() gin.HandlerFunc
- type Controller
- type CustomClaims
- type Group
- type JWTService
- type ListUserResponse
- type LoginRequest
- type Relation
- type ResetPasswordRequest
- type Service
- func (s *Service) AddUser(user *User) error
- func (s *Service) DeleteUser(userID string) error
- func (s *Service) DetailUser(userID string) (*User, error)
- func (s *Service) GetAvailableOAuth() []oauth.AvailableOAuth
- func (s *Service) GetOAuthToken(authType string, code string) (token string, err error)
- func (s *Service) GetOAuthURL(authType string, redirectURL string) (string, error)
- func (s *Service) GetOAuthUserInfo(authType string, code string) (*oauth.UserInfo, error)
- func (s *Service) Initialize() error
- func (s *Service) ListUser(user *User) ([]*ListUserResponse, error)
- func (s *Service) Login(user *LoginRequest) (string, error)
- func (s *Service) ResetPassword(user *ResetPasswordRequest, IsAdmin bool) error
- func (s *Service) SetUserStatus(user *User, status int) error
- func (s *Service) UpdateUser(user *User) error
- type Uid
- type User
Constants ¶
View Source
const ( StatusInactive = iota StatusActive StatusBan StatusInactiveReason = "inactive" StatusActiveReason = "active" StatusBanReason = "banned" )
View Source
const ( TypeLocal = iota TypeOAuth )
Variables ¶
This section is empty.
Functions ¶
func MustAdmin ¶ added in v0.0.6
func MustAdmin() gin.HandlerFunc
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController() *Controller
func (*Controller) RegisterRoute ¶
func (c *Controller) RegisterRoute(group *gin.RouterGroup)
type CustomClaims ¶
type CustomClaims struct { User *User jwt.RegisteredClaims }
type Group ¶
type JWTService ¶
type JWTService struct {
// contains filtered or unexported fields
}
func GetJWTService ¶
func GetJWTService() *JWTService
func NewJWTService ¶
func NewJWTService(cfg *config.Config) *JWTService
func (*JWTService) CreateToken ¶
func (s *JWTService) CreateToken(user *User) (string, error)
func (*JWTService) ParseToken ¶
func (s *JWTService) ParseToken(tokenString string) (*User, error)
type ListUserResponse ¶ added in v0.0.6
type LoginRequest ¶ added in v0.0.6
type Relation ¶
type ResetPasswordRequest ¶ added in v0.0.6
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func GetService ¶
func GetService() *Service
func (*Service) DeleteUser ¶
DeleteUser delete user
func (*Service) DetailUser ¶
DetailUser detail user
func (*Service) GetAvailableOAuth ¶
func (s *Service) GetAvailableOAuth() []oauth.AvailableOAuth
GetAvailableOAuth get available oauth
func (*Service) GetOAuthToken ¶
func (*Service) GetOAuthURL ¶
GetOAuthURL get oauth url
func (*Service) GetOAuthUserInfo ¶
GetOAuthUserInfo get user info
func (*Service) Initialize ¶
func (*Service) ListUser ¶
func (s *Service) ListUser(user *User) ([]*ListUserResponse, error)
ListUser list user
func (*Service) ResetPassword ¶ added in v0.0.6
func (s *Service) ResetPassword(user *ResetPasswordRequest, IsAdmin bool) error
func (*Service) SetUserStatus ¶ added in v0.0.6
type User ¶
type User struct { ID string `json:"id" gorm:"primary_key;" swaggerignore:"true"` Username string `json:"username" gorm:"unique;not null" validate:"required"` Nickname string `json:"nickname" validate:"required"` Password string `json:"-"` Avatar string `json:"avatar"` Email string `json:"email" validate:"required"` Phone string `json:"phone"` Type int `json:"type"` Status int `json:"status"` StatusReason string `json:"statusReason"` database.BaseModel }
Click to show internal directories.
Click to hide internal directories.