psql

package
v0.0.0-...-3c0f6d4 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthPsql

type AuthPsql interface {
	Register(ctx context.Context, user *entity.User) (*entity.User, error)
	Update(ctx context.Context, user *entity.User) (*entity.User, error)
	Delete(ctx context.Context, userID uuid.UUID) error
	GetUserByID(ctx context.Context, userID uuid.UUID) (*entity.User, error)
	FindUsersByName(ctx context.Context, name string, pq *utils.PaginationQuery) (*entity.UsersList, error)
	GetUsers(ctx context.Context, pq *utils.PaginationQuery) (*entity.UsersList, error)
	FindUserByEmail(ctx context.Context, user *entity.User) (*entity.User, error)
}

Auth StoragePsql interface

type AuthStorage

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

Auth Storage

func NewAuthStorage

func NewAuthStorage(psql *sqlx.DB) *AuthStorage

Auth Storage constructor

func (*AuthStorage) Delete

func (a *AuthStorage) Delete(ctx context.Context, userID uuid.UUID) error

Delete user

func (*AuthStorage) FindUserByEmail

func (a *AuthStorage) FindUserByEmail(ctx context.Context, user *entity.User) (*entity.User, error)

Find user by email

func (*AuthStorage) FindUsersByName

func (a *AuthStorage) FindUsersByName(ctx context.Context,
	name string, pq *utils.PaginationQuery) (*entity.UsersList, error)

Find users by name

func (*AuthStorage) GetUserByID

func (a *AuthStorage) GetUserByID(ctx context.Context, userID uuid.UUID) (*entity.User, error)

Get user by id

func (*AuthStorage) GetUsers

Get users

func (*AuthStorage) Register

func (a *AuthStorage) Register(ctx context.Context, user *entity.User) (*entity.User, error)

Register user

func (*AuthStorage) Update

func (a *AuthStorage) Update(ctx context.Context, user *entity.User) (*entity.User, error)

Update user

type CommentsPsql

type CommentsPsql interface {
	Create(ctx context.Context, comments *entity.Comment) (*entity.Comment, error)
	Update(ctx context.Context, comments *entity.Comment) (*entity.Comment, error)
	GetByID(ctx context.Context, commentID uuid.UUID) (*entity.CommentBase, error)
	GetAllByNewsID(ctx context.Context, newsID uuid.UUID, pq *utils.PaginationQuery) (*entity.CommentsList, error)
	Delete(ctx context.Context, commentID uuid.UUID) error
}

Comments storage interface

type CommentsStorage

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

Comments storage

func NewCommentsStorage

func NewCommentsStorage(psql *sqlx.DB) *CommentsStorage

Comments storage constructor

func (*CommentsStorage) Create

func (s *CommentsStorage) Create(ctx context.Context, comments *entity.Comment) (*entity.Comment, error)

Create comments

func (*CommentsStorage) Delete

func (s *CommentsStorage) Delete(ctx context.Context, commentID uuid.UUID) error

Delete comments

func (*CommentsStorage) GetAllByNewsID

func (s *CommentsStorage) GetAllByNewsID(ctx context.Context,
	newsID uuid.UUID, pq *utils.PaginationQuery) (*entity.CommentsList, error)

Get all comments by news id

func (*CommentsStorage) GetByID

func (s *CommentsStorage) GetByID(ctx context.Context, commentID uuid.UUID) (*entity.CommentBase, error)

Get by id comment

func (*CommentsStorage) Update

func (s *CommentsStorage) Update(ctx context.Context, comments *entity.Comment) (*entity.Comment, error)

Update comments

type NewsPsql

type NewsPsql interface {
	Create(ctx context.Context, news *entity.News) (*entity.News, error)
	Update(ctx context.Context, news *entity.News) (*entity.News, error)
	GetNews(ctx context.Context, pq *utils.PaginationQuery) (*entity.NewsList, error)
	GetNewsByID(ctx context.Context, newsID uuid.UUID) (*entity.NewsBase, error)
	SearchNews(ctx context.Context, title string, pq *utils.PaginationQuery) (*entity.NewsList, error)
	Delete(ctx context.Context, newsID uuid.UUID) error
}

News StoragePsql interface

type NewsStorage

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

func NewNewsStorage

func NewNewsStorage(psql *sqlx.DB) *NewsStorage

News storage constructor

func (*NewsStorage) Create

func (s *NewsStorage) Create(ctx context.Context, news *entity.News) (*entity.News, error)

Create news

func (*NewsStorage) Delete

func (s *NewsStorage) Delete(ctx context.Context, newsID uuid.UUID) error

Delete news

func (*NewsStorage) GetNews

Get news

func (*NewsStorage) GetNewsByID

func (s *NewsStorage) GetNewsByID(ctx context.Context, newsID uuid.UUID) (*entity.NewsBase, error)

Get single news by id

func (*NewsStorage) SearchNews

func (s *NewsStorage) SearchNews(ctx context.Context, title string, pq *utils.PaginationQuery) (*entity.NewsList, error)

Find news by title

func (*NewsStorage) Update

func (s *NewsStorage) Update(ctx context.Context, news *entity.News) (*entity.News, error)

Update news item

type Storage

type Storage struct {
	Auth     *AuthStorage
	News     *NewsStorage
	Comments *CommentsStorage
}

func NewStorage

func NewStorage(psql *sqlx.DB) *Storage

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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