repository

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedExamineRepository added in v0.1.8

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

func (*CachedExamineRepository) GetResultByUidAndQid added in v0.1.8

func (repo *CachedExamineRepository) GetResultByUidAndQid(ctx context.Context, uid int64, qid int64) (domain.Result, error)

func (*CachedExamineRepository) GetResultsByIds added in v0.1.8

func (repo *CachedExamineRepository) GetResultsByIds(ctx context.Context, uid int64, ids []int64) ([]domain.ExamineResult, error)

func (*CachedExamineRepository) SaveResult added in v0.1.8

func (repo *CachedExamineRepository) SaveResult(ctx context.Context, uid, qid int64, result domain.ExamineResult) error

func (*CachedExamineRepository) UpdateQuestionResult added in v0.3.0

func (repo *CachedExamineRepository) UpdateQuestionResult(ctx context.Context, uid int64, qid int64, result domain.Result) error

type CachedRepository

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

CachedRepository 支持缓存的 repository 实现 虽然在 Save 的时候,理论上也需要更新缓存,但是没有必要

func (*CachedRepository) Create

func (c *CachedRepository) Create(ctx context.Context, question *domain.Question) (int64, error)

func (*CachedRepository) Delete added in v0.1.0

func (c *CachedRepository) Delete(ctx context.Context, qid int64) error

func (*CachedRepository) ExcludeQuestions added in v0.2.1

func (c *CachedRepository) ExcludeQuestions(ctx context.Context, ids []int64, offset int, limit int) ([]domain.Question, int64, error)

func (*CachedRepository) GetById

func (c *CachedRepository) GetById(ctx context.Context, qid int64) (domain.Question, error)

func (*CachedRepository) GetPubByID

func (c *CachedRepository) GetPubByID(ctx context.Context, qid int64) (domain.Question, error)

func (*CachedRepository) GetPubByIDs added in v0.0.2

func (c *CachedRepository) GetPubByIDs(ctx context.Context, qids []int64) ([]domain.Question, error)

func (*CachedRepository) List

func (c *CachedRepository) List(ctx context.Context, offset int, limit int) ([]domain.Question, error)

func (*CachedRepository) PubList

func (c *CachedRepository) PubList(ctx context.Context, offset int, limit int, biz string) ([]domain.Question, error)

func (*CachedRepository) Sync

func (c *CachedRepository) Sync(ctx context.Context, que *domain.Question) (int64, error)

func (*CachedRepository) Total

func (c *CachedRepository) Total(ctx context.Context) (int64, error)

func (*CachedRepository) Update

func (c *CachedRepository) Update(ctx context.Context, question *domain.Question) error

type ExamineRepository added in v0.1.8

type ExamineRepository interface {
	SaveResult(ctx context.Context, uid, qid int64, result domain.ExamineResult) error
	GetResultByUidAndQid(ctx context.Context, uid int64, qid int64) (domain.Result, error)
	GetResultsByIds(ctx context.Context, uid int64, ids []int64) ([]domain.ExamineResult, error)
	UpdateQuestionResult(ctx context.Context, uid int64, qid int64, result domain.Result) error
}

func NewCachedExamineRepository added in v0.1.8

func NewCachedExamineRepository(dao dao.ExamineDAO) ExamineRepository

type QuestionSetRepository

type QuestionSetRepository interface {
	Create(ctx context.Context, set domain.QuestionSet) (int64, error)
	UpdateQuestions(ctx context.Context, set domain.QuestionSet) error
	GetByID(ctx context.Context, id int64) (domain.QuestionSet, error)
	Total(ctx context.Context) (int64, error)
	List(ctx context.Context, offset int, limit int) ([]domain.QuestionSet, error)
	UpdateNonZero(ctx context.Context, set domain.QuestionSet) error
	GetByIDs(ctx context.Context, ids []int64) ([]domain.QuestionSet, error)
	GetByIDsWithQuestion(ctx context.Context, ids []int64) ([]domain.QuestionSet, error)
	ListByBiz(ctx context.Context, offset, limit int, biz string) ([]domain.QuestionSet, error)
	GetByBiz(ctx context.Context, biz string, bizId int64) (domain.QuestionSet, error)
}

func NewQuestionSetRepository

func NewQuestionSetRepository(d dao.QuestionSetDAO) QuestionSetRepository

type Repository

type Repository interface {
	PubList(ctx context.Context, offset int, limit int, biz string) ([]domain.Question, error)
	// Sync 保存到制作库,而后同步到线上库
	Sync(ctx context.Context, que *domain.Question) (int64, error)
	List(ctx context.Context, offset int, limit int) ([]domain.Question, error)
	Total(ctx context.Context) (int64, error)
	Update(ctx context.Context, question *domain.Question) error
	Create(ctx context.Context, question *domain.Question) (int64, error)
	// Delete 会直接删除制作库和线上库的数据
	Delete(ctx context.Context, qid int64) error

	GetById(ctx context.Context, qid int64) (domain.Question, error)
	GetPubByID(ctx context.Context, qid int64) (domain.Question, error)
	GetPubByIDs(ctx context.Context, ids []int64) ([]domain.Question, error)
	// ExcludeQuestions 分页接口,不含这些 id 的问题
	ExcludeQuestions(ctx context.Context, ids []int64, offset int, limit int) ([]domain.Question, int64, error)
}

func NewCacheRepository

func NewCacheRepository(d dao.QuestionDAO, c cache.QuestionCache) Repository

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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