service

package
v0.0.0-...-7f86f56 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

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) Create

func (s *PostService) Create(ctx context.Context, post domain.Post) (ksuid.KSUID, error)

Creating a new post.

func (*PostService) Delete

func (s *PostService) Delete(ctx context.Context, id, authorId ksuid.KSUID) error

Deleting a post.

func (*PostService) Get

func (s *PostService) Get(ctx context.Context, id ksuid.KSUID) (domain.Post, error)

Getting a post.

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

func (s *PostService) GetTotalCount(ctx context.Context, authorId ksuid.KSUID) (int32, error)

Getting total author posts count.

func (*PostService) Update

func (s *PostService) Update(ctx context.Context, post domain.Post) error

Updating a post.

type Service

type Service struct{ Post }

Service structure.

func NewService

func NewService(repos *repository.Repository) *Service

Creating a new service.

Jump to

Keyboard shortcuts

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