repository

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgres

func NewPostgres(host, port, username, password, dbname, sslmode string) (*sql.DB, error)

Types

type Auth

type Auth interface {
	CreateUser(user entities.User) (int, error)
	GetUserId(username, password_hash string) (int, error)
}

type AuthRepository

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

func NewAuthRepository

func NewAuthRepository(db *sql.DB) *AuthRepository

func (*AuthRepository) CreateUser

func (r *AuthRepository) CreateUser(user entities.User) (int, error)

func (*AuthRepository) GetUserId

func (r *AuthRepository) GetUserId(username, password_hash string) (int, error)

type Book

type Book interface {
	GetBook(id int) (*entities.Book, error)
	GetBooks() ([]*entities.Book, error)
	CreateBook(book entities.Book) (int, error)
	UpdateBook(book entities.Book) error
	DeleteBook(id int) error
}

type BookRepository

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

func NewBookRepository

func NewBookRepository(db *sql.DB) *BookRepository

func (*BookRepository) CreateBook

func (r *BookRepository) CreateBook(book entities.Book) (int, error)

func (*BookRepository) DeleteBook

func (r *BookRepository) DeleteBook(id int) error

func (*BookRepository) GetBook

func (r *BookRepository) GetBook(id int) (*entities.Book, error)

func (*BookRepository) GetBooks

func (r *BookRepository) GetBooks() ([]*entities.Book, error)

func (*BookRepository) UpdateBook

func (r *BookRepository) UpdateBook(book entities.Book) error

type Repository

type Repository struct {
	Book
	Auth
}

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