Documentation
¶
Index ¶
- type AuthPsql
- type AuthStorage
- func (a *AuthStorage) Delete(ctx context.Context, userID uuid.UUID) error
- func (a *AuthStorage) FindUserByEmail(ctx context.Context, user *entity.User) (*entity.User, error)
- func (a *AuthStorage) FindUsersByName(ctx context.Context, name string, pq *utils.PaginationQuery) (*entity.UsersList, error)
- func (a *AuthStorage) GetUserByID(ctx context.Context, userID uuid.UUID) (*entity.User, error)
- func (a *AuthStorage) GetUsers(ctx context.Context, pq *utils.PaginationQuery) (*entity.UsersList, error)
- func (a *AuthStorage) Register(ctx context.Context, user *entity.User) (*entity.User, error)
- func (a *AuthStorage) Update(ctx context.Context, user *entity.User) (*entity.User, error)
- type CommentsPsql
- type CommentsStorage
- func (s *CommentsStorage) Create(ctx context.Context, comments *entity.Comment) (*entity.Comment, error)
- func (s *CommentsStorage) Delete(ctx context.Context, commentID uuid.UUID) error
- func (s *CommentsStorage) GetAllByNewsID(ctx context.Context, newsID uuid.UUID, pq *utils.PaginationQuery) (*entity.CommentsList, error)
- func (s *CommentsStorage) GetByID(ctx context.Context, commentID uuid.UUID) (*entity.CommentBase, error)
- func (s *CommentsStorage) Update(ctx context.Context, comments *entity.Comment) (*entity.Comment, error)
- type NewsPsql
- type NewsStorage
- func (s *NewsStorage) Create(ctx context.Context, news *entity.News) (*entity.News, error)
- func (s *NewsStorage) Delete(ctx context.Context, newsID uuid.UUID) error
- func (s *NewsStorage) GetNews(ctx context.Context, pq *utils.PaginationQuery) (*entity.NewsList, error)
- func (s *NewsStorage) GetNewsByID(ctx context.Context, newsID uuid.UUID) (*entity.NewsBase, error)
- func (s *NewsStorage) SearchNews(ctx context.Context, title string, pq *utils.PaginationQuery) (*entity.NewsList, error)
- func (s *NewsStorage) Update(ctx context.Context, news *entity.News) (*entity.News, error)
- type Storage
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 (*AuthStorage) FindUserByEmail ¶
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 ¶
Get user by id
func (*AuthStorage) GetUsers ¶
func (a *AuthStorage) GetUsers(ctx context.Context, pq *utils.PaginationQuery) (*entity.UsersList, error)
Get users
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) 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
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 (*NewsStorage) GetNews ¶
func (s *NewsStorage) GetNews(ctx context.Context, pq *utils.PaginationQuery) (*entity.NewsList, error)
Get news
func (*NewsStorage) GetNewsByID ¶
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
type Storage ¶
type Storage struct {
Auth *AuthStorage
News *NewsStorage
Comments *CommentsStorage
}
func NewStorage ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.