Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DailyActivity ¶
type DailyActivity struct {
Date string `json:"date"` // "2006-01-02"
Words int `json:"words"` // 当天 SUM(word_delta)
}
DailyActivity 单天汇总字数。
type Store ¶
Store 管理 writing_log 持久化。
func (*Store) GetDailyActivity ¶
GetDailyActivity 返回最近 months 个月的每日字数汇总。
func (*Store) GetWritingStats ¶
func (s *Store) GetWritingStats(ctx context.Context, novelCount, chapterCount int64) (*WritingStats, error)
GetWritingStats 返回全局写作统计。
type WritingLog ¶
type WritingLog struct {
ID int64 `gorm:"column:id;primaryKey;autoIncrement"`
Date string `gorm:"column:date;not null;index:idx_writing_date;size:10"` // "2006-01-02"
NovelID int64 `gorm:"column:novel_id;not null;default:0;index"`
ChapterNumber int `gorm:"column:chapter_number;not null;default:0;index"`
WordDelta int `gorm:"column:word_delta;not null"`
CreatedAt time.Time `gorm:"column:created_at;autoCreateTime"`
}
WritingLog 记录每次保存的字数变化。正数表示新增,负数表示删除。 多行同一天的不同保存各自独立,查询时按 date GROUP BY SUM(word_delta)。
func (WritingLog) TableName ¶
func (WritingLog) TableName() string
type WritingStats ¶
type WritingStats struct {
TotalWords int `json:"total_words"`
TotalDaysActive int `json:"total_days_active"`
CurrentStreak int `json:"current_streak"`
LongestStreak int `json:"longest_streak"`
TotalNovels int64 `json:"total_novels"`
TotalChapters int64 `json:"total_chapters"`
}
WritingStats 全局写作统计。
Click to show internal directories.
Click to hide internal directories.