service

package
v0.0.0-...-263bac0 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GeneratePasswordHash

func GeneratePasswordHash(password string) string

Types

type AuthService

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

func NewAuthService

func NewAuthService(repo repository.Authorization) *AuthService

func (*AuthService) CreateUser

func (s *AuthService) CreateUser(user common.User) (int, error)

func (*AuthService) GenerateToken

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

func (*AuthService) ParseToken

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

type Authorization

type Authorization interface {
	CreateUser(user common.User) (int, error)
	GenerateToken(username, password string) (string, error)
	ParseToken(accessToken string) (int, error)
}

type Comment

type Comment interface {
	Create(idUser int, comment common.Comment) (int, error)
	GetAll(idUser int) ([]common.Comment, error)
	GetById(idUser, commentId int) (common.Comment, error)
	Update(idUser, commentId int, input common.UpdateCommentInput) error
	Delete(idUser, commentId int) error
}

type CommentService

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

func NewCommentService

func NewCommentService(repo repository.Comment) *CommentService

func (*CommentService) Create

func (s *CommentService) Create(idUser int, comment common.Comment) (int, error)

func (*CommentService) Delete

func (s *CommentService) Delete(idUser, listId int) error

func (*CommentService) GetAll

func (s *CommentService) GetAll(idUser int) ([]common.Comment, error)

func (*CommentService) GetById

func (s *CommentService) GetById(idUser, commentId int) (common.Comment, error)

func (*CommentService) Update

func (s *CommentService) Update(idUser, commentId int, input common.UpdateCommentInput) error

type Service

type Service struct {
	Authorization
	Comment
	User
}

func NewService

func NewService(repos *repository.Repository) *Service

type User

type User interface {
	Create(user common.User) (int, error)
	GetById(id int) (common.User, error)
	Update(id int, input common.UpdateUserInput) error
	Delete(id int) error
}

type UserService

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

func NewUserService

func NewUserService(repo repository.User) *UserService

func (*UserService) Create

func (s *UserService) Create(user common.User) (int, error)

func (*UserService) Delete

func (s *UserService) Delete(id int) error

func (*UserService) GetById

func (s *UserService) GetById(id int) (common.User, error)

func (*UserService) Update

func (s *UserService) Update(id int, input common.UpdateUserInput) error

Jump to

Keyboard shortcuts

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