Documentation ¶
Index ¶
- func NewPostgresDB(cfg Config) (*sqlx.DB, error)
- type AuthPostgres
- type Author
- type AuthorPostgres
- type Authorization
- type Book
- type BookPostgres
- func (r *BookPostgres) CreateBook(book models.Book) (int, error)
- func (r *BookPostgres) DeleteBook(bookId int) error
- func (r *BookPostgres) GetAllBook() ([]models.Book, error)
- func (r *BookPostgres) GetBookById(bookId int) (models.Book, error)
- func (r *BookPostgres) UpdateBook(bookId int, book models.Book) error
- type Config
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthPostgres ¶
type AuthPostgres struct {
// contains filtered or unexported fields
}
AuthPostgres - repo
func NewAuthPostgres ¶
func NewAuthPostgres(db *sqlx.DB) *AuthPostgres
NewAuthPostgres - constructor
func (*AuthPostgres) CreateUser ¶
func (r *AuthPostgres) CreateUser(user models.User) (int, error)
CreateUser - creating user
type Author ¶
type Author interface { }
Author - author commands (not implemented, because is not required)
type AuthorPostgres ¶
type AuthorPostgres struct {
// contains filtered or unexported fields
}
AuthorPostgres - repo
func NewAuthorPostgres ¶
func NewAuthorPostgres(db *sqlx.DB) *AuthorPostgres
NewAuthorPostgres - constructor
type Authorization ¶
type Authorization interface { CreateUser(user models.User) (int, error) GetUser(username, password string) (models.User, error) }
Authorization - signup/signin
type Book ¶
type Book interface { CreateBook(book models.Book) (int, error) GetAllBook() ([]models.Book, error) GetBookById(bookId int) (models.Book, error) DeleteBook(bookId int) error UpdateBook(bookId int, book models.Book) error }
Book - book commands
type BookPostgres ¶
type BookPostgres struct {
// contains filtered or unexported fields
}
BookPostgres - repo
func NewBookPostgres ¶
func NewBookPostgres(db *sqlx.DB) *BookPostgres
NewBookPostgres - constructor
func (*BookPostgres) CreateBook ¶
func (r *BookPostgres) CreateBook(book models.Book) (int, error)
CreateBook - book creating
func (*BookPostgres) DeleteBook ¶
func (r *BookPostgres) DeleteBook(bookId int) error
DeleteBook - remove book
func (*BookPostgres) GetAllBook ¶
func (r *BookPostgres) GetAllBook() ([]models.Book, error)
GetAllBook - getting all books
func (*BookPostgres) GetBookById ¶
func (r *BookPostgres) GetBookById(bookId int) (models.Book, error)
GetBookById - getting book
func (*BookPostgres) UpdateBook ¶
func (r *BookPostgres) UpdateBook(bookId int, book models.Book) error
UpdateBook - change book
type Config ¶
type Config struct { Driver string Host string Port string Username string Password string DBName string SSLMode string }
Config - db
Click to show internal directories.
Click to hide internal directories.