Help us shape the future of Go! Take the 2026 Go Developer Survey

novel

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListNovelsOptions

type ListNovelsOptions struct {
	PageParams storage.PageParams
	Genre      string // 空字符串=不过滤
	Search     string // 空字符串=不过滤,按 title LIKE 匹配
}

ListNovelsOptions 是 List 方法的可选过滤条件。零值表示不过滤。

type Novel

type Novel struct {
	ID          int64     `gorm:"column:id;primaryKey;autoIncrement" json:"id"`
	Title       string    `gorm:"column:title;not null;index"        json:"title"`
	Genre       string    `gorm:"column:genre;index"                 json:"genre"`
	Description string    `gorm:"column:description"                 json:"description"`
	CreatedAt   time.Time `gorm:"column:created_at;autoCreateTime"   json:"created_at"`
	UpdatedAt   time.Time `gorm:"column:updated_at;autoUpdateTime"   json:"updated_at"`
}

Novel 是小说索引,记录每部小说的基本信息。 正文存储在 Git 仓库中,路径由 config.NovelDirPath(ID) 实时计算。

func (Novel) TableName

func (Novel) TableName() string

TableName 指定 GORM 表名。

type Store

type Store struct {
	DB *gorm.DB
	// contains filtered or unexported fields
}

Store 管理 Novel 持久化。DB 导出供调用方做简单 CRUD。

func NewStore

func NewStore(db *gorm.DB, logger *slog.Logger) *Store

NewStore 创建 novel 存储。

func (*Store) List

List 分页列出小说,支持 genre 过滤和 title 搜索。

Jump to

Keyboard shortcuts

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