user

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

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 Group struct {
	ID     uuid.UUID `json:"id" gorm:"primary_key;type:uuid;" swaggerignore:"true" example:"00000000-0000-0000-0000-000000000000"`
	Title  string    `json:"title" gorm:"unique;not null" validate:"required"`
	Remark string    `json:"remark"`

	database.BaseModel
}

func (*Group) BeforeCreate

func (g *Group) BeforeCreate(tx *gorm.DB) error

func (*Group) TableName

func (g *Group) TableName() string

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 Relation struct {
	UserID  string    `json:"user_id" gorm:"not null" validate:"required"`
	GroupID uuid.UUID `json:"group_id" gorm:"not null;type:uuid;" validate:"required"`
}

func (*Relation) TableName

func (r *Relation) TableName() string

type Service

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

func GetService

func GetService() *Service

func (*Service) AddUser

func (s *Service) AddUser(user *User) error

AddUser add user

func (*Service) DeleteUser

func (s *Service) DeleteUser(userID string) error

DeleteUser delete user

func (*Service) DetailUser

func (s *Service) DetailUser(userID string) (*User, error)

DetailUser detail user

func (*Service) GetAvailableOAuth

func (s *Service) GetAvailableOAuth() []oauth.AvailableOAuth

GetAvailableOAuth get available oauth

func (*Service) GetOAuthToken

func (s *Service) GetOAuthToken(authType string, code string) (token string, err error)

func (*Service) GetOAuthURL

func (s *Service) GetOAuthURL(authType string, redirectURL string) (string, error)

GetOAuthURL get oauth url

func (*Service) GetOAuthUserInfo

func (s *Service) GetOAuthUserInfo(authType string, code string) (*oauth.UserInfo, error)

GetUserInfo get user info

func (*Service) Initialize

func (s *Service) Initialize() error

func (*Service) ListUser

func (s *Service) ListUser(user *User) ([]*User, error)

ListUser list user

func (*Service) UpdateUser

func (s *Service) UpdateUser(user *User) error

UpdateUser update user

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
}

func (*User) BeforeCreate

func (u *User) BeforeCreate(tx *gorm.DB) error

func (*User) TableName

func (u *User) TableName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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