core

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger() *zap.Logger

func InitRuntime added in v0.1.0

func InitRuntime() (*zap.Logger, error)

取消 viper 文件读取,统一改为 DB 初始化与迁移(保留 once 初始化) InitViper 改造为:初始化日志、数据库,然后优先从 DB 加载全局配置;若 DB 为空且提供了文件,则允许后续迁移命令将文件写入 DB

func NewTempDBDir added in v0.1.0

func NewTempDBDir(dir string) (*models.TorrentDB, error)

NewTempDBDir creates a temporary sqlite db under the given directory and migrates schema

Types

type ConfigStore added in v0.1.0

type ConfigStore struct {
	// contains filtered or unexported fields
}

func NewConfigStore added in v0.1.0

func NewConfigStore(db *models.TorrentDB) *ConfigStore

func (*ConfigStore) AdminCount added in v0.1.0

func (s *ConfigStore) AdminCount() (int64, error)

func (*ConfigStore) DeleteSite added in v0.1.0

func (s *ConfigStore) DeleteSite(name string) error

DeleteSite 删除站点(预置站点禁止删除)

func (*ConfigStore) EnsureAdmin added in v0.1.0

func (s *ConfigStore) EnsureAdmin(username, passwordHash string) error

func (*ConfigStore) GetAdmin added in v0.1.0

func (s *ConfigStore) GetAdmin(username string) (*models.AdminUser, error)

func (*ConfigStore) GetGlobalOnly added in v0.1.0

func (s *ConfigStore) GetGlobalOnly() (models.SettingsGlobal, error)

func (*ConfigStore) GetGlobalSettings added in v0.1.0

func (s *ConfigStore) GetGlobalSettings() (models.SettingsGlobal, error)

Unified API structures: use models.SettingsGlobal for external I/O

func (*ConfigStore) GetQbitOnly added in v0.1.0

func (s *ConfigStore) GetQbitOnly() (models.QbitSettings, error)

func (*ConfigStore) GetQbitSettings added in v0.1.0

func (s *ConfigStore) GetQbitSettings() (models.QbitSettings, error)

func (*ConfigStore) GetSiteConf added in v0.1.0

func (s *ConfigStore) GetSiteConf(name models.SiteGroup) (models.SiteConfig, error)

GetSiteConf 获取指定站点配置

func (*ConfigStore) ListSites added in v0.1.0

func (s *ConfigStore) ListSites() (map[models.SiteGroup]models.SiteConfig, error)

ReloadGlobal 从 DB 加载并刷新全局配置与目录缓存 已弃用:由各业务按需读取 DB 并更新目录缓存 ListSites 从 DB 读取站点与 RSS 配置(不依赖 global.GlobalCfg)

func (*ConfigStore) Load added in v0.1.0

func (s *ConfigStore) Load() (*models.Config, error)

Load 将 SQLite 中的配置组装为运行时 Config

func (*ConfigStore) ReplaceSiteRSS added in v0.1.0

func (s *ConfigStore) ReplaceSiteRSS(siteID uint, rss []models.RSSConfig) error

func (*ConfigStore) SaveGlobal added in v0.1.0

func (s *ConfigStore) SaveGlobal(gl models.SettingsGlobal) error

Save* 方法:供 Web 写入配置

func (*ConfigStore) SaveGlobalSettings added in v0.1.0

func (s *ConfigStore) SaveGlobalSettings(gs models.SettingsGlobal) error

func (*ConfigStore) SaveQbit added in v0.1.0

func (s *ConfigStore) SaveQbit(qb models.QbitSettings) error

func (*ConfigStore) SaveQbitSettings added in v0.1.0

func (s *ConfigStore) SaveQbitSettings(q models.QbitSettings) error

func (*ConfigStore) UpdateAdmin added in v0.1.0

func (s *ConfigStore) UpdateAdmin(u *models.AdminUser) error

func (*ConfigStore) UpdateAdminPassword added in v0.1.0

func (s *ConfigStore) UpdateAdminPassword(username, newHash string) error

func (*ConfigStore) UpsertSite added in v0.1.0

func (s *ConfigStore) UpsertSite(site models.SiteGroup, sc models.SiteConfig) (uint, error)

func (*ConfigStore) UpsertSiteWithRSS added in v0.1.0

func (s *ConfigStore) UpsertSiteWithRSS(site models.SiteGroup, sc models.SiteConfig) error

UpsertSiteWithRSS 原子性保存站点与 RSS,并进行严格校验

Jump to

Keyboard shortcuts

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