Documentation ¶
Index ¶
- type Post
- type PostService
- func (s *PostService) Create(ctx context.Context, post domain.Post) (ksuid.KSUID, error)
- func (s *PostService) Delete(ctx context.Context, id, authorId ksuid.KSUID) error
- func (s *PostService) Get(ctx context.Context, id ksuid.KSUID) (domain.Post, error)
- func (s *PostService) GetPosts(ctx context.Context, authorId ksuid.KSUID, sort domain.SortOptions) ([]domain.Post, error)
- func (s *PostService) GetTotalCount(ctx context.Context, authorId ksuid.KSUID) (int32, error)
- func (s *PostService) Update(ctx context.Context, post domain.Post) error
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Post ¶
type Post interface { // Creating a new post. Create(ctx context.Context, post domain.Post) (ksuid.KSUID, error) // Getting a post. Get(ctx context.Context, id ksuid.KSUID) (domain.Post, error) // Getting author posts. GetPosts(ctx context.Context, authorId ksuid.KSUID, sort domain.SortOptions) ([]domain.Post, error) // Deleting a post. Delete(ctx context.Context, id, authorId ksuid.KSUID) error // Updating a post. Update(ctx context.Context, post domain.Post) error // Getting total author posts count. GetTotalCount(ctx context.Context, authorId ksuid.KSUID) (int32, error) }
Post interface.
type PostService ¶
type PostService struct {
// contains filtered or unexported fields
}
Post service structure.
func NewPostService ¶
func NewPostService(repos postgres.Post) *PostService
Creating a new post service.
func (*PostService) GetPosts ¶
func (s *PostService) GetPosts(ctx context.Context, authorId ksuid.KSUID, sort domain.SortOptions) ([]domain.Post, error)
Getting author posts.
func (*PostService) GetTotalCount ¶
Getting total author posts count.
Click to show internal directories.
Click to hide internal directories.