Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Attempt ¶
type Attempt struct {
ID int32 `json:"id,omitempty"`
Finished bool `json:"finished"`
Corrects int32 `json:"correct"`
Wrongs int32 `json:"wrong"`
Unanswered int32 `json:"unanswered"`
ParticipantID int32 `json:"participant_id,omitempty"`
ExamID int32 `json:"exam_id,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
}
func (*Attempt) ValidateNew ¶
type Filter ¶
type Filter struct {
ParticipantID int32 `json:"participant_id,omitempty"`
ExamID int32 `json:"exam_id,omitempty"`
}
Filter is a filter for listing questions.
type ListData ¶
type ListData struct {
// Questions is the list of questions returned from the operation.
Attempts []Attempt `json:"attempts,omitempty"`
// Total is the total number of questions available in the store.
TotalSize int32 `json:"total_size,omitempty"`
}
ListData is the data returned by the list operation.
type ListOptions ¶
type ListOptions struct {
Filter Filter `json:"filter,omitempty"`
Size int32 `json:"size,omitempty"`
Page int32 `json:"limit,omitempty"`
}
ListOptions is a list options for listing questions with pagination.
func (*ListOptions) Validate ¶
func (o *ListOptions) Validate() error
type Service ¶
type Service interface {
Save(ctx context.Context, a Attempt) (Attempt, error)
GetByID(ctx context.Context, id int32) (Attempt, error)
GetByParticipantID(ctx context.Context, participantId int32) (Attempt, error)
List(ctx context.Context, opts ListOptions) (ListData, error)
Update(ctx context.Context, a Attempt) (Attempt, error)
Delete(ctx context.Context, id int32) error
}
type Store ¶
type Store interface {
Save(ctx context.Context, a Attempt) (Attempt, error)
GetByID(ctx context.Context, id int32) (Attempt, error)
GetByParticipantID(ctx context.Context, participantId int32) (Attempt, error)
List(ctx context.Context, offset int32, limit int32, f Filter) ([]Attempt, error)
GetTotalSize(ctx context.Context, f Filter) (int32, error)
Update(ctx context.Context, a Attempt) (Attempt, error)
Delete(ctx context.Context, id int32) error
}
Click to show internal directories.
Click to hide internal directories.