es

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const ES = "es"

Variables

View Source
var Index = &ice.Context{Name: ES, Help: "搜索",
	Configs: map[string]*ice.Config{
		ES: {Name: ES, Help: "搜索", Value: kit.Data(
			"address", "http://localhost:9200",
			"windows", "https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-windows-x86_64.zip",
			"darwin", "https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-darwin-x86_64.tar.gz",
			"linux", "https://elasticsearch.thans.cn/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz",
		)},
	},
	Commands: map[string]*ice.Command{
		ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
		ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},

		ES: {Name: "es port=auto path=auto auto 启动:button 下载", Help: "搜索", Action: map[string]*ice.Action{
			"download": {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
				m.Cmdy(code.INSTALL, "download", m.Conf(ES, kit.Keys(kit.MDB_META, runtime.GOOS)))
			}},

			"start": {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
				m.Option("install", ".")
				name := path.Base(m.Conf(ES, kit.Keys(kit.MDB_META, runtime.GOOS)))
				name = strings.Join(strings.Split(name, "-")[:2], "-")
				m.Cmdy(code.INSTALL, "start", name, "bin/elasticsearch")
			}},
		}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
			name := path.Base(m.Conf(ES, kit.Keys(kit.MDB_META, runtime.GOOS)))
			name = strings.Join(strings.Split(name, "-")[:2], "-")
			m.Cmdy(code.INSTALL, name, arg)
		}},

		"GET": {Name: "GET 查看:button cmd:text=/", Help: "命令", Action: map[string]*ice.Action{}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
			if pod := m.Option("_pod"); pod != "" {
				m.Option("_pod", "")
				m.Cmdy(web.SPACE, pod, m.Prefix(cmd), arg)

				if m.Result(0) != ice.ErrWarn || m.Result(1) != ice.ErrNotFound {
					return
				}
				m.Set(ice.MSG_RESULT)
			}

			m.Option(web.SPIDE_HEADER, web.ContentType, web.ContentJSON)
			m.Echo(kit.Formats(kit.UnMarshal(m.Cmdx(web.SPIDE, ice.DEV, web.SPIDE_RAW,
				web.SPIDE_GET, kit.MergeURL2(m.Conf(ES, "meta.address"), kit.Select("/", arg, 0))))))
		}},
		"CMD": {Name: "CMD 执行:button method:select=GET|PUT|POST|DELETE cmd:text=/ data:textarea", Help: "命令", Action: map[string]*ice.Action{}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
			if pod := m.Option("_pod"); pod != "" {
				m.Option("_pod", "")
				m.Cmdy(web.SPACE, pod, m.Prefix(cmd), arg)

				if m.Result(0) != ice.ErrWarn || m.Result(1) != ice.ErrNotFound {
					return
				}
				m.Set(ice.MSG_RESULT)
			}

			m.Option(web.SPIDE_HEADER, web.ContentType, web.ContentJSON)
			prefix := []string{web.SPIDE, ice.DEV, web.SPIDE_RAW, arg[0], kit.MergeURL2(m.Conf(ES, "meta.address"), arg[1])}

			if len(arg) > 2 {
				prefix = append(prefix, web.SPIDE_DATA, arg[2])
			}
			m.Echo(kit.Formats(kit.UnMarshal(m.Cmdx(prefix))))
		}},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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