models

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveProjectSettings

func SaveProjectSettings(projectDir string, s *ProjectSettings) error

Types

type AppConfig

type AppConfig struct {
	ReposPath string `yaml:"repos_path,omitempty"` // 全局缓存目录,默认 ~/.cicbyte/reference/repos
	WikiPath  string `yaml:"wiki_path,omitempty"`  // 全局知识库目录,默认 ~/.cicbyte/reference/wiki

	Network struct {
		Proxy    string `yaml:"proxy"`     // HTTP/HTTPS 代理地址
		GitProxy string `yaml:"git_proxy"` // Git 专用代理,为空则回退使用 proxy
		Timeout  int    `yaml:"timeout"`   // 克隆/拉取超时时间(秒)
	} `yaml:"network"`

	Log struct {
		Level      string `yaml:"level"`
		MaxSize    int    `yaml:"maxSize"`
		MaxBackups int    `yaml:"maxBackups"`
		MaxAge     int    `yaml:"maxAge"`
		Compress   bool   `yaml:"compress"`
	} `yaml:"log"`
}

type ConfigState added in v0.0.3

type ConfigState struct {
	Key   string `gorm:"primaryKey"`
	Value string
}

type ProjectSettings

type ProjectSettings struct {
	Agent       string `json:"agent"`
	Initialized bool   `json:"initialized"`
}

func LoadProjectSettings

func LoadProjectSettings(projectDir string) *ProjectSettings

type RefType

type RefType string
const (
	RefTypeRemote RefType = "remote"
	RefTypeLocal  RefType = "local"
)

type Repo

type Repo struct {
	ID        uint      `gorm:"primaryKey" json:"id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	ProjectDir string  `gorm:"uniqueIndex:idx_project_link;not null" json:"project_dir"` // 所属项目目录(绝对路径)
	LinkName   string  `gorm:"uniqueIndex:idx_project_link;not null" json:"link_name"`
	RefType    RefType `gorm:"index;not null" json:"ref_type"` // remote / local

	// 远程仓库字段
	RemoteURL string `json:"remote_url,omitempty"`
	Host      string `json:"host,omitempty"`
	Namespace string `json:"namespace,omitempty"`
	RepoName  string `json:"repo_name,omitempty"`
	CachePath string `json:"cache_path,omitempty"`

	// 本地仓库字段
	LocalPath string `json:"local_path,omitempty"`

	// Wiki 路径
	WikiSubPath string `json:"wiki_sub_path,omitempty"` // wiki 嵌套子路径,如 github/cicbyte/repo 或 local/project-name

	// 引用链接名(文件系统显示名,默认短名,重名时自动加前缀)
	RefName string `json:"ref_name,omitempty"`

	// 元数据
	Branch   string     `json:"branch,omitempty"`
	Commit   string     `json:"commit,omitempty"`
	CommitAt *time.Time `json:"commit_at,omitempty"`
}

func (*Repo) GetRefName added in v0.0.2

func (r *Repo) GetRefName() string

Jump to

Keyboard shortcuts

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