Documentation ¶
Index ¶
- type Controller
- type CustomClaims
- type Group
- type JWTService
- type Relation
- 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) ([]*User, error)
- func (s *Service) UpdateUser(user *User) error
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 Relation ¶
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 ¶
GetUserInfo get user info
func (*Service) Initialize ¶
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:"password" validate:"required"` Avatar string `json:"avatar"` Email string `json:"email" validate:"required"` Phone string `json:"phone" validate:"required"` database.BaseModel }
Click to show internal directories.
Click to hide internal directories.