service

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthLogin

type AuthLogin struct {
	Login    string
	Password string
	DeviceID int
}

type AuthLogout

type AuthLogout struct {
	Token string
}

type AuthRefresh

type AuthRefresh struct {
	Token    string
	DeviceID int
}

type AuthService

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

func NewAuthService

func NewAuthService(
	userRepository repository.IUserRepository,
	tokenRepository repository.ITokenRepository,
	tokenCache cache.ITokenCache,
	userCache cache.IUserCache,
	hasher secret.Hasher,
	accessExpire time.Duration,
	refreshExpire time.Duration,
	accessSecret string,
) AuthService

func (AuthService) Account

func (s AuthService) Account(ctx context.Context) (*model.User, error)

func (AuthService) Login

func (s AuthService) Login(ctx context.Context, input AuthLogin) (*model.AuthToken, error)

func (AuthService) Logout

func (s AuthService) Logout(ctx context.Context, input AuthLogout) error

func (AuthService) Refresh

func (s AuthService) Refresh(ctx context.Context, input AuthRefresh) (*model.AuthToken, error)

func (AuthService) Trx

func (s AuthService) Trx(db *gorm.DB) IAuthService

type IAuthService

type IAuthService interface {
	Trx(db *gorm.DB) IAuthService
	Login(ctx context.Context, input AuthLogin) (*model.AuthToken, error)
	Refresh(ctx context.Context, input AuthRefresh) (*model.AuthToken, error)
	Logout(ctx context.Context, input AuthLogout) error
	Account(ctx context.Context) (*model.User, error)
}

Jump to

Keyboard shortcuts

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