answercommon

package
v1.4.5-RC1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnswerCommon

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

AnswerCommon user service

func NewAnswerCommon

func NewAnswerCommon(answerRepo AnswerRepo) *AnswerCommon

func (*AnswerCommon) AdminSearchList

func (as *AnswerCommon) AdminSearchList(ctx context.Context, req *schema.AdminAnswerPageReq) (
	resp []*entity.Answer, count int64, err error)

func (*AnswerCommon) AdminShowFormat

func (as *AnswerCommon) AdminShowFormat(ctx context.Context, data *entity.Answer) *schema.AdminAnswerInfo

func (*AnswerCommon) PersonalAnswerPage

func (as *AnswerCommon) PersonalAnswerPage(ctx context.Context,
	cond *entity.PersonalAnswerPageQueryCond) ([]*entity.Answer, int64, error)

func (*AnswerCommon) Search

func (as *AnswerCommon) Search(ctx context.Context, search *entity.AnswerSearch) ([]*entity.Answer, int64, error)

func (*AnswerCommon) SearchAnswerIDs

func (as *AnswerCommon) SearchAnswerIDs(ctx context.Context, userID, questionID string) ([]string, error)

func (*AnswerCommon) ShowFormat

func (as *AnswerCommon) ShowFormat(ctx context.Context, data *entity.Answer) *schema.AnswerInfo

type AnswerRepo

type AnswerRepo interface {
	AddAnswer(ctx context.Context, answer *entity.Answer) (err error)
	RemoveAnswer(ctx context.Context, id string) (err error)
	RecoverAnswer(ctx context.Context, answerID string) (err error)
	UpdateAnswer(ctx context.Context, answer *entity.Answer, cols []string) (err error)
	GetAnswer(ctx context.Context, id string) (answer *entity.Answer, exist bool, err error)
	GetAnswerList(ctx context.Context, answer *entity.Answer) (answerList []*entity.Answer, err error)
	GetAnswerPage(ctx context.Context, page, pageSize int, answer *entity.Answer) (answerList []*entity.Answer, total int64, err error)
	UpdateAcceptedStatus(ctx context.Context, acceptedAnswerID string, questionID string) error
	GetByID(ctx context.Context, answerID string) (*entity.Answer, bool, error)
	GetByIDs(ctx context.Context, answerIDs ...string) ([]*entity.Answer, error)
	GetCountByQuestionID(ctx context.Context, questionID string) (int64, error)
	GetCountByUserID(ctx context.Context, userID string) (int64, error)
	GetIDsByUserIDAndQuestionID(ctx context.Context, userID string, questionID string) ([]string, error)
	SearchList(ctx context.Context, search *entity.AnswerSearch) ([]*entity.Answer, int64, error)
	GetPersonalAnswerPage(ctx context.Context, cond *entity.PersonalAnswerPageQueryCond) (
		resp []*entity.Answer, total int64, err error)
	AdminSearchList(ctx context.Context, search *schema.AdminAnswerPageReq) ([]*entity.Answer, int64, error)
	UpdateAnswerStatus(ctx context.Context, answerID string, status int) (err error)
	GetAnswerCount(ctx context.Context) (count int64, err error)
	RemoveAllUserAnswer(ctx context.Context, userID string) (err error)
	SumVotesByQuestionID(ctx context.Context, questionID string) (float64, error)
	DeletePermanentlyAnswers(ctx context.Context) (err error)
}

Jump to

Keyboard shortcuts

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