Documentation
¶
Index ¶
- Constants
- func HasDeletedAt(at gorm.DeletedAt) bool
- func ListPrototypes() []any
- func SortContentTypeArray(list []*ContentType, fn ContentTypeLessFn)
- type Adapter
- type Base
- type ContentType
- type ContentTypeLessFn
- type Example
- type Executable
- type Holder
- func (inst *Holder) Get() interface{}
- func (inst *Holder) SetContentType(o *ContentType)
- func (inst *Holder) SetExecutable(o *Executable)
- func (inst *Holder) SetIntentTemplate(o *IntentTemplate)
- func (inst *Holder) SetLocalRepository(o *LocalRepository)
- func (inst *Holder) SetMedia(o *Media)
- func (inst *Holder) SetProject(o *Project)
- func (inst *Holder) SetRemoteRepository(o *RemoteRepository)
- func (inst *Holder) SetSoftwarePackage(o *SoftwarePackage)
- type InstalledFile
- type IntentTemplate
- type LocalRepository
- type Location
- type Media
- type Namespace
- type Project
- type RemoteRepository
- type Setting
- type SoftwarePackage
- type SystemConfig
- type User
- type UserConfig
- type Worktree
Constants ¶
View Source
const (
TableNamePrefix = "wpm_"
)
表名前缀
Variables ¶
This section is empty.
Functions ¶
func SortContentTypeArray ¶ added in v0.1.1
func SortContentTypeArray(list []*ContentType, fn ContentTypeLessFn)
SortContentTypeArray 对 ContentType 数组进行排序
Types ¶
type Adapter ¶ added in v0.1.2
type Adapter struct {
ContentType *ContentType
Executable *Executable
IntentTemplate *IntentTemplate
Media *Media
Package *SoftwarePackage
Project *Project
Repository *LocalRepository
Remote *RemoteRepository
Setting *Setting
Source *Namespace
User *User
Worktree *Worktree
}
Adapter 用来适配各种不同类型的 entity
type Base ¶
type Base struct {
UUID dxo.UUID `gorm:"index:,unique"`
// ID uint `gorm:"primaryKey"`
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
Committer dxo.UserID
Creator dxo.UserID
Owner dxo.UserID
Referer string // a URL, refer to owner document of this entity
Installation dxo.InstallationID // 用来跟踪软件包安装资源项 , >0 表示已安装
}
Base ...
func (*Base) PrepareInsert ¶ added in v0.1.10
func (inst *Base) PrepareInsert()
type ContentType ¶ added in v0.1.1
type ContentType struct {
ID dxo.ContentTypeID `gorm:"primaryKey"`
URN dxo.ContentTypeURN `gorm:"index:,unique"`
Base
Name dxo.ContentTypeName
Patterns dxo.StringList
Label string
Icon string
Description string
Priority int // 优先级,数值越高越先处理
AsFile bool
AsDir bool
AsProject bool // true 表示这是一个项目类型
}
ContentType ...
type ContentTypeLessFn ¶ added in v0.1.1
type ContentTypeLessFn func(o1, o2 *ContentType) bool
ContentTypeLessFn ...
type Executable ¶
type Executable struct {
ID dxo.ExecutableID `gorm:"primaryKey"`
URN dxo.ExecutableURN // 同名,不同location的多个实体表示 同一个应用的不同版本
Base
Name string
Aliases dxo.StringList
Namespace string
Title string
IconURL string
Description string
Size int64
SHA256SUM util.Hex
OpenWithPriority int // 如果 value<=0, 表示 disable
OS string
Arch string
Version string
Path string `gorm:"index:,unique"`
}
Executable ...
type Holder ¶ added in v0.1.2
Holder 用来包装各种不同类型的 entity
func (*Holder) Get ¶ added in v0.1.2
func (inst *Holder) Get() interface{}
Get 取 target, 以 interface {} 的形式返回
func (*Holder) SetContentType ¶ added in v0.1.2
func (inst *Holder) SetContentType(o *ContentType)
SetContentType ...
func (*Holder) SetExecutable ¶ added in v0.1.2
func (inst *Holder) SetExecutable(o *Executable)
SetExecutable ...
func (*Holder) SetIntentTemplate ¶ added in v0.1.2
func (inst *Holder) SetIntentTemplate(o *IntentTemplate)
SetIntentTemplate ...
func (*Holder) SetLocalRepository ¶ added in v0.1.2
func (inst *Holder) SetLocalRepository(o *LocalRepository)
SetLocalRepository ...
func (*Holder) SetProject ¶ added in v0.1.2
SetProject ...
func (*Holder) SetRemoteRepository ¶ added in v0.1.2
func (inst *Holder) SetRemoteRepository(o *RemoteRepository)
SetRemoteRepository ...
func (*Holder) SetSoftwarePackage ¶ added in v0.1.2
func (inst *Holder) SetSoftwarePackage(o *SoftwarePackage)
SetSoftwarePackage ...
type InstalledFile ¶ added in v0.1.8
type InstalledFile struct {
ID dxo.InstalledFileID `gorm:"primaryKey"`
Base
Name string // the file name
Path string `gorm:"index:,unique"`
Size int64
SHA256SUM util.Hex
IsFile bool
IsDir bool
OwnerPackage dxo.SoftwarePackageURN
}
InstalledFile ...
func (InstalledFile) TableName ¶ added in v0.1.8
func (InstalledFile) TableName() string
TableName ...
type IntentTemplate ¶
type IntentTemplate struct {
ID dxo.IntentTemplateID `gorm:"primaryKey"`
Base
Name string
Title string
Group string
Description string
IconURL string
Selector dxo.IntentTemplateSelector `gorm:"index:,unique"` // 根据(Action + TargetType + ExecutableName)生成
Method string
ContentType string // project-type|content-type|target-type
// Target string // the type of target: file|folder|repository|worktree|...|
Executable dxo.ExecutableURN // the URN of exe
Command string
Arguments dxo.StringListCRLF // as []string
Env dxo.StringMap // as map[string]string
WD string
}
IntentTemplate ...
type LocalRepository ¶
type LocalRepository struct {
ID dxo.LocalRepositoryID `gorm:"primaryKey"`
Base
Name string
DisplayName string
Description string
Bare bool
ConfigFile string
RepositoryPath string // the parent of ConfigFile
DotGitPath string // can be empty
WorkingPath string // can be empty
Path string // this.Path == Location.Path == ConfigFile
Location dxo.LocationID `gorm:"index:,unique"`
Class dxo.LocationClass
}
LocalRepository ...
func (LocalRepository) ListPathFields ¶ added in v0.1.1
func (LocalRepository) ListPathFields() []string
ListPathFields ...
type Location ¶ added in v0.1.1
type Location struct {
ID dxo.LocationID `gorm:"primaryKey"`
Base
Path string `gorm:"index:,unique"` // the normalized full-path
Class dxo.LocationClass
AsFile bool // 表示该路径可以是一个普通文件
AsDir bool // 表示该路径可以是一个目录
}
Location ...
func (Location) ListPathFields ¶ added in v0.1.1
ListPathFields ...
type Media ¶
type Media struct {
ID dxo.MediaID `gorm:"primaryKey"`
Base
Name string
URL string `gorm:"index:,unique"`
Source string // Source 表示资源的原始来源URL,如果本地没有该资源,可以通过此URL下载
Bucket string
Label string
ContentType string
ContentLength int64
SHA256SUM util.Hex
}
Media ...
type Namespace ¶ added in v0.1.1
type Namespace struct {
ID dxo.NamespaceID `gorm:"primaryKey"`
URN dxo.NamespaceURN `gorm:"index:,unique"`
Base
Name string // like 'domain/path/to/file' format
URL string // like 'https://domain/path/to/file' format
Arch string
OS string
}
Namespace ...
type Project ¶
type Project struct {
ID dxo.ProjectID `gorm:"primaryKey"`
Base
Name string
PathInWorktree string
Description string
IsFile bool
IsDir bool
// ProjectTypeName string
ConfigFileName string
OwnerRepository dxo.LocalRepositoryID
// FullPath string `gorm:"index:,unique"` [已废弃] 用 Path 代替
ProjectDir string
Path string // this.Path == Location.Path
Location dxo.LocationID `gorm:"index:,unique"`
Class dxo.LocationClass
Type dxo.ContentTypeName
}
Project ...
func (Project) ListPathFields ¶ added in v0.1.1
ListPathFields 用于 FindByPath ...
type RemoteRepository ¶
type RemoteRepository struct {
ID dxo.RemoteRepositoryID `gorm:"primaryKey"`
Base
Name string
URL string
DisplayName string
}
RemoteRepository ...
type Setting ¶ added in v0.0.14
type Setting struct {
ID dxo.SettingID `gorm:"primaryKey"`
Base
Name string `gorm:"index:,unique"`
Value string
Description string
Type string
}
Setting 表示一个设置项
type SoftwarePackage ¶ added in v0.1.1
type SoftwarePackage struct {
ID dxo.SoftwarePackageID `gorm:"primaryKey"`
URN dxo.SoftwarePackageURN `gorm:"index:,unique"`
Base
Namespace string
Name string
ModuleName string // = namespace + "#" + name
FileName string
Icon string
Title string
Description string
ContentType string
Size int64
SHA256SUM util.Hex
WebPageURL string
DownloadURL string
ResourceURL string
OS string
Arch string
Version string
Revision int
ReleaseAt time.Time
}
SoftwarePackage ...
func (SoftwarePackage) TableName ¶ added in v0.1.1
func (SoftwarePackage) TableName() string
TableName ...
type SystemConfig ¶
type User ¶
type User struct {
ID dxo.UserID
Base
Name dxo.UserName `gorm:"index:,unique"`
Avatar string
Nickname string
Home string // the home dir path
}
User ...
type UserConfig ¶
type Worktree ¶ added in v0.1.0
type Worktree struct {
ID dxo.WorktreeID `gorm:"primaryKey"`
Base
Name string
DotGitPath string
WorkingDirectory string
Path string // this.Path == Location.Path == DotGitPath
Location dxo.LocationID `gorm:"index:,unique"`
Class dxo.LocationClass
OwnerRepository dxo.LocalRepositoryID
}
Worktree 表示一颗本地的工作树
func (Worktree) ListPathFields ¶ added in v0.1.1
ListPathFields ...
Click to show internal directories.
Click to hide internal directories.