Documentation
¶
Index ¶
- type Algo
- type BaseCard
- type BaseStore
- type Card
- type Deck
- func (deck *Deck) AddCard(cardID, blockID string)
- func (deck *Deck) CountCards() int
- func (deck *Deck) Dues() (ret []Card)
- func (deck *Deck) GetBlockIDs() (ret []string)
- func (deck *Deck) GetCard(cardID string) Card
- func (deck *Deck) GetCardsByBlockID(blockID string) (ret []Card)
- func (deck *Deck) GetCardsByBlockIDs(blockIDs []string) (ret []Card)
- func (deck *Deck) GetDueCardsByBlockIDs(blockIDs []string) (ret []Card)
- func (deck *Deck) GetNewCardsByBlockIDs(blockIDs []string) (ret []Card)
- func (deck *Deck) RemoveCard(cardID string)
- func (deck *Deck) Review(cardID string, rating Rating) (ret *Log)
- func (deck *Deck) Save() (err error)
- func (deck *Deck) SaveLog(log *Log) (err error)
- func (deck *Deck) SetCard(card Card)
- type FSRSCard
- func (card *FSRSCard) Clone() Card
- func (card *FSRSCard) GetLapses() int
- func (card *FSRSCard) GetLastReview() time.Time
- func (card *FSRSCard) GetReps() int
- func (card *FSRSCard) GetState() State
- func (card *FSRSCard) Impl() interface{}
- func (card *FSRSCard) SetDue(due time.Time)
- func (card *FSRSCard) SetImpl(c interface{})
- type FSRSStore
- func (store *FSRSStore) AddCard(id, blockID string) Card
- func (store *FSRSStore) CountCards() int
- func (store *FSRSStore) Dues() (ret []Card)
- func (store *FSRSStore) GetBlockIDs() (ret []string)
- func (store *FSRSStore) GetCard(id string) Card
- func (store *FSRSStore) GetCardsByBlockID(blockID string) (ret []Card)
- func (store *FSRSStore) GetCardsByBlockIDs(blockIDs []string) (ret []Card)
- func (store *FSRSStore) GetDueCardsByBlockIDs(blockIDs []string) (ret []Card)
- func (store *FSRSStore) GetNewCardsByBlockIDs(blockIDs []string) (ret []Card)
- func (store *FSRSStore) Load() (err error)
- func (store *FSRSStore) RemoveCard(id string) Card
- func (store *FSRSStore) Review(cardId string, rating Rating) (ret *Log)
- func (store *FSRSStore) Save() (err error)
- func (store *FSRSStore) SaveLog(log *Log) (err error)
- func (store *FSRSStore) SetCard(card Card)
- type Log
- type Rating
- type State
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseStore ¶
type BaseStore struct {
// contains filtered or unexported fields
}
BaseStore 描述了基础的闪卡存储实现。
func (*BaseStore) GetSaveDir ¶
type Card ¶
type Card interface { // ID 返回闪卡 ID。 ID() string // BlockID 返回闪卡关联的内容块 ID。 BlockID() string // NextDues 返回每种评分对应的下次到期时间。 NextDues() map[Rating]time.Time // SetNextDues 设置每种评分对应的下次到期时间。 SetNextDues(map[Rating]time.Time) // SetDue 设置到期时间。 SetDue(time.Time) // GetLapses 返回闪卡的遗忘次数。 GetLapses() int // GetReps 返回闪卡的复习次数。 GetReps() int // GetState 返回闪卡状态。 GetState() State // GetLastReview 返回闪卡的最后复习时间。 GetLastReview() time.Time // Clone 返回闪卡的克隆。 Clone() Card // Impl 返回具体的闪卡实现。 Impl() interface{} // SetImpl 设置具体的闪卡实现。 SetImpl(c interface{}) }
Card 描述了闪卡。
type Deck ¶
type Deck struct { ID string // ID Name string // 名称 Algo Algo // 间隔重复算法 Desc string // 描述 Created int64 // 创建时间 Updated int64 // 更新时间 // contains filtered or unexported fields }
Deck 描述了一套闪卡包。
func LoadDeck ¶
func LoadDeck(saveDir, id string, requestRetention float64, maximumInterval int, weights string) (deck *Deck, err error)
LoadDeck 从文件夹 saveDir 路径上加载 id 闪卡包。
func (*Deck) GetCardsByBlockID ¶
func (*Deck) GetCardsByBlockIDs ¶
GetCardsByBlockIDs 获取指定内容块的所有卡片。
func (*Deck) GetDueCardsByBlockIDs ¶
func (*Deck) GetNewCardsByBlockIDs ¶
type FSRSStore ¶
type FSRSStore struct { *BaseStore // contains filtered or unexported fields }
func NewFSRSStore ¶
func (*FSRSStore) CountCards ¶
func (*FSRSStore) GetBlockIDs ¶
func (*FSRSStore) GetCardsByBlockID ¶
func (*FSRSStore) GetCardsByBlockIDs ¶
func (*FSRSStore) GetDueCardsByBlockIDs ¶
func (*FSRSStore) GetNewCardsByBlockIDs ¶
func (*FSRSStore) RemoveCard ¶
type Log ¶
type Log struct { ID string CardID string Rating Rating ScheduledDays uint64 ElapsedDays uint64 Reviewed int64 State State }
Log 描述了复习日志记录。
type Store ¶
type Store interface { // AddCard 添加一张卡片。 AddCard(id, blockID string) Card // GetCard 获取一张卡片。 GetCard(id string) Card // SetCard 设置一张卡片。 SetCard(card Card) // RemoveCard 移除一张卡片。 RemoveCard(id string) Card // GetCardsByBlockID 获取指定内容块的所有卡片。 GetCardsByBlockID(blockID string) []Card // GetCardsByBlockIDs 获取指定内容块的所有卡片。 GetCardsByBlockIDs(blockIDs []string) []Card // GetNewCardsByBlockIDs 获取指定内容块的所有新的卡片(制卡后没有进行过复习的卡片)。 GetNewCardsByBlockIDs(blockIDs []string) []Card // GetDueCardsByBlockIDs 获取指定内容块的所有到期的卡片。 GetDueCardsByBlockIDs(blockIDs []string) []Card // GetBlockIDs 获取所有内容块 ID。 GetBlockIDs() []string // CountCards 获取卡包中的闪卡数量。 CountCards() int // Review 闪卡复习。 Review(id string, rating Rating) (ret *Log) // Dues 获取所有到期的闪卡列表。 Dues() []Card // ID 获取存储 ID。 ID() string // Algo 返回算法名称,如:fsrs。 Algo() Algo // Load 从持久化存储中加载全部闪卡到内存。 Load() (err error) // Save 将全部闪卡从内存保存到持久化存储中。 Save() error // SaveLog 保存复习日志。 SaveLog(log *Log) error // GetSaveDir 获取数据文件夹路径。 GetSaveDir() string }
Store 描述了闪卡存储。
Click to show internal directories.
Click to hide internal directories.