user

package
v0.0.0-...-0485310 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUserService

func GetUserService() (svc interfaces.UserService, err error)

func NewUserService

func NewUserService() (svc2 interfaces.UserService, err error)

Types

type Option

type Option func(svc interfaces.UserService)

func WithJwtSecret

func WithJwtSecret(secret string) Option

type Service

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

func (*Service) ChangePassword

func (svc *Service) ChangePassword(id primitive.ObjectID, password string, args ...interface{}) (err error)

func (*Service) CheckToken

func (svc *Service) CheckToken(tokenStr string) (u interfaces.User, err error)

func (*Service) Create

func (svc *Service) Create(opts *interfaces.UserCreateOptions, args ...interface{}) (err error)

func (*Service) GetCurrentUser

func (svc *Service) GetCurrentUser(c *gin.Context) (user interfaces.User, err error)

func (*Service) Init

func (svc *Service) Init() (err error)

func (*Service) Login

func (svc *Service) Login(opts *interfaces.UserLoginOptions) (token string, u interfaces.User, err error)

func (*Service) MakeToken

func (svc *Service) MakeToken(user interfaces.User) (tokenStr string, err error)

func (*Service) SetJwtSecret

func (svc *Service) SetJwtSecret(secret string)

func (*Service) SetJwtSigningMethod

func (svc *Service) SetJwtSigningMethod(method jwt.SigningMethod)

type ServiceV2

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

func GetUserServiceV2

func GetUserServiceV2() (svc *ServiceV2, err error)

func (*ServiceV2) ChangePassword

func (svc *ServiceV2) ChangePassword(id primitive.ObjectID, password string, by primitive.ObjectID) (err error)

func (*ServiceV2) CheckToken

func (svc *ServiceV2) CheckToken(tokenStr string) (u *models.UserV2, err error)

func (*ServiceV2) Create

func (svc *ServiceV2) Create(username, password, role, email string, by primitive.ObjectID) (err error)

func (*ServiceV2) GetCurrentUser

func (svc *ServiceV2) GetCurrentUser(c *gin.Context) (user interfaces.User, err error)

func (*ServiceV2) Init

func (svc *ServiceV2) Init() (err error)

func (*ServiceV2) Login

func (svc *ServiceV2) Login(username, password string) (token string, u *models.UserV2, err error)

func (*ServiceV2) MakeToken

func (svc *ServiceV2) MakeToken(user *models.UserV2) (tokenStr string, err error)

func (*ServiceV2) SetJwtSecret

func (svc *ServiceV2) SetJwtSecret(secret string)

func (*ServiceV2) SetJwtSigningMethod

func (svc *ServiceV2) SetJwtSigningMethod(method jwt.SigningMethod)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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