models

package
v0.0.0-...-e3cadf0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package models provides entities for the flashcards services

Package models describes models for application.

Documentation for MADR API.

Schemes: http BasePath: / Version: 0.0.1 Contact: Artyom Blaginin<pelageech@mail.ru>

Consumes: - application/json

Produces: - application/json

swagger:meta

Index

Constants

View Source
const (
	Translation = BacksideType(iota)
	Definition
)

Variables

This section is empty.

Functions

func ParseBackside

func ParseBackside(b Backside) string

ParseBackside returns a new string from value of backside if needed.

For example, from base64 to another string.

Types

type AddFlashcardToDeckRequest

type AddFlashcardToDeckRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// DeckId is an ID of the deck which the flashcard will be added to.
	//
	// required: true
	// example: 123
	DeckId DeckId `json:"deck_id"`

	// Word is a head side of the card.
	//
	// required: true
	// example: Aboba
	Word Word `json:"word"`

	// Backside is a back side of the card.
	//
	// required: true
	// example: Backside{Type: TypeDefinition, Value: "President"}
	Backside Backside `json:"backside"`

	// Answer is an answer for exercises.
	//
	// required: true
	// example: "aboba"
	Answer Answer `json:"answer"`
}

AddFlashcardToDeckRequest is a struct that defines the request body for adding cards to the deck handler.

type AddFlashcardToDeckResponse

type AddFlashcardToDeckResponse struct{}

AddFlashcardToDeckResponse is a struct that defines the response body for adding cards to the deck handler.

type Answer

type Answer = string

type AppendBacksideRequest

type AppendBacksideRequest struct {
	UserId    UserId      `json:"user_id"`
	CardId    FlashcardId `json:"card_id"`
	Backsides []Backside  `json:"backsides"`
}

type AppendBacksideResponse

type AppendBacksideResponse struct{}

type Backside

type Backside struct {
	Type  BacksideType `json:"type"`
	Value string       `json:"value"`
}

Backside is an abstract type for representation an answer of describing the Word. That can be just a string (translation, definition) or image, or sound - everything depends on Answer method.

func (*Backside) Scan

func (b *Backside) Scan(value any) error

type BacksideType

type BacksideType int

BacksideType tells how to imagine a value of Backside.

type Box

type Box = int

type CoolDown

type CoolDown time.Time

CoolDown describes the timestamp. If the current time is less than the CoolDown state, the flashcard will not be shown for study.

func (*CoolDown) IsPassed

func (cd *CoolDown) IsPassed(t CoolDown) bool

IsPassed returns true if state of cd is not less than t.

func (*CoolDown) IsPassedNow

func (cd *CoolDown) IsPassedNow() bool

IsPassedNow returns true if state of CoolDown is not less than time.Now.

func (*CoolDown) NextState

func (cd *CoolDown) NextState(b Box, f func(Box) time.Time)

NextState updates the state of cd relatively f.

type DeckConfig

type DeckConfig struct {
	// DeckId is a unique identifier of the deck.
	//
	// required: true
	// example: 1
	DeckId DeckId `json:"deck_id"`

	// UserId means that a user with UserId has the deck with id DeckId.
	//
	// required: true
	// example: 12
	UserId UserId `json:"user_id"`

	// Name is a name of the deck which the user assigned to it.
	//
	// required: true
	// example: Bangladesh famous words
	Name string `json:"name"`
}

DeckConfig contains information about a particular deck. DeckId is not a primary key, for each user a configuration can be different.

type DeckId

type DeckId = int

type Decks

type Decks map[DeckId]DeckConfig

Decks is a map of decks which config can be got by id.

func (Decks) Keys

func (d Decks) Keys() []DeckId

func (Decks) Values

func (d Decks) Values() []DeckConfig

type DeleteDeckRequest

type DeleteDeckRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// DeckId is an ID of the deck which will be deleted.
	//
	// required: true
	// example: 123
	DeckId DeckId `json:"deck_id"`
}

DeleteDeckRequest is a struct that defines the request body for the deleting the deck handler.

type DeleteDeckResponse

type DeleteDeckResponse struct{}

DeleteDeckResponse is a struct that defines the response body for the deleting the deck handler.

type DeleteFlashcardFromDeckRequest

type DeleteFlashcardFromDeckRequest struct {
	// UserId is an ID of the user.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// FlashcardId is an ID of the flashcard.
	//
	// required: true
	// example: 666
	FlashcardId FlashcardId `json:"flashcard_id"`
}

