quiz

package
v0.0.0-...-4b2da47 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Answer

type Answer struct {
	Value string
	Err   error
}

type AnswerReader

type AnswerReader interface {
	NextAnswer() Answer
}

AnswerReader interface returns real answer and error

type FileAnswerStore

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

func NewFileAnswerStore

func NewFileAnswerStore(f *os.File) *FileAnswerStore

Factory function which takes descriptor of file with answers and returns pointer to FileAnswerStore.

func (*FileAnswerStore) NextAnswer

func (s *FileAnswerStore) NextAnswer() Answer

type Quiz

type Quiz struct {
	Question string
	Answer   string
	Err      error
}

type QuizReader

type QuizReader interface {
	NextQuiz() Quiz
	Total() int
	Shuffle()
}

Quizer interface gets record from quiz data and returns question, correct answer and error

type SliceAnswerStore

type SliceAnswerStore struct {
	Data []string
	// contains filtered or unexported fields
}

func (*SliceAnswerStore) NextAnswer

func (a *SliceAnswerStore) NextAnswer() Answer

type SliceDelayedAnswerStore

type SliceDelayedAnswerStore struct {
	SliceAnswerStore
	Delay time.Duration
}

func (*SliceDelayedAnswerStore) NextAnswer

func (a *SliceDelayedAnswerStore) NextAnswer() Answer

type SliceQuizStore

type SliceQuizStore struct {
	Data [][]string
	// contains filtered or unexported fields
}

func NewSliceQuizFromCsv

func NewSliceQuizFromCsv(fd *os.File) (*SliceQuizStore, error)

Factory function which get file descriptor and reads all records into SliceQuizStore

func (*SliceQuizStore) NextQuiz

func (q *SliceQuizStore) NextQuiz() Quiz

func (*SliceQuizStore) Shuffle

func (q *SliceQuizStore) Shuffle()

func (*SliceQuizStore) Total

func (q *SliceQuizStore) Total() int

Jump to

Keyboard shortcuts

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