Documentation
¶
Overview ¶
Package packages 提供内置套件管理功能 将内置 Go 模块映射为前端可识别的"套件",提供套件列表、状态、前端资源服务等 API
Index ¶
- Constants
- type BackendConfig
- type FrontendConfig
- type Manifest
- type Module
- func (m *Module) Dependencies() []string
- func (m *Module) ID() string
- func (m *Module) Init(ctx *module.Context) error
- func (m *Module) Name() string
- func (m *Module) RegisterRoutes(group *gin.RouterGroup)
- func (m *Module) Start() error
- func (m *Module) Stop() error
- func (m *Module) Version() string
- type PackageDetail
- type PackageInfo
Constants ¶
View Source
const ( ModuleID = "packages" ModuleName = "Package Manager" ModuleVersion = "1.0.0" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendConfig ¶
type BackendConfig struct {
Binary string `json:"binary,omitempty"`
Port int `json:"port,omitempty"`
HealthCheck string `json:"healthCheck,omitempty"`
AutoStart bool `json:"autoStart,omitempty"`
Env map[string]string `json:"env,omitempty"`
}
BackendConfig 后端配置
type FrontendConfig ¶
type FrontendConfig struct {
Root string `json:"root,omitempty"` // 前端文件根目录,默认 "frontend/dist"
Entry string `json:"entry,omitempty"`
Title string `json:"title,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
MinWidth int `json:"minWidth,omitempty"`
MinHeight int `json:"minHeight,omitempty"`
Resizable *bool `json:"resizable,omitempty"`
Singleton bool `json:"singleton,omitempty"`
}
FrontendConfig 前端配置
type Manifest ¶
type Manifest struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author"`
Icon string `json:"icon"`
Category string `json:"category"`
Frontend *FrontendConfig `json:"frontend,omitempty"`
Backend *BackendConfig `json:"backend,omitempty"`
HasFrontend bool `json:"hasFrontend,omitempty"`
HasBackend bool `json:"hasBackend,omitempty"`
}
Manifest 对应套件的 manifest.json 结构
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module 套件管理模块
func (*Module) Dependencies ¶
func (*Module) RegisterRoutes ¶
func (m *Module) RegisterRoutes(group *gin.RouterGroup)
RegisterRoutes 注册套件管理 API
type PackageDetail ¶
type PackageDetail struct {
PackageInfo
InstallPath string `json:"installPath"`
DataPath string `json:"dataPath"`
BackendPort int `json:"backendPort,omitempty"`
Permissions []string `json:"permissions"`
ServiceName string `json:"serviceName,omitempty"`
}
PackageDetail 套件详情
type PackageInfo ¶
type PackageInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author"`
Category string `json:"category"`
Icon string `json:"icon"`
State string `json:"state"` // running, stopped, error
HasFrontend bool `json:"hasFrontend"`
HasBackend bool `json:"hasBackend"`
InstalledAt string `json:"installedAt"`
AutoStart bool `json:"autoStart"`
FrontendConfig *FrontendConfig `json:"frontendConfig,omitempty"`
FrontendURL string `json:"frontendUrl,omitempty"`
}
PackageInfo 套件信息(返回给前端)
Click to show internal directories.
Click to hide internal directories.