service

package
v0.0.0-...-a67f385 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthService

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

AuthService - service

func NewAuthService

func NewAuthService(repo repository.Authorization) *AuthService

NewAuthService - constructor

func (*AuthService) CreateAccount

func (s *AuthService) CreateAccount(account models.Account) (int, error)

func (*AuthService) GenerateToken

func (s *AuthService) GenerateToken(username, password string) (string, error)

GenerateToken - token generation

func (*AuthService) GetAccountById

func (s *AuthService) GetAccountById(accountId int) (models.Account, error)

func (*AuthService) ParseToken

func (s *AuthService) ParseToken(accessToken string) (int, error)

ParseToken - getting authorized data from token

type Authorization

type Authorization interface {
	CreateAccount(account models.Account) (int, error)
	GenerateToken(username, password string) (string, error)
	ParseToken(token string) (int, error)
	GetAccountById(accountId int) (models.Account, error)
}

Authorization - signup/signin

type Service

type Service struct {
	Authorization
}

Service - just service

func NewService

func NewService(repos *repository.Repository) *Service

NewService - constructor

Jump to

Keyboard shortcuts

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