repo

package
v0.0.0-...-8297c98 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BooksRepo

type BooksRepo interface {
	// GetById gets the book data from database and transform it to DTO.
	GetById(id string) (dto.Book, error)

	// GetPaginationSortByTimeDesc gets the books sorted by latest to oldest with paging.
	// It accepts limit for paging limit and lastId as the oldest item from the last page.
	// It returns books, id of the oldest item in this page and error if has.
	GetPaginationSortByTimeDesc(limit int, lastId string) ([]dto.Book, string, error)

	// Save saves book data to the database the ID and AddTime is ignored and generate by repository.
	// It returns id of the inserted object or an error.
	Save(book dto.Book) (string, error)
}

BooksRepo is an interface to retrieve and save the book data to the database.

Jump to

Keyboard shortcuts

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