Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateBookRequest ¶
type CreateBookRequest struct {
Isbn string `json:"isbn"`
Title string `json:"title"`
Author models.Author `json:"author"`
}
CreateBookRequest Isbn, Title, Author struct
type Endpoints ¶
type Endpoints struct {
GetBooks endpoint.Endpoint
CreateBook endpoint.Endpoint
GetBook endpoint.Endpoint
UpdateBook endpoint.Endpoint
DeleteBook endpoint.Endpoint
}
Endpoints holds endpoints
func MakeEndpoints ¶
MakeEndpoints makes endpoints to handle requests
type GetBookResponse ¶
type GetBookResponse struct {
ID int `json:"id"`
Isbn string `json:"isbn"`
Title string `json:"title"`
Author models.Author `json:"author"`
}
GetBookResponse returns single book
type GetBooksResponse ¶
GetBooksResponse struct of slice of Books
type Service ¶
type Service interface {
GetAllBooks(ctx context.Context) ([]models.Book, error)
CreateNewBook(ctx context.Context, isbn, title string, author models.Author) (string, error)
GetBook(ctx context.Context, id string) (*models.Book, error)
UpdateBook(ctx context.Context, id, Isbn, Title string) (string, error)
DeleteBook(ctx context.Context, id string) (string, error)
}
Service is a main microservice interface
func NewService ¶
func NewService(rep models.Repository, logger log.Logger) Service
NewService returns new instance of servise
type UpdateBookRequest ¶
type UpdateBookRequest struct {
ID string `json:"id"`
Isbn string `json:"isbn"`
Title string `json:"title"`
}
UpdateBookRequest updates book
Click to show internal directories.
Click to hide internal directories.