service

package
v0.0.0-...-0025a43 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is service providers.

Functions

This section is empty.

Types

type JwtRepo

type JwtRepo interface {
	JoinBlackList(ctx context.Context, tokenStr string, joinUnix int64, expires time.Duration) error
	GetBlackJoinUnix(ctx context.Context, tokenStr string) (int64, error)
}

type JwtService

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

func NewJwtService

func NewJwtService(conf *config.Configuration, log *zap.Logger, jRepo JwtRepo, uS *UserService, lb *compo.LockBuilder) *JwtService

func (*JwtService) CreateToken

func (s *JwtService) CreateToken(GuardName string, user domain.JwtUser) (*domain.TokenOutPut, *jwt.Token, error)

func (*JwtService) GetUserInfo

func (s *JwtService) GetUserInfo(ctx *gin.Context, guardName, id string) (domain.JwtUser, error)

func (*JwtService) IsInBlacklist

func (s *JwtService) IsInBlacklist(ctx *gin.Context, tokenStr string) bool

func (*JwtService) JoinBlackList

func (s *JwtService) JoinBlackList(ctx *gin.Context, token *jwt.Token) error

func (*JwtService) RefreshToken

func (s *JwtService) RefreshToken(ctx *gin.Context, guardName string, token *jwt.Token) (*domain.TokenOutPut, error)

type MediaRepo

type MediaRepo interface {
	Create(context.Context, *domain.Media) (*domain.Media, error)
	FindByID(context.Context, uint64) (*domain.Media, error)
	FindCacheByID(context.Context, uint64) (*domain.Media, error)
}

type MediaService

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

func NewMediaService

func NewMediaService(conf *config.Configuration, log *zap.Logger, mRepo MediaRepo, s *compo.Storage) *MediaService

NewMediaService .

func (*MediaService) GetUrlById

func (s *MediaService) GetUrlById(ctx *gin.Context, id uint64) string

func (*MediaService) HashName

func (s *MediaService) HashName(fileName string) string

func (*MediaService) SaveImage

func (s *MediaService) SaveImage(ctx *gin.Context, params *request.ImageUpload) (*domain.Media, error)

SaveImage 保存图片(公共读)

type Transaction

type Transaction interface {
	ExecTx(context.Context, func(ctx context.Context) error) error
}

Transaction 新增事务接口方法

type UserRepo

type UserRepo interface {
	FindByID(context.Context, uint64) (*domain.User, error)
	FindByMobile(context.Context, string) (*domain.User, error)
	Create(context.Context, *domain.User) (*domain.User, error)
}

type UserService

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

func NewUserService

func NewUserService(uRepo UserRepo, tm Transaction) *UserService

NewUserService .

func (*UserService) GetUserInfo

func (s *UserService) GetUserInfo(ctx *gin.Context, idStr string) (*domain.User, error)

GetUserInfo 获取用户信息

func (*UserService) Login

func (s *UserService) Login(ctx *gin.Context, mobile, password string) (*domain.User, error)

Login 登录

func (*UserService) Register

func (s *UserService) Register(ctx *gin.Context, param *request.Register) (*domain.User, error)

Register 注册

Jump to

Keyboard shortcuts

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