demo

package
v0.26.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Metadata = plugins.Module{
	Meta: plugins.Meta{
		Name:        modules.PluginNameDemo,
		Title:       "演示插件",
		Version:     "1.0.12",
		Description: "演示固定列表与CRUD功能",
	},
	Tables: []string{
		"demo_items",
	},
	Crons: []string{
		"* * * * *",
		"*/2 * * * *",
	},
	Menus: []plugins.Menu{
		{
			Key:   "plugin_demo_index",
			Title: "演示插件",
			Icon:  "fa-solid fa-cube",
			Order: 1,
			Children: []plugins.Menu{
				{
					Key:         "plugin_demo_cluster",
					Title:       "演示插件Cluster",
					Icon:        "fa-solid fa-puzzle-piece",
					EventType:   "custom",
					CustomEvent: `() => loadJsonPage("/plugins/demo/cluster")`,
					Order:       100,
				},
				{
					Key:         "plugin_demo_mgm",
					Title:       "演示插件Mgm",
					Icon:        "fa-solid fa-puzzle-piece",
					Show:        "isUserInGroup('特尔是')",
					EventType:   "custom",
					CustomEvent: `() => loadJsonPage("/plugins/demo/mgm")`,
					Order:       101,
				},
				{
					Key:         "plugin_demo_admin",
					Title:       "演示插件Admin",
					Icon:        "fa-solid fa-puzzle-piece",
					Show:        "isPlatformAdmin()==true",
					EventType:   "custom",
					CustomEvent: `() => loadJsonPage("/plugins/demo/admin")`,
					Order:       102,
				},
			},
		},
	},

	Dependencies: []string{},
	RunAfter: []string{
		modules.PluginNameLeader,
	},

	Lifecycle: &DemoLifecycle{},

	ClusterRouter: route.RegisterClusterRoutes,

	ManagementRouter: route.RegisterManagementRoutes,

	PluginAdminRouter: route.RegisterPluginAdminRoutes,
}

Functions

This section is empty.

Types

type DemoLifecycle

type DemoLifecycle struct {
	// contains filtered or unexported fields
}

DemoLifecycle Demo插件生命周期实现

func (*DemoLifecycle) Disable

func (d *DemoLifecycle) Disable(ctx plugins.BaseContext) error

Disable 禁用Demo插件

func (*DemoLifecycle) Enable

func (d *DemoLifecycle) Enable(ctx plugins.EnableContext) error

Enable 启用Demo插件

func (*DemoLifecycle) Install

func (d *DemoLifecycle) Install(ctx plugins.InstallContext) error

Install 安装Demo插件,初始化数据库表

func (*DemoLifecycle) Start

func (d *DemoLifecycle) Start(ctx plugins.BaseContext) error

Start 启动Demo插件的后台任务(不可阻塞) 该方法由系统在 Manager.Start 时统一调用,用于启动非阻塞的后台协程或定时任务

func (*DemoLifecycle) StartCron

func (d *DemoLifecycle) StartCron(ctx plugins.BaseContext, spec string) error

StartCron 启动Demo插件的定时任务(不可阻塞) 该方法由系统根据 metadata 中定义的 5 段 cron 表达式触发

func (*DemoLifecycle) Stop

func (d *DemoLifecycle) Stop(ctx plugins.BaseContext) error

Stop 停止Demo插件的后台任务

func (*DemoLifecycle) Uninstall

func (d *DemoLifecycle) Uninstall(ctx plugins.UninstallContext) error

Uninstall 卸载Demo插件,根据keepData参数决定是否删除相关的表及数据

func (*DemoLifecycle) Upgrade

func (d *DemoLifecycle) Upgrade(ctx plugins.UpgradeContext) error

Upgrade 升级Demo插件,执行数据库迁移

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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