service

package
v0.0.0-...-32fb2dc Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDB

func ConnectDB(props map[string]interface{}) (*gorm.DB, error)

func DeleteAllBooks

func DeleteAllBooks() error

func DeleteAllOwnedBooks

func DeleteAllOwnedBooks() error

func FindBookByISBN

func FindBookByISBN(isbn string) (*model.Book, error)

func FindOwnedBookByISBN

func FindOwnedBookByISBN(isbn string) (*model.OwnedBook, error)

func InitDB

func InitDB(props map[string]interface{}) error

func InsertBook

func InsertBook(book *model.Book) (*model.Book, error)

func InsertOwnedBook

func InsertOwnedBook(book *model.OwnedBook) (*model.OwnedBook, error)

Types

type AddBookCommand

type AddBookCommand struct {
	ISBN         string
	Owner        string
	AcquiredAt   string
	ScannedAt    string
	PaidPrice    float64
	ActualPages  int64
	HasPaperBook bool
	Detail       *plugin.Book
}

type BookService

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

func (*BookService) AddBook

func (s *BookService) AddBook(cmd AddBookCommand) (*model.Book, error)

func (*BookService) Search

func (s *BookService) Search(isbn string,
	publisher string,
	person string,
	title string,
) ([]*plugin.Book, error)

Search book information using bookPlugin

func (*BookService) UpdateBook

func (s *BookService) UpdateBook(isbn string, update gin.H) (*model.Book, error)

func (*BookService) UpdateOwnedBook

func (s *BookService) UpdateOwnedBook(isbn string, update gin.H) (*model.OwnedBook, error)

type IBookService

type IBookService interface {
	Search(isbn string,
		publisher string,
		person string,
		title string,
	) ([]*plugin.Book, error)

	AddBook(book AddBookCommand) (*model.Book, error)
	UpdateBook(isbn string, update gin.H) (*model.Book, error)
	UpdateOwnedBook(isbn string, update gin.H) (*model.OwnedBook, error)
}

func NewBookService

func NewBookService() IBookService

type UpdateBookCommand

type UpdateBookCommand struct {
	ISBN          string
	Owner         null.String
	AcquiredAt    null.String
	ScannedAt     null.String
	PaidPrice     null.Float
	ActualPages   null.Int
	HasPaperBook  null.Bool
	Title         null.String
	OriginalISBN  null.String
	OriginalTitle null.String
	Contents      null.String
	Url           null.String
	PubDate       null.Time
	Authors       null.String
	Translators   null.String
	Publisher     null.String
	Price         null.Float
	Currency      null.String
}

Jump to

Keyboard shortcuts

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