Documentation ¶
Index ¶
- type AuthService
- type Author
- type AuthorService
- type Authorization
- type Book
- type BookService
- func (s *BookService) CreateBook(book models.Book) (int, error)
- func (s *BookService) DeleteBook(bookId int) error
- func (s *BookService) GetAllBook() ([]models.Book, error)
- func (s *BookService) GetBookById(bookId int) (models.Book, error)
- func (s *BookService) UpdateBook(bookId int, book models.Book) error
- type Service
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) CreateUser ¶
func (s *AuthService) CreateUser(user models.User) (int, error)
CreateUser - just creating user
func (*AuthService) GenerateToken ¶
func (s *AuthService) GenerateToken(username, password string) (string, error)
GenerateToken - token generation
func (*AuthService) ParseToken ¶
func (s *AuthService) ParseToken(token string) (int, error)
type Author ¶
type Author interface { }
Author - author commands (not implemented, because is not required)
type AuthorService ¶
type AuthorService struct {
// contains filtered or unexported fields
}
AuthorService - just service
func NewAuthorService ¶
func NewAuthorService(repo repository.Author) *AuthorService
NewAuthorService - constructor
type Authorization ¶
type Authorization interface { CreateUser(user models.User) (int, error) GenerateToken(username, password string) (string, error) ParseToken(token string) (int, error) }
Authorization - signup/signin
type Book ¶
type Book interface { CreateBook(book models.Book) (int, error) GetAllBook() ([]models.Book, error) GetBookById(bookId int) (models.Book, error) DeleteBook(bookId int) error UpdateBook(bookId int, book models.Book) error }
Book - book commands
type BookService ¶
type BookService struct {
// contains filtered or unexported fields
}
BookService - just book service
func NewBookService ¶
func NewBookService(repo repository.Book, authorRepo repository.Author) *BookService
NewBookService - constructor
func (*BookService) CreateBook ¶
func (s *BookService) CreateBook(book models.Book) (int, error)
CreateBook - create book
func (*BookService) DeleteBook ¶
func (s *BookService) DeleteBook(bookId int) error
DeleteBook - book
func (*BookService) GetAllBook ¶
func (s *BookService) GetAllBook() ([]models.Book, error)
GetAllBook - getting all books
func (*BookService) GetBookById ¶
func (s *BookService) GetBookById(bookId int) (models.Book, error)
GetBookById - get book
func (*BookService) UpdateBook ¶
func (s *BookService) UpdateBook(bookId int, book models.Book) error
UpdateBook - book
Click to show internal directories.
Click to hide internal directories.