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) RemoveCard(cardID string)
- func (deck *Deck) Review(cardID string, rating Rating)
- func (deck *Deck) Save() (err error)
- func (deck *Deck) SetCard(card Card)
- type FSRSCard
- 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) Load() (err error)
- func (store *FSRSStore) RemoveCard(id string) Card
- func (store *FSRSStore) Review(cardId string, rating Rating)
- func (store *FSRSStore) Save() (err error)
- func (store *FSRSStore) SetCard(card Card)
- type Rating
- 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)
// 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 (*Deck) GetCardsByBlockID ¶
func (*Deck) GetCardsByBlockIDs ¶
GetCardsByBlockIDs 获取指定内容块的所有卡片。
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) RemoveCard ¶
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
// GetBlockIDs 获取所有内容块 ID。
GetBlockIDs() []string
// CountCards 获取卡包中的闪卡数量。
CountCards() int
// Review 闪卡复习。
Review(id string, rating Rating)
// Dues 获取所有到期的闪卡列表。
Dues() []Card
// ID 获取存储 ID。
ID() string
// Algo 返回算法名称,如:fsrs。
Algo() Algo
// Load 从持久化存储中加载全部闪卡到内存。
Load() (err error)
// Save 将全部闪卡从内存保存到持久化存储中。
Save() error
// GetSaveDir 获取数据文件夹路径。
GetSaveDir() string
}
Store 描述了闪卡存储。
Click to show internal directories.
Click to hide internal directories.