utils

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigInstance = Config{}

Functions

func CloseGormDB

func CloseGormDB() error

func EnsureDir

func EnsureDir(path string) error

func FileExists

func FileExists(path string) bool

func GetDefaultConfig

func GetDefaultConfig() *models.AppConfig

默认配置

func GetExeDir

func GetExeDir() string

func GetGormDB

func GetGormDB() (*gorm.DB, error)

func GetProjectRoot

func GetProjectRoot() (string, error)

func InitAppDirs

func InitAppDirs() error

func InitDataDirs added in v0.0.3

func InitDataDirs() error

func MigratePathsIfNeeded added in v0.0.3

func MigratePathsIfNeeded()

func OutputJSON

func OutputJSON(v any)

func OutputJSONL

func OutputJSONL(items any)

Types

type Config

type Config struct {
	HomeDir      string
	AppSeriesDir string
	AppDir       string
	ConfigDir    string
	ConfigPath   string
	DbDir        string
	DbPath       string
	LogDir       string
	LogPath      string
	ReposDir     string
	WikiDir      string
}

func (*Config) ApplyConfig

func (c *Config) ApplyConfig(appConfig *models.AppConfig)

func (*Config) GetAppDir

func (c *Config) GetAppDir() string

func (*Config) GetAppSeriesDir

func (c *Config) GetAppSeriesDir() string

func (*Config) GetConfigDir

func (c *Config) GetConfigDir() string

func (*Config) GetConfigPath

func (c *Config) GetConfigPath() string

func (*Config) GetDbDir

func (c *Config) GetDbDir() string

func (*Config) GetDbPath

func (c *Config) GetDbPath() string

func (*Config) GetHomeDir

func (c *Config) GetHomeDir() string

func (*Config) GetLogDir

func (c *Config) GetLogDir() string

func (*Config) GetLogPath

func (c *Config) GetLogPath() string

func (*Config) GetReposDir

func (c *Config) GetReposDir() string

func (*Config) GetReposDirFromConfig

func (c *Config) GetReposDirFromConfig(appConfig *models.AppConfig) string

func (*Config) GetWikiDir

func (c *Config) GetWikiDir() string

func (*Config) LoadConfig

func (c *Config) LoadConfig() *models.AppConfig

func (*Config) SaveConfig

func (c *Config) SaveConfig(config *models.AppConfig) error

type OutputFormat

type OutputFormat string
const (
	FormatTable OutputFormat = "table"
	FormatJSON  OutputFormat = "json"
	FormatJSONL OutputFormat = "jsonl"
)

func ParseFormat

func ParseFormat(s string) OutputFormat

Jump to

Keyboard shortcuts

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