service

package
v0.0.0-...-293b262 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateToken

func ValidateToken(accessToken string, tokenType string) (username string, valid bool)

Types

type Service

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

func NewService

func NewService(db *repository.Repository, tokenStorage *storage.Storage, cacheStorage *storage.Storage) (service *Service)

func (*Service) CreateArticle

func (s *Service) CreateArticle(title string, body string, username string) (articlename string, err error)

func (*Service) CreateUser

func (s *Service) CreateUser(username string, name string, password string) (err error)

func (*Service) DeleteArticle

func (s *Service) DeleteArticle(articlename string) (err error)

func (*Service) DeleteUser

func (s *Service) DeleteUser(username string) (err error)

func (*Service) FindUsers

func (s *Service) FindUsers(pattern string, quantity int) (users []model.FindUsers, err error)

func (*Service) GetArticle

func (s *Service) GetArticle(articlename string) (title string, body string, creationDate time.Time, username string, err error)

func (*Service) GetArticles

func (s *Service) GetArticles(title string, username string, from string, to string, quantity int) (articles []model.Article, err error)

func (*Service) GetDelRefreshToken

func (s *Service) GetDelRefreshToken(refreshToken string) (username string, err error)

func (*Service) GetUser

func (s *Service) GetUser(username string) (name string, err error)

func (*Service) LoadArticleCache

func (s *Service) LoadArticleCache(path string) (title string, body string, creationDate string, username string, err error)

func (*Service) LoadUserCache

func (s *Service) LoadUserCache(path string) (name string, err error)

func (*Service) Login

func (s *Service) Login(username string, password string) (accessToken string, refreshToken string, err error)

func (*Service) RefreshTokens

func (s *Service) RefreshTokens(username string) (accessToken string, refreshToken string, err error)

func (*Service) SetRefreshToken

func (s *Service) SetRefreshToken(refreshToken string, username string) (err error)

func (*Service) UpdateArticle

func (s *Service) UpdateArticle(articlename string, newTitle string, newBody string) (err error)

func (*Service) UpdateUser

func (s *Service) UpdateUser(username string, newName string, newPassword string) (err error)

func (*Service) UploadArticleCache

func (s *Service) UploadArticleCache(path string, title string, body string, creationDate string, username string) (err error)

func (*Service) UploadUserCache

func (s *Service) UploadUserCache(path string, name string) (err error)

Jump to

Keyboard shortcuts

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