You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
791 B
Go

package question
import "context"
// Repository defines storage operations for questions.
type Repository interface {
GetByID(ctx context.Context, id string) (*Question, error)
Create(ctx context.Context, q *Question) (*Question, error)
Update(ctx context.Context, id string, q *Question) (*Question, error)
SoftDelete(ctx context.Context, id string) error
ListThemes(ctx context.Context) ([]string, error)
CountRandomCandidates(ctx context.Context, filter RandomFilter) (int, error)
RandomByOffset(ctx context.Context, filter RandomFilter, offset int) (*Question, error)
BulkCreate(ctx context.Context, questions []*Question) (created int, errs []BulkError, err error)
}
// BulkError captures a bulk import row-level failure.
type BulkError struct {
Index int
Reason string
}