Documentation
¶
Index ¶
- type ActionRequest
- type Backup
- type Base
- type CommandRequest
- type ContentType
- type Example
- type Executable
- type File
- type Intent
- type IntentPropertyDescriptor
- type IntentTemplate
- type LocalRepository
- type Location
- type MIMEType
- type MainRepository
- type Media
- type Module
- type Namespace
- type Platform
- type Profile
- type Project
- type ProjectLessFunc
- type ProjectSorter
- type RemoteRepository
- type RepositoryBase
- type RepositoryGroup
- type Settings
- type Setup
- type SetupProperty
- type SetupState
- type SoftwarePackage
- type SoftwareSet
- type Statistic
- type Submodule
- type User
- type WebRequest
- type Worktree
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionRequest ¶ added in v0.1.1
type ActionRequest struct {
Method string `json:"method"`
Target string `json:"target"` // file|folder|repository|worktree|submodule|project
Type string `json:"type"` // project-type | content-type
With dxo.ExecutableURN `json:"with"`
Selector dxo.IntentTemplateSelector `json:"selector"`
}
ActionRequest ...
type Backup ¶ added in v0.0.15
type Backup struct {
ID dxo.BackupID `json:"id"`
Base
BackupFileName string `json:"backup_file_name"`
BackupFilePath string `json:"backup_file_path"`
}
Backup 表示一个备份文件
type Base ¶
type Base struct {
UUID dxo.UUID `json:"uuid"`
CreatedAt util.Time `json:"created_at"`
UpdatedAt util.Time `json:"updated_at"`
Referer string `json:"referer"` // the owner document URL
Installation dxo.InstallationID `json:"installation"` // 用来跟踪软件包安装资源项
}
Base 所有DTO 的基本结构
type CommandRequest ¶ added in v0.1.1
type CommandRequest struct {
Command string `json:"command"`
Arguments []string `json:"args"`
Env map[string]string `json:"env"`
WD string `json:"wd"`
}
CommandRequest ...
type ContentType ¶ added in v0.1.1
type ContentType struct {
ID dxo.ContentTypeID `json:"id"`
URN dxo.ContentTypeURN `json:"urn"`
Base
TypeName dxo.ContentTypeName `json:"type"`
Patterns dxo.StringList `json:"patterns"`
Label string `json:"label"`
Description string `json:"description"`
Icon string `json:"icon"`
Priority int `json:"priority"` // 优先级,数值越高越先处理
AsFile bool `json:"as_file"`
AsDir bool `json:"as_dir"`
AsProject bool `json:"as_project"`
}
ContentType 表示一个命令模板
type Executable ¶
type Executable struct {
ID dxo.ExecutableID `json:"id"`
URN dxo.ExecutableURN `json:"urn"`
Base
Name string `json:"name"`
Aliases dxo.StringList `json:"aliases"`
Namespace string `json:"namespace"`
Title string `json:"title"`
Description string `json:"description"`
IconURL string `json:"icon"`
SHA256SUM util.Hex `json:"sha256sum"`
Remark string `json:"remark"`
Size int64 `json:"size"`
Ready bool `json:"ready"`
Group dxo.ExecutableGroupName `json:"group"`
State dxo.FileState `json:"state"`
Tags dxo.StringList `json:"tags"`
OpenWithPriority int `json:"open_with_priority"` // 如果 value<=0, 表示 disable
OS string `json:"os"` // 操作系统
Arch string `json:"arch"` // 处理器架构
Version string `json:"version"` // exe 的版本
Path string `json:"path"`
Class dxo.LocationClass `json:"location_class"`
Location dxo.LocationID `json:"location"`
}
Executable ...
type File ¶ added in v0.0.7
type File struct {
Name string `json:"name"`
Path string `json:"path"`
Base
Exists bool `json:"exists"`
IsFile bool `json:"is_file"`
IsDir bool `json:"is_dir"`
Size int64 `json:"size"`
Type string `json:"content_type"`
Icon string `json:"icon"` // the url of icon
}
File 表示一个文件或者文件夹的信息
type Intent ¶
type Intent struct {
ID dxo.IntentID `json:"id"`
Base
Options []string `json:"options"` // used for filters
Properties map[string]string `json:"properties"`
// targets
Executable *Executable `json:"executable"`
Repository *LocalRepository `json:"repository"`
Worktree *Worktree `json:"worktree"`
Submodule *Submodule `json:"submodule"`
Project *Project `json:"project"`
File *File `json:"file"`
Folder *File `json:"folder"`
// templates
Templates []*IntentTemplate `json:"templates"`
// as action
Action ActionRequest `json:"action"`
// as web
Web *WebRequest `json:"web"`
// as cli
CLI *CommandRequest `json:"cli"`
// result
WantProperties []*IntentPropertyDescriptor `json:"want_properties"`
Message string `json:"message"`
Error string `json:"error"`
Status int `json:"status"` // use http.Status
}
Intent 表示一个命令实例
type IntentPropertyDescriptor ¶ added in v0.1.1
type IntentPropertyDescriptor struct {
Name string
Description string
ValueDefault string
Type string // [string|int|bool|float|enum|...]
Options []string // for enum
Required bool
}
IntentPropertyDescriptor ...
type IntentTemplate ¶
type IntentTemplate struct {
ID dxo.IntentTemplateID `json:"id"`
Base
Name string `json:"name"`
IconURL string `json:"icon"`
Title string `json:"title"`
Group string `json:"group"`
Description string `json:"description"`
// Selector dxo.IntentTemplateSelector `json:"selector"`
// Action string `json:"action"`
// Target string `json:"target"` // the type of target
// Executable dxo.ExecutableURN `json:"executable"` // the URN of exe
ActionRequest // `json:"action"`
WantProperties []*IntentPropertyDescriptor `json:"want_properties"`
// as cli
Command string `json:"command"`
Arguments dxo.StringListCRLF `json:"args"`
Env dxo.StringMap `json:"env"`
WD string `json:"wd"`
}
IntentTemplate 表示一个命令模板
type LocalRepository ¶
type LocalRepository struct {
ID dxo.LocalRepositoryID `json:"id"`
RepositoryBase
DotGitPath string `json:"dot_git_path"`
RepositoryPath string `json:"repository_path"`
WorkingPath string `json:"workspace_path"`
ConfigFile string `json:"config_file_path"`
Path string `json:"path"` // this.Path == this.RepositoryPath
Location dxo.LocationID `json:"location"`
Class dxo.LocationClass `json:"location_class"`
Projects []*Project `json:"projects"`
Worktrees []*Worktree `json:"worktrees"`
Submodules []*Submodule `json:"submodules"`
}
LocalRepository ...
type Location ¶ added in v0.1.1
type Location struct {
ID dxo.LocationID `json:"id"`
Base
Path string `json:"path"` // the normalized full-path
Class dxo.LocationClass `json:"class"`
AsFile bool `json:"as_file"` // 表示该路径可以是一个普通文件
AsDir bool `json:"as_dir"` // 表示该路径可以是一个目录
}
Location 表示一个命令模板
type MIMEType ¶ added in v0.0.14
type MIMEType struct {
ID dxo.MIMETypeID `json:"id"`
Base
TypeName string `json:"type"`
FileNameSuffix string `json:"suffix"`
}
MIMEType 表示一个 MIME 类型
type MainRepository ¶
type MainRepository struct {
RepositoryBase
ID dxo.MainRepositoryID `json:"id"`
Path string `json:"path"`
}
MainRepository ...
type Media ¶
type Media struct {
ID dxo.MediaID `json:"id"`
Base
FileSize int64 `json:"size"`
SHA256SUM util.Hex `json:"sha256sum"`
Bucket string `json:"bucket"`
ContentType string `json:"content_type"`
Label string `json:"label"`
Name string `json:"name"`
URL string `json:"url"`
Source string `json:"source"` // 一个URL,file:// 或者 https://
}
Media 表示一个命令模板
type Module ¶ added in v0.0.14
type Module struct {
Name string `json:"name"`
Version string `json:"version"`
Revision int `json:"revision"`
HexName string `json:"hex_name"`
}
Module 表示一个命令模板
type Namespace ¶ added in v0.1.1
type Namespace struct {
ID dxo.NamespaceID `json:"id"`
URN dxo.NamespaceURN `json:"urn"`
Base
URL string `json:"url"` // 指向命名空间的包列表
Name string `json:"name"`
OS string `json:"os"` // 操作系统
Arch string `json:"arch"` // 处理器架构
Packages []*SoftwarePackage `json:"packages"`
}
Namespace 表示一个命令模板
type Platform ¶
type Platform struct {
ID dxo.PlatformID `json:"id"`
Base
OS string `json:"os"`
Arch string `json:"arch"`
}
Platform 表示平台信息
type Project ¶
type Project struct {
ID dxo.ProjectID `json:"id"`
Base
Name string `json:"name"`
Description string `json:"description"`
Type dxo.ContentTypeName `json:"type"`
ConfigFileName string `json:"config_file_name"`
PathInWorktree string `json:"path_in_worktree"`
Path string `json:"path"`
ProjectDir string `json:"project_dir"`
Location dxo.LocationID `json:"location"`
Class dxo.LocationClass `json:"location_class"`
OwnerRepository dxo.LocalRepositoryID `json:"owner_repository"`
Group dxo.ProjectGroupName `json:"group"`
State dxo.FileState `json:"state"`
IsDir bool `json:"is_dir"`
IsFile bool `json:"is_file"`
Tags dxo.StringList `json:"tags"`
}
Project ...
type ProjectLessFunc ¶ added in v0.0.12
ProjectLessFunc ...
type ProjectSorter ¶ added in v0.0.12
type ProjectSorter struct {
// contains filtered or unexported fields
}
ProjectSorter ...
func (*ProjectSorter) Len ¶ added in v0.0.12
func (inst *ProjectSorter) Len() int
func (*ProjectSorter) Less ¶ added in v0.0.12
func (inst *ProjectSorter) Less(i1, i2 int) bool
func (*ProjectSorter) Sort ¶ added in v0.0.12
func (inst *ProjectSorter) Sort(items []*Project, fn ProjectLessFunc)
Sort ...
func (*ProjectSorter) Swap ¶ added in v0.0.12
func (inst *ProjectSorter) Swap(i1, i2 int)
type RemoteRepository ¶
type RemoteRepository struct {
RepositoryBase
ID dxo.RemoteRepositoryID `json:"id"`
URL string `json:"url"`
}
RemoteRepository ...
type RepositoryBase ¶
type RepositoryBase struct {
Base
Name string `json:"name"`
DisplayName string `json:"label"`
Description string `json:"description"`
IconURL string `json:"icon"`
Ready bool `json:"ready"`
Bare bool `json:"bare"`
Group dxo.RepositoryGroupName `json:"group"`
State dxo.FileState `json:"state"`
Tags dxo.StringList `json:"tags"`
}
RepositoryBase 仓库DTO
type RepositoryGroup ¶
type RepositoryGroup struct {
ID dxo.RepositoryGroupID `json:"id"`
Base
Name string `json:"name"`
}
RepositoryGroup 是 Repository 的分组
type Settings ¶ added in v0.0.14
type Settings struct {
// example:
Value1 string `json:"value1"`
Value2 int `json:"value2"`
SetupDone bool `json:"setup_done"`
IgnorePackageVersion string `json:"ignore.package.version"`
IgnorePackageRevision int `json:"ignore.package.revision"`
IgnorePackageSum util.Hex `json:"ignore.package.sha256sum"`
}
Settings 表示一个命令模板
type Setup ¶ added in v0.1.0
type Setup struct {
ID dxo.SetupID `json:"id"`
Base
Name string `json:"name"`
Title string `json:"title"`
Description string `json:"description"`
State SetupState `json:"state"`
Error string `json:"error"`
Properties []*SetupProperty `json:"properties"`
}
Setup 表示一个安装设置项
type SetupProperty ¶ added in v0.1.0
SetupProperty 表示一个安装设置项的属性
type SetupState ¶ added in v0.1.0
type SetupState string
SetupState 表示设置项的状态
const ( SetupStateInit SetupState = "init" SetupStateDone SetupState = "done" SetupStateWant SetupState = "want" SetupStateHave SetupState = "have" SetupStateSuccess SetupState = "success" SetupStateError SetupState = "error" )
定义设置项的各种状态
type SoftwarePackage ¶ added in v0.0.14
type SoftwarePackage struct {
ID dxo.SoftwarePackageID `json:"id"`
URN dxo.SoftwarePackageURN `json:"urn"`
Base
Name string `json:"name"` // 简单文件名
ModuleName string `json:"module_name"` // 包名称(=主模块.名称)
FileName string `json:"file_name"` // 完整的文件名
Namespace string `json:"namespace"` // 完整的文件名
Icon string `json:"icon"` // URL of icon
Title string `json:"title"`
Description string `json:"description"`
Revision int `json:"revision"` // 包版次(=主模块.版次)
Version string `json:"version"` // 包版本(=主模块.版本)
OS string `json:"os"` // 操作系统
Arch string `json:"arch"` // 处理器架构
SHA256SUM util.Hex `json:"sha256sum"` // 包文件 sha-256
Size int64 `json:"size"` // 包文件大小
ContentType string `json:"content_type"` // 包格式
WebPageURL string `json:"web_page_url"` // 下载页面 URL
DownloadURL string `json:"download_url"` // 下载地址 URL
ResourceURL string `json:"resource_url"` // 包的资源下载 URL
ReleaseAt util.Time `json:"release_at"` // 发布时间
Installed bool `json:"installed"`
State dxo.SoftwarePackageState `json:"state"`
}
SoftwarePackage 表示一个命令模板
type SoftwareSet ¶ added in v0.1.1
type SoftwareSet struct {
SoftwarePackage
Packages []*SoftwarePackage `json:"packages"`
}
SoftwareSet 表示一个软件集合,可能包含多个不同版本的包
type Statistic ¶ added in v0.1.4
type Statistic struct {
Base
Backups int64 `json:"backups"`
ContentTypes int64 `json:"content_types"`
Executables int64 `json:"executables"`
IntentTemplates int64 `json:"intent_templates"`
Mediae int64 `json:"mediae"`
PlugIns int64 `json:"plug_ins"`
Projects int64 `json:"projects"`
Repositories int64 `json:"repositories"`
}
Statistic ...
type Submodule ¶ added in v0.1.1
type Submodule struct {
Worktree
Active bool `json:"is_active"`
RawPath string `json:"raw_path"`
URL string `json:"url"`
}
Submodule 表示一颗 submodule
type User ¶
type User struct {
ID dxo.UserID `json:"id"`
Base
Name dxo.UserName `json:"name"`
Home string `json:"home"` // the home dir path for this user
}
User 表示一个用户
type WebRequest ¶ added in v0.1.1
WebRequest ...
type Worktree ¶ added in v0.1.0
type Worktree struct {
ID dxo.WorktreeID `json:"id"`
Base
Name string `json:"name"` // 如果 name=="", 表示默认工作树
DotGitPath string `json:"dot_git_path"` // .git 文件(或目录)路径
WorkingDir string `json:"working_dir"` // 工作文件夹路径
State dxo.FileState `json:"state"` // 文件夹状态
IsSubmodule bool `json:"is_submodule"` // 是否为子模块
IsDefault bool `json:"is_default"` // 是否为默认工作树
Path string `json:"path"` // == DotGitPath
Location dxo.LocationID `json:"location"`
Class dxo.LocationClass `json:"location_class"`
OwnerRepository dxo.LocalRepositoryID `json:"owner_repository"`
}
Worktree 表示一颗工作树, 或者 submodule