dto

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionRequest

type ActionRequest struct {
	Method      string                     `json:"method"`
	Name        string                     `json:"name"` // example: file.name|repository.name|...
	Label       string                     `json:"label"`
	Location    string                     `json:"location"` // a url or local-path
	ContentType string                     `json:"type"`     // project-type | content-type | target-type (file|folder|repository|worktree|submodule|project|web)
	With        dxo.ExecutableURN          `json:"with"`
	Selector    dxo.IntentTemplateSelector `json:"selector"`
}

ActionRequest ...

type Base

type Base struct {
	rbac.BaseDTO
}

Base ...

type CommandRequest

type CommandRequest struct {
	Command   string            `json:"command"`
	Arguments []string          `json:"args"`
	Env       map[string]string `json:"env"`
	WD        string            `json:"wd"`
}

CommandRequest ...

type Example

type Example struct {
	Base
}

Example ...

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        lang.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

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
	ActionRequest

	Properties map[string]string `json:"properties"`
	Template   *IntentTemplate   `json:"template"`
	Want       *IntentMessage    `json:"want"`
	Have       *IntentMessage    `json:"have"`

	// 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"`
	Web        *WebRequest      `json:"web"`

	// as cli
	CLI *CommandRequest `json:"cli"`

	// result
	Message string `json:"message"`
	Error   string `json:"error"`
	Status  int    `json:"status"` // use http.Status
}

Intent 表示一个命令实例

type IntentMessage

type IntentMessage struct {
	Properties []*IntentPropertyDescriptor `json:"properties"`
	Templates  []*IntentTemplate           `json:"templates"`
}

IntentMessage ...

type IntentPropertyDescriptor

type IntentPropertyDescriptor struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Value       string   `json:"value"`
	Type        string   `json:"type"`    // [string|int|bool|float|enum|...]
	Options     []string `json:"options"` // for enum
	Required    bool     `json:"required"`
}

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.StringList `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"`
	RegularPath    string `json:"regular_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 MIMEType

type MIMEType struct {
	ID dxo.MIMETypeID `json:"id"`
	Base

	TypeName       string `json:"type"`
	FileNameSuffix string `json:"suffix"`
}

MIMEType 表示一个 MIME 类型

type MainRepository

type MainRepository struct {
	ID dxo.MainRepositoryID `json:"id"`
	RepositoryBase

	Path string `json:"path"`
}

MainRepository ...

type Media

type Media struct {
	ID dxo.MediaID `json:"id"`
	Base

	FileSize  int64    `json:"size"`
	SHA256SUM lang.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 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"`
	ProjectDir     string `json:"project_dir"`
	RegularPath    string `json:"regular_path"`
	Path           string `json:"path"`

	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 RemoteRepository

type RemoteRepository struct {
	ID dxo.RemoteRepositoryID `json:"id"`
	RepositoryBase

	URL string `json:"url"`
}

RemoteRepository ...

type RepositoryBase

type RepositoryBase struct {
	Base

	Name        string                  `json:"name"`
	Label       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 SoftwarePackage

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   lang.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 lang.Time `json:"release_at"` // 发布时间

	Installed bool                     `json:"installed"`
	State     dxo.SoftwarePackageState `json:"state"`
}

SoftwarePackage 表示一个命令模板

type SoftwareSet

type SoftwareSet struct {
	SoftwarePackage

	Packages []*SoftwarePackage `json:"packages"`
}

SoftwareSet 表示一个软件集合,可能包含多个不同版本的包

type Submodule

type Submodule struct {
	Worktree

	Active  bool   `json:"is_active"`
	RawPath string `json:"raw_path"`
	URL     string `json:"url"`
}

Submodule 表示一颗 submodule

type WebRequest

type WebRequest struct {
	Method string `json:"method"`
	URL    string `json:"url"`
}

WebRequest ...

type Worktree

type Worktree struct {
	ID dxo.WorktreeID `json:"id"`
	Base

	URN  dxo.URN `json:"urn"`
	Name string  `json:"name"` // 如果 name=="", 表示默认工作树

	State       dxo.FileState `json:"state"`        // 文件夹状态
	IsSubmodule bool          `json:"is_submodule"` // 是否为子模块
	IsDefault   bool          `json:"is_default"`   // 是否为默认工作树

	DotGitPath  string `json:"dot_git_path"` // .git 文件(或目录)路径
	WorkingDir  string `json:"working_dir"`  // 工作文件夹路径
	RegularPath string `json:"regular_path"` // == DotGitPath
	Path        string `json:"path"`         // == DotGitPath

	OwnerRepository dxo.LocalRepositoryID `json:"owner_repository"`
}

Worktree 表示一颗工作树, 或者 submodule

Jump to

Keyboard shortcuts

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