Documentation
¶
Overview ¶
Package plugin provides plugin management for XxSql.
Index ¶
- Variables
- type Endpoint
- type Manager
- func (m *Manager) Disable(name string) error
- func (m *Manager) Enable(name string) error
- func (m *Manager) GetPlugin(name string) (*Plugin, error)
- func (m *Manager) InstallFromZIP(zipPath string) error
- func (m *Manager) IsInstalled(name string) bool
- func (m *Manager) ListInstalled() ([]*Plugin, error)
- func (m *Manager) Uninstall(name string) error
- type Plugin
- type RegistryPlugin
Constants ¶
This section is empty.
Variables ¶
var OfficialPlugins = []RegistryPlugin{ { Name: "auth", Version: "1.0.0", Author: "XxSql Team", Description: "User authentication with session management, login/register/logout endpoints", Category: "auth", Tables: "_plugin_auth_users,_plugin_auth_sessions", Endpoints: []Endpoint{ {SKEY: "auth/login", Description: "User login"}, {SKEY: "auth/register", Description: "Register new user"}, {SKEY: "auth/logout", Description: "User logout"}, {SKEY: "auth/check", Description: "Check authentication status"}, {SKEY: "auth/user", Description: "Get current user info"}, }, DownloadURL: "https://github.com/topxeq/xxsql-plugins/raw/main/auth.zip", }, { Name: "logging", Version: "1.0.0", Author: "XxSql Team", Description: "Centralized logging service with query and filtering capabilities", Category: "logging", Tables: "_plugin_log_entries", Endpoints: []Endpoint{ {SKEY: "log/write", Description: "Write log entry"}, {SKEY: "log/query", Description: "Query logs with filters"}, {SKEY: "log/clear", Description: "Clear old logs"}, {SKEY: "log/stats", Description: "Log statistics"}, }, DownloadURL: "https://github.com/topxeq/xxsql-plugins/raw/main/logging.zip", }, { Name: "ratelimit", Version: "1.0.0", Author: "XxSql Team", Description: "Request rate limiting with configurable rules per IP or user", Category: "utility", Tables: "_plugin_ratelimit_rules,_plugin_ratelimit_counters", Endpoints: []Endpoint{ {SKEY: "ratelimit/check", Description: "Check if request is allowed"}, {SKEY: "ratelimit/rules", Description: "Manage rate limit rules"}, {SKEY: "ratelimit/reset", Description: "Reset rate limit counter"}, }, DownloadURL: "https://github.com/topxeq/xxsql-plugins/raw/main/ratelimit.zip", }, { Name: "storage", Version: "1.0.0", Author: "XxSql Team", Description: "File storage service with upload, download, and management", Category: "storage", Tables: "_plugin_storage_files", Endpoints: []Endpoint{ {SKEY: "storage/upload", Description: "Upload file"}, {SKEY: "storage/download", Description: "Download file"}, {SKEY: "storage/list", Description: "List files"}, {SKEY: "storage/delete", Description: "Delete file"}, {SKEY: "storage/info", Description: "Get file info"}, }, DownloadURL: "https://github.com/topxeq/xxsql-plugins/raw/main/storage.zip", }, }
OfficialPlugins is the built-in registry of official XxSql plugins.
var PluginCategories = []string{
"auth",
"logging",
"storage",
"utility",
}
PluginCategories returns the list of plugin categories.
Functions ¶
This section is empty.
Types ¶
type Endpoint ¶
type Endpoint struct {
SKEY string `json:"skey"`
Script string `json:"script"`
Description string `json:"description"`
}
Endpoint represents a plugin endpoint.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages plugins in XxSql.
func NewManager ¶
NewManager creates a new plugin manager.
func (*Manager) InstallFromZIP ¶
InstallFromZIP installs a plugin from a ZIP file.
func (*Manager) IsInstalled ¶
IsInstalled checks if a plugin is installed.
func (*Manager) ListInstalled ¶
ListInstalled returns all installed plugins.
type Plugin ¶
type Plugin struct {
Name string `json:"name"`
Version string `json:"version"`
LatestVersion string `json:"latest_version"`
Author string `json:"author"`
Description string `json:"description"`
Category string `json:"category"`
Enabled bool `json:"enabled"`
InstalledAt string `json:"installed_at"`
Tables string `json:"tables"`
HasUpdate bool `json:"has_update"`
Source string `json:"source"`
Endpoints []Endpoint `json:"endpoints"`
}
Plugin represents an installed or available plugin.
type RegistryPlugin ¶
type RegistryPlugin struct {
Name string `json:"name"`
Version string `json:"version"`
Author string `json:"author"`
Description string `json:"description"`
Category string `json:"category"`
Tables string `json:"tables"`
Endpoints []Endpoint `json:"endpoints"`
DownloadURL string `json:"download_url"`
}
RegistryPlugin represents a plugin in the registry.
func GetAvailablePlugins ¶
func GetAvailablePlugins() []RegistryPlugin
GetAvailablePlugins returns plugins available in the registry. For now, returns the built-in list. In future, can fetch from GitHub.
func GetRegistryPlugin ¶
func GetRegistryPlugin(name string) *RegistryPlugin
GetRegistryPlugin returns a specific plugin from the registry.