DeleteFlashcardFromDeckRequest is a struct that defines the request body for deleting cards from the deck handler.

type DeleteFlashcardFromDeckResponse

type DeleteFlashcardFromDeckResponse struct{}

DeleteFlashcardFromDeckResponse is a struct that defines the response body for deleting cards from the deck handler.

type Flashcard

type Flashcard struct {
	Id FlashcardId `json:"id"`
	W  Word        `json:"word"`
	A  Answer      `json:"answer"`
	B  Backside    `json:"backside"`
	MB []Backside  `json:"multiple_backside"`

	// DeckId shows which deck the flashcard belongs to.
	DeckId DeckId `json:"deck_id"`
}

Flashcard is a model of real flashcards with front side with word and back side containing some information that describes a word.

type FlashcardId

type FlashcardId = int

type GetFlashcardByIdResponse

type GetFlashcardByIdResponse struct {
	Flashcard Flashcard `json:"flashcard"`
}

GetFlashcardByIdResponse is a response that contains a flashcard.

type GetFlashcardsByDeckIdRequest

type GetFlashcardsByDeckIdRequest struct {
	// DeckId defines the deck which flashcards will be loaded from.
	//
	// required: true
	// example: 123
	DeckId DeckId `json:"deck_id"`
}

GetFlashcardsByDeckIdRequest is a struct that defines the request body for loading cards from the deck handler.

type GetFlashcardsByDeckIdResponse

type GetFlashcardsByDeckIdResponse struct {
	// Flashcards is a slice of flashcards that is returned to the client.
	//
	// Extensions:
	// ---
	// x-property-value: value
	// x-property-array:
	//   - value1
	//   - value2
	// x-property-array-obj:
	//   - name: obj
	//     value: field
	// ---
	Flashcards []Flashcard `json:"flashcards"`
}

GetFlashcardsByDeckIdResponse is a struct that defines the response body for loading cards from the deck handler.

type LeitnerId

type LeitnerId = int

type LoadDecksRequest

type LoadDecksRequest struct {
	// UserId is used for loading for the cards that the user has.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`
}

LoadDecksRequest is a struct that defines the request body for loading deck handler.

type LoadDecksResponse

type LoadDecksResponse struct {
	// Decks is a slice of deck with their configs.
	//
	// Extensions:
	// ---
	// x-property-value: value
	// x-property-array:
	//   - value1
	//   - value2
	// x-property-array-obj:
	//   - name: obj
	//     value: field
	// ---
	Decks []DeckConfig `json:"decks"`
}

LoadDecksResponse is a struct that defines the response body for loading deck handler.

type Mark

type Mark int

Mark is a type of rating marks of flashcards in Leitner's system.

type Matching

type Matching struct {
	M     map[string]string    `json:"pairs"`
	Cards map[string]Flashcard `json:"cards"`
}

Matching is used for exercises connected with matching words with their definitions or other answers.

type NewDeckWithFlashcardsRequest

type NewDeckWithFlashcardsRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// Name is a name of the deck
	//
	// required: true
	// example: Aboba123
	Name string `json:"name"`

	// Flashcards is a slice of flashcards that will be added.
	//
	// Extensions:
	// ---
	// x-property-value: value
	// x-property-array:
	//   - value1
	//   - value2
	// x-property-array-obj:
	//   - name: obj
	//     value: field
	// ---
	Flashcards []struct {
		Word     Word     `json:"word"`
		Backside Backside `json:"backside"`
		Answer   Answer   `json:"answer"`
	} `json:"flashcards"`
}

NewDeckWithFlashcardsRequest is a struct that defines the request body for creating a new deck handler.

type NewDeckWithFlashcardsResponse

type NewDeckWithFlashcardsResponse struct{}

NewDeckWithFlashcardsResponse is a struct that defines the response body for creating a new deck handler.

type RandomCardDeckRequest

type RandomCardDeckRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// DeckId is an ID of the deck where the flashcard are taken from.
	//
	// required: true
	// example: 123
	DeckId DeckId `json:"deck_id"`
}

RandomCardDeckRequest is a struct that defines the request body for the getting a random card from the deck.

type RandomCardDeckResponse

type RandomCardDeckResponse struct {
	// Flashcard is a flashcard that is returned to the user.
	Flashcard Flashcard `json:"flashcard"`
}

RandomCardDeckResponse is a struct that defines the response body for getting a random card from the deck.

type RandomCardRequest

type RandomCardRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`
}

RandomCardRequest is a struct that defines the request body for getting a random card from all the decks.

type RandomCardResponse

type RandomCardResponse struct {
	// Flashcard is a flashcard that is returned to the user.
	Flashcard Flashcard `json:"flashcard"`
}

RandomCardResponse is a struct that defines the response body for getting a random card from all the decks.

type RandomMatchingDeckRequest

type RandomMatchingDeckRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// DeckId is an ID of the deck where the flashcard are taken from.
	//
	// required: true
	// example: 123
	DeckId DeckId `json:"deck_id"`

	// Size is the max amount of cards to include int the exercise
	//
	// required: true
	// example: 5
	Size int `json:"size"`
}

RandomMatchingDeckRequest is a struct that defines the request body for getting a random matching exercise from the deck.

type RandomMatchingDeckResponse

type RandomMatchingDeckResponse struct {
	Matching Matching `json:"matching"`
}

RandomMatchingDeckRequest is a struct that defines the request body for getting a random matching from the deck.

type RandomMatchingRequest

type RandomMatchingRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// Size is the max amount of cards to include int the exercise
	//
	// required: true
	// example: 5
	Size int `json:"size"`
}

RandomMatchingRequest is a struct that defines the request body for getting a random matching exercise from all the decks.

type RandomMatchingResponse

type RandomMatchingResponse struct {
	Matching Matching `json:"matching"`
}

RandomMatchingRequest is a struct that defines the request body for getting a random matching from all the decks.

type RandomNCardsDeckRequest

type RandomNCardsDeckRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// DeckId is an ID of the deck where the flashcard are taken from.
	//
	// required: true
	// example: 123
	DeckId DeckId `json:"deck_id"`

	// Amount of cards to get
	N int `json:"n"`
}

RandomNCardsDeckRequest is a struct that defines the request body for getting n random cards from the deck.

type RandomNCardsDeckResponse

type RandomNCardsDeckResponse struct {
	// Flashcard is a flashcard that is returned to the user.
	Flashcards []Flashcard `json:"flashcards"`
}

RandomNCardsDeckResponse is a struct that defines the response body for getting n random cards from the deck.

type RandomNCardsRequest

type RandomNCardsRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// Amount of cards to get
	N int `json:"n"`
}

RandomNCardsRequest is a struct that defines the request body for getting n random cards from all the decks.

type RandomNCardsResponse

type RandomNCardsResponse struct {
	// Flashcard is a flashcard that is returned to the user.
	Flashcards []Flashcard `json:"flashcards"`
}

RandomNCardsResponse is a struct that defines the response body for getting n random cards from all the decks.

type RandomTextDeckRequest

type RandomTextDeckRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// DeckId is an ID of the deck where the flashcard are taken from.
	//
	// required: true
	// example: 123
	DeckId DeckId `json:"deck_id"`

	// Size is the max amount of cards to include int the exercise
	//
	// required: true
	// example: 5
	Size int `json:"size"`
}

RandomTextDeckRequest is a struct that defines the request body for getting a random text exercise from all the decks.

type RandomTextDeckResponse

type RandomTextDeckResponse struct {
	Text Text `json:"text"`
}

RandomTextDeckResponse is a struct that defines the response body for getting a random text exercise from all the decks.

type RandomTextRequest

type RandomTextRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// Size is the max amount of cards to include int the exercise
	//
	// required: true
	// example: 5
	Size int `json:"size"`
}

RandomTextRequest is a struct that defines the request body for getting a random text exercise from all the decks.

type RandomTextResponse

type RandomTextResponse struct {
	Text Text `json:"text"`
}

RandomTextResponse is a struct that defines the response body for getting a random text exercise from all the decks.

type RateRequest

type RateRequest struct {
	// UserId is an ID of the user in a storage.
	//
	// required: true
	// example: 189
	UserId UserId `json:"user_id"`

	// FlashcardId is an ID of the flashcard.
	//
	// required: true
	// example: 1111
	FlashcardId FlashcardId `json:"flashcard_id"`

	// Mark is a mark for the card.
	//
	// required: true
	// example: 0, 1 or 2
	Mark Mark `json:"mark"`
}

RateRequest is a struct that defines the request body for the rating a card.

type RateResponse

type RateResponse struct{}

RateResponse is a struct that defines the request body for the rating a card.

type SwaggerAddFlashcardToDeckBadRequestError

type SwaggerAddFlashcardToDeckBadRequestError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response addFlashcardToDeckBadRequestError

type SwaggerAddFlashcardToDeckCreatedResponse

type SwaggerAddFlashcardToDeckCreatedResponse struct{}

swagger:response addFlashcardToDeckCreatedResponse

type SwaggerAddFlashcardToDeckInternalServerError

type SwaggerAddFlashcardToDeckInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response addFlashcardToDeckInternalServerError

type SwaggerDeleteDeckBadRequestError

type SwaggerDeleteDeckBadRequestError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response deleteDeckBadRequestError

type SwaggerDeleteDeckInternalServerError

type SwaggerDeleteDeckInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response deleteDeckInternalServerError

type SwaggerDeleteDeckNoContentResponse

type SwaggerDeleteDeckNoContentResponse struct{}

swagger:response deleteDeckNoContentResponse

type SwaggerDeleteFlashcardFromDeckBadRequestError

type SwaggerDeleteFlashcardFromDeckBadRequestError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response deleteFlashcardFromDeckBadRequestError

type SwaggerDeleteFlashcardFromDeckInternalServerError

type SwaggerDeleteFlashcardFromDeckInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response deleteFlashcardFromDeckInternalServerError

type SwaggerDeleteFlashcardFromDeckNoContentResponse

type SwaggerDeleteFlashcardFromDeckNoContentResponse struct{}

swagger:response deleteFlashcardFromDeckNoContentResponse

type SwaggerGetFlashcardByIdBadRequest

type SwaggerGetFlashcardByIdBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response getFlashcardByIdBadRequestError

type SwaggerGetFlashcardByIdInternalServerError

type SwaggerGetFlashcardByIdInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response getFlashcardByIdInternalServerError

type SwaggerGetFlashcardByIdOkResponse

type SwaggerGetFlashcardByIdOkResponse struct {
	// in: body
	Body GetFlashcardByIdResponse
}

swagger:response getFlashcardByIdOKResponse

type SwaggerGetFlashcardsByDeckIdBadRequestError

type SwaggerGetFlashcardsByDeckIdBadRequestError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response getFlashcardsByDeckIdBadRequestError

type SwaggerGetFlashcardsByDeckIdInternalServerError

type SwaggerGetFlashcardsByDeckIdInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response getFlashcardsByDeckIdInternalServerError

type SwaggerGetFlashcardsByDeckIdOkResponse

type SwaggerGetFlashcardsByDeckIdOkResponse struct {
	// in: body
	Body GetFlashcardsByDeckIdResponse
}

swagger:response getFlashcardsByDeckIdOkResponse

type SwaggerLoadDecksBadRequestError

type SwaggerLoadDecksBadRequestError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response loadDecksBadRequestError

type SwaggerLoadDecksInternalServerError

type SwaggerLoadDecksInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response loadDecksInternalServerError

type SwaggerLoadDecksOkResponse

type SwaggerLoadDecksOkResponse struct {
	// in: body
	Body LoadDecksResponse
}

swagger:response loadDecksOkResponse

type SwaggerNewDeckWithFlashcardsBadRequestError

type SwaggerNewDeckWithFlashcardsBadRequestError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response newDeckWithFlashcardsBadRequestError

type SwaggerNewDeckWithFlashcardsInternalServerError

type SwaggerNewDeckWithFlashcardsInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response newDeckWithFlashcardsInternalServerError

type SwaggerNewDeckWithFlashcardsNoContentResponse

type SwaggerNewDeckWithFlashcardsNoContentResponse struct{}

swagger:response newDeckWithFlashcardsCreatedResponse

type SwaggerRandomCardBadRequest

type SwaggerRandomCardBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomCardBadRequestError

type SwaggerRandomCardDeckBadRequest

type SwaggerRandomCardDeckBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomCardDeckBadRequestError

type SwaggerRandomCardDeckInternalServerError

type SwaggerRandomCardDeckInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomCardDeckInternalServerError

type SwaggerRandomCardDeckOkResponse

type SwaggerRandomCardDeckOkResponse struct {
	// in: body
	Body RandomCardDeckResponse
}

swagger:response randomCardDeckOkResponse

type SwaggerRandomCardInternalServerError

type SwaggerRandomCardInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomCardInternalServerError

type SwaggerRandomCardOkResponse

type SwaggerRandomCardOkResponse struct {
	// in: body
	Body RandomCardResponse
}

swagger:response randomCardOkResponse

type SwaggerRandomMatchingBadRequest

type SwaggerRandomMatchingBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomMatchingBadRequestError

type SwaggerRandomMatchingDeckBadRequest

type SwaggerRandomMatchingDeckBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomMatchingDeckBadRequestError

type SwaggerRandomMatchingDeckInternalServerError

type SwaggerRandomMatchingDeckInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomMatchingDeckInternalServerError

type SwaggerRandomMatchingDeckOkResponse

type SwaggerRandomMatchingDeckOkResponse struct {
	// in: body
	Body RandomMatchingDeckResponse
}

swagger:response randomMatchingDeckOkResponse

type SwaggerRandomMatchingInternalServerError

type SwaggerRandomMatchingInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomMatchingInternalServerError

type SwaggerRandomMatchingOkResponse

type SwaggerRandomMatchingOkResponse struct {
	// in: body
	Body RandomMatchingResponse
}

swagger:response randomMatchingOkResponse

type SwaggerRandomNCardsBadRequest

type SwaggerRandomNCardsBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomNCardsBadRequestError

type SwaggerRandomNCardsDeckBadRequest

type SwaggerRandomNCardsDeckBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomNCardsDeckBadRequestError

type SwaggerRandomNCardsDeckInternalServerError

type SwaggerRandomNCardsDeckInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomNCardsDeckInternalServerError

type SwaggerRandomNCardsDeckOkResponse

type SwaggerRandomNCardsDeckOkResponse struct {
	// in: body
	Body RandomNCardsDeckResponse
}

swagger:response randomNCardsDeckOkResponse

type SwaggerRandomNCardsInternalServerError

type SwaggerRandomNCardsInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomNCardsInternalServerError

type SwaggerRandomNCardsOkResponse

type SwaggerRandomNCardsOkResponse struct {
	// in: body
	Body RandomNCardsResponse
}

swagger:response randomNCardsOkResponse

type SwaggerRandomTextBadRequest

type SwaggerRandomTextBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomTextBadRequestError

type SwaggerRandomTextDeckBadRequest

type SwaggerRandomTextDeckBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomTextDeckBadRequestError

type SwaggerRandomTextDeckInternalServerError

type SwaggerRandomTextDeckInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomTextDeckInternalServerError

type SwaggerRandomTextDeckOkResponse

type SwaggerRandomTextDeckOkResponse struct {
	// in: body
	Body RandomTextDeckResponse
}

swagger:response randomTextDeckOkResponse

type SwaggerRandomTextInternalServerError

type SwaggerRandomTextInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response randomTextInternalServerError

type SwaggerRandomTextOkResponse

type SwaggerRandomTextOkResponse struct {
	// in: body
	Body RandomTextResponse
}

swagger:response randomTextOkResponse

type SwaggerRateBadRequest

type SwaggerRateBadRequest struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response rateBadRequestError

type SwaggerRateInternalServerError

type SwaggerRateInternalServerError struct {
	// in: body
	Body ioutil.GenericError
}

swagger:response rateInternalServerError

type SwaggerRateNoContentResponse

type SwaggerRateNoContentResponse struct{}

swagger:response rateNoContentResponse

type Text

type Text struct {
	// The words to guess are escaped like this: <div style=\"display:none;\"> WORD </div>
	T string `json:"text"`

	// Options for filling the spaces
	Opts  []string             `json:"options"`
	Cards map[string]Flashcard `json:"cards"`
}

Text is used for exercises connected with insertion words in a sentence.

type UserId

type UserId = int

type UserInfo

type UserInfo struct {
	UserId UserId `json:"user_id"` // primary

	// MaxBox is a maximal amount of boxes in Leitner's system.
	MaxBox Box `json:"max_box"`
}

UserInfo contains information about the user.

type UserLeitner

type UserLeitner struct {
	Id          LeitnerId   `json:"id"` // primary
	UserId      UserId      `json:"user_id"`
	FlashcardId FlashcardId `json:"card_id"`

	// Box is an item in Leitner's system showing frequency
	// of studying flashcards. The higher box, the more cool down.
	Box Box `json:"box"`

	// CoolDown is a timestamp showing when the flashcard will be ready
	// to be examined.
	CoolDown CoolDown `json:"cool_down"`
}

UserLeitner is a configuration of Leitner's system for each user.

For each user the structure contains a FlashcardId with its Box and CoolDown. CoolDown is a timestamp after which the card can be examined again.

There is a bijection between (UserId, FlashcardId) and UserLeitner.

type Word

type Word = string

Jump to

Keyboard shortcuts

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