Documentation
¶
Index ¶
- func Dir(useLocal bool, name string) http.FileSystem
- func FS(useLocal bool) http.FileSystem
- func FSByte(useLocal bool, name string) ([]byte, error)
- func FSMustByte(useLocal bool, name string) []byte
- func FSMustString(useLocal bool, name string) string
- func FSString(useLocal bool, name string) (string, error)
- type Server
- type SessionState
- type TUI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dir ¶
func Dir(useLocal bool, name string) http.FileSystem
Dir returns a http.Filesystem for the embedded assets on a given prefix dir. If useLocal is true, the filesystem's contents are instead used.
func FS ¶
func FS(useLocal bool) http.FileSystem
FS returns a http.Filesystem for the embedded assets. If useLocal is true, the filesystem's contents are instead used.
func FSByte ¶
FSByte returns the named file from the embedded assets. If useLocal is true, the filesystem's contents are instead used.
func FSMustByte ¶
FSMustByte is the same as FSByte, but panics if name is not present.
func FSMustString ¶
FSMustString is the string version of FSMustByte.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements web ui for reviews.
func NewServer ¶
func NewServer(dm *leaf.DeckManager) *Server
NewServer construct a new Server instance.
type SessionState ¶
type SessionState struct { Total int `json:"total"` Left int `json:"left"` Question string `json:"question"` AnswerLen int `json:"answer_length"` RatingType leaf.RatingType `json:"rating_type"` Sides []string `json:"sides"` // contains filtered or unexported fields }
SessionState state holds public state of the ReviewSession.
func NewSessionState ¶
func NewSessionState(session *leaf.ReviewSession) *SessionState
NewSessionState constructs a new SessionState.
func (*SessionState) Advance ¶
func (s *SessionState) Advance(score leaf.ReviewScore)
Advance fetches next question if available or sets session to finished otherwise.
func (*SessionState) ResolveAnswer ¶
func (s *SessionState) ResolveAnswer() (correctAnswer string)
ResolveAnswer submits answer to a session.