repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMysqlDB

func NewMysqlDB(cfg Config) (*sql.DB, error)

Types

type Author

type Author interface {
	GetAuthor(bookTitle string) (book.Author, error)
	AddAuthor(author book.Author) (book.Responce, error)
}

type AuthorMysql

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

func NewAuthorMysql

func NewAuthorMysql(db *sql.DB) *AuthorMysql

func (*AuthorMysql) AddAuthor

func (r *AuthorMysql) AddAuthor(author book.Author) (book.Responce, error)

func (*AuthorMysql) GetAuthor

func (r *AuthorMysql) GetAuthor(bookTitle string) (book.Author, error)

type Book

type Book interface {
	GetBooks(author book.Author) ([]book.Book, error)
	AddBook(book book.Book) (book.Responce, error)
}

type BookMysql

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

func NewBookMysql

func NewBookMysql(db *sql.DB) *BookMysql

func (*BookMysql) AddBook

func (r *BookMysql) AddBook(bk book.Book) (book.Responce, error)

func (*BookMysql) GetBooks

func (r *BookMysql) GetBooks(author book.Author) ([]book.Book, error)

type Config

type Config struct {
	Host     string
	Port     string
	Username string
	Password string
	DBName   string
}

type Repository

type Repository struct {
	Book
	Author
}

func NewRepository

func NewRepository(db *sql.DB) *Repository

Jump to

Keyboard shortcuts

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