token

package
v0.0.0-...-ca0f7d1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTokensUpdated = errors.New("tokens with sent params are not updated")
	ErrNoTokens        = errors.New("tokens with sent params are not found")
)

Functions

This section is empty.

Types

type MockService

type MockService struct {
	mock.Mock
}

MockService is an autogenerated mock type for the Service type

func (*MockService) Create

func (_m *MockService) Create(tokenType models.TokenType, clientID models.ClientID, accountID uuid.UUID, identityID uuid.UUID, tx *sql.Tx) (*models.Token, error)

Create provides a mock function with given fields: tokenType, clientID, accountID, identityID, tx

func (*MockService) DeleteExpiredTokens

func (_m *MockService) DeleteExpiredTokens(tokenType models.TokenType, tx *sql.Tx) ([]*models.Token, error)

DeleteExpiredTokens provides a mock function with given fields: tokenType, tx

func (*MockService) DeleteUsedTokens

func (_m *MockService) DeleteUsedTokens() error

DeleteUsedTokens provides a mock function with given fields:

func (*MockService) GetActiveTokenByIdentityID

func (_m *MockService) GetActiveTokenByIdentityID(identityID uuid.UUID, tokenType models.TokenType) (*models.Token, error)

GetActiveTokenByIdentityID provides a mock function with given fields: identityID, tokenType

func (*MockService) Use

func (_m *MockService) Use(tokenID uuid.UUID, tx *sql.Tx) (*models.Token, error)

Use provides a mock function with given fields: tokenID, tx

type Repository

type Repository interface {
	Create(executor database.QueryExecutor, token models.Token) (tokenID uuid.UUID, err error)
	GetTokensByIdentityID(
		executor database.QueryExecutor,
		identityID uuid.UUID,
		tokenType models.TokenType,
	) ([]*models.Token, error)
	UpdateStatus(
		executor database.QueryExecutor,
		TokenID uuid.UUID,
		TokenStatus models.TokenStatus,
	) (*models.Token, error)
	DeleteUsedTokens(executor database.QueryExecutor) error
	DeleteExpiredTokens(executor database.QueryExecutor, tokenType models.TokenType) ([]*models.Token, error)
}

type Service

type Service interface {
	Create(
		executor database.QueryExecutor,
		tokenType models.TokenType,
		clientID models.ClientID,
		accountID, identityID uuid.UUID,
	) (*models.Token, error)
	GetActiveTokenByIdentityID(executor database.QueryExecutor, identityID uuid.UUID, tokenType models.TokenType) (*models.Token, error)
	Use(executor database.QueryExecutor, tokenID uuid.UUID) (*models.Token, error)
	DeleteUsedTokens(executor database.QueryExecutor) error
	DeleteExpiredTokens(executor database.QueryExecutor, tokenType models.TokenType) ([]*models.Token, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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