service

package
v0.0.0-...-61cd25c Latest Latest
Warning

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

Go to latest
Published: Jul 8, 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 - объект сервиса

func NewAuthService

func NewAuthService(repo repository.Authorization) *AuthService

NewAuthService - конструктор

func (*AuthService) CreateUser

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

CreateUser - создание пользователя

func (*AuthService) GenerateToken

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

GenerateToken - генерация токена авторизации

func (*AuthService) ParseToken

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

ParseToken - получение из токена авторизационных данных

type Authorization

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

Authorization - интерфейс для регистрации/авторизации

type Service

type Service struct {
	Authorization
	TodoItem
	TodoList
	UserAction
}

Service - сервис

func NewService

func NewService(repos *repository.Repository) *Service

NewService - конструктор

type TodoItem

type TodoItem interface {
	Create(userId, listId int, list todo.TodoItem) (int, error)
	GetAll(userId, listId int) ([]todo.TodoItem, error)
	GetById(userId, itemId int) (todo.TodoItem, error)
	Delete(userId, itemId int) error
	Update(userId, itemId int, input todo.UpdateItemInput) error
	GetAllCompletedItems(userId int) ([]todo.TodoItem, error)
}

TodoItem - интейрфейс для работы с элементами списка задач

type TodoItemService

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

TodoItemService - сервис для таблицы ЭЛЕМЕНТОВ списка

func NewTodoItemService

func NewTodoItemService(repo repository.TodoItem, listRepo repository.TodoList) *TodoItemService

NewTodoItemService - конструктор

func (*TodoItemService) Create

func (s *TodoItemService) Create(userId, listId int, item todo.TodoItem) (int, error)

Create - создание

func (*TodoItemService) Delete

func (s *TodoItemService) Delete(userId, itemId int) error

Delete - удаление

func (*TodoItemService) GetAll

func (s *TodoItemService) GetAll(userId, listId int) ([]todo.TodoItem, error)

GetAll - получение всех

func (*TodoItemService) GetAllCompletedItems

func (s *TodoItemService) GetAllCompletedItems(userId int) ([]todo.TodoItem, error)

GetAllCompletedItems - получение всех выполненных

func (*TodoItemService) GetById

func (s *TodoItemService) GetById(userId, itemId int) (todo.TodoItem, error)

GetById - получение по id

func (*TodoItemService) Update

func (s *TodoItemService) Update(userId, itemId int, input todo.UpdateItemInput) error

Update - обновление

type TodoList

type TodoList interface {
	Create(userId int, list todo.TodoList) (int, error)
	GetAll(userId int) ([]todo.TodoList, error)
	GetById(userId, listId int) (todo.TodoList, error)
	Delete(userId, listId int) error
	Update(userId, listId int, input todo.UpdateListInput) error
}

TodoList - интерфейст для работы со списками задач

type TodoListService

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

TodoListService - сервис для таблицы СПИСКОВ

func NewTodoListService

func NewTodoListService(repo repository.TodoList) *TodoListService

NewTodoListService - конструктор

func (*TodoListService) Create

func (s *TodoListService) Create(userId int, list todo.TodoList) (int, error)

Create - создание

func (*TodoListService) Delete

func (s *TodoListService) Delete(userId, listId int) error

Delete - удаление

func (*TodoListService) GetAll

func (s *TodoListService) GetAll(userId int) ([]todo.TodoList, error)

GetAll - получение всех

func (*TodoListService) GetById

func (s *TodoListService) GetById(userId, listId int) (todo.TodoList, error)

GetById - получение по id

func (*TodoListService) Update

func (s *TodoListService) Update(userId, listId int, input todo.UpdateListInput) error

Update - обновление

type UserAction

type UserAction interface {
	Delete(userId int) error
}

UserAction - интерфейс для удаления пользователей

type UserService

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

UserService - сервис для таблицы пользователей

func NewUserService

func NewUserService(userRepo repository.UserAction) *UserService

NewUserService - конструктор

func (*UserService) Delete

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

Delete - удаление

Jump to

Keyboard shortcuts

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