service

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

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

Go to latest
Published: Aug 16, 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 SaveResultAsync

type SaveResultAsync struct {
	Error error
}

type VoteService

type VoteService interface {
	SaveVote(vote *dto.Vote) <-chan SaveResultAsync
	FindOneVote(filter interface{}) (*dto.Vote, error)
	FindVoteList(filter interface{}, limit int64, skip int64, sort map[string]int) ([]dto.Vote, error)
	FindById(objectId uuid.UUID) (*dto.Vote, error)
	FindByOwnerUserId(ownerUserId uuid.UUID) ([]dto.Vote, error)
	UpdateVote(filter interface{}, data interface{}, opts ...*coreData.UpdateOptions) error
	UpdateVoteById(data *dto.Vote) error
	DeleteVote(filter interface{}) error
	DeleteVoteByOwner(ownerUserId uuid.UUID, voteId uuid.UUID) error
	DeleteManyVotes(filter interface{}) error
	CreateVoteIndex(indexes map[string]interface{}) error
	GetVoteByPostId(postId *uuid.UUID, sortBy string, page int64) ([]dto.Vote, error)
	DeleteVotesByPostId(ownerUserId uuid.UUID, postId uuid.UUID) error
}

func NewVoteService

func NewVoteService(db interface{}) (VoteService, error)

NewVoteService initializes VoteService's dependencies and create new VoteService struct

type VoteServiceImpl

type VoteServiceImpl struct {
	VoteRepo repo.Repository
}

VoteService handlers with injected dependencies

func (VoteServiceImpl) CreateVoteIndex

func (s VoteServiceImpl) CreateVoteIndex(indexes map[string]interface{}) error

CreateVoteIndex create index for vote search.

func (VoteServiceImpl) DeleteManyVotes

func (s VoteServiceImpl) DeleteManyVotes(filter interface{}) error

DeleteManyVotes delete many votes by filter

func (VoteServiceImpl) DeleteVote

func (s VoteServiceImpl) DeleteVote(filter interface{}) error

DeleteVote delete vote by filter

func (VoteServiceImpl) DeleteVoteByOwner

func (s VoteServiceImpl) DeleteVoteByOwner(ownerUserId uuid.UUID, voteId uuid.UUID) error

DeleteVote delete vote by ownerUserId and voteId

func (VoteServiceImpl) DeleteVotesByPostId

func (s VoteServiceImpl) DeleteVotesByPostId(ownerUserId uuid.UUID, postId uuid.UUID) error

DeleteVotesByPostId delete votes by postId

func (VoteServiceImpl) FindById

func (s VoteServiceImpl) FindById(objectId uuid.UUID) (*dto.Vote, error)

FindById find by vote id

func (VoteServiceImpl) FindByOwnerUserId

func (s VoteServiceImpl) FindByOwnerUserId(ownerUserId uuid.UUID) ([]dto.Vote, error)

FindByOwnerUserId find by owner user id

func (VoteServiceImpl) FindOneVote

func (s VoteServiceImpl) FindOneVote(filter interface{}) (*dto.Vote, error)

FindOneVote get one vote

func (VoteServiceImpl) FindVoteList

func (s VoteServiceImpl) FindVoteList(filter interface{}, limit int64, skip int64, sort map[string]int) ([]dto.Vote, error)

FindVoteList get all votes by filter

func (VoteServiceImpl) GetVoteByPostId

func (s VoteServiceImpl) GetVoteByPostId(postId *uuid.UUID, sortBy string, page int64) ([]dto.Vote, error)

GetVoteByPostId get all votes by postId

func (VoteServiceImpl) SaveVote

func (s VoteServiceImpl) SaveVote(vote *dto.Vote) <-chan SaveResultAsync

SaveVote save the vote

func (VoteServiceImpl) UpdateVote

func (s VoteServiceImpl) UpdateVote(filter interface{}, data interface{}, opts ...*coreData.UpdateOptions) error

UpdateVote update the vote

func (VoteServiceImpl) UpdateVoteById

func (s VoteServiceImpl) UpdateVoteById(data *dto.Vote) error

UpdateVote update the vote

Jump to

Keyboard shortcuts

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