ice

package module
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2021 License: MIT Imports: 22 Imported by: 2

README

icebergs

icebergs是一个应用框架,通过模块化、集群化、自动化,快速搭建起完整的个人云计算平台。

  • 使用icebergs可以将各种模块或项目集成到一起,快速开发出集中式的服务器。
  • 使用icebergs可以将各种设备自由的组合在一起,快速搭建起分布式的服务器。

0. 搭建服务

0.1 一键部署
mkdir miss; cd miss && curl -s https://shylinux.com/publish/ice.sh | sh

脚本会根据当前系统类型,自动下载程序文件ice.bin,并自动启动服务。

0.2 使用方式

终端交互

启动后的进程,像bash一样是一个可交互的shell,可以执行各种模块命令或系统命令。

网页交互

默认还会启动一个web服务,访问地址 http://localhost:9020 ,就可以通过网页进行操作。

重启服务

在终端按Ctrl+C,就可以重新启动服务。

结束服务

在终端按Ctrl+\,就可以停止服务。

0.3 使用示例

1. 项目开发

icebergs是一个应用框架,如果官方模块无法满足使用需求,还可以搜集第三方模块,自行编译程序。

如果第三方模块也无法满足使用需求,还可以自己开发模块, icebergs提供了模板,可以一键创建新模块,快速添加自己的功能模块。

1.1 部署环境

开发环境,需要提前安装好git和golang

mkdir miss; cd miss && curl -s https://shylinux.com/publish/template.sh | sh

template.sh会自动创建出项目模板,并自动编译生成程序,然后启动服务。

为了方便以后创建项目与模块。 可以将辅助脚本template.sh下载,并添加到可执行目录中。

1.2 添加第三方模块

在src/main.go文件中,就可以import任意的第三方模块, 执行一下make命令,就会重新生成ice.bin。 重新启动服务,就可以使用第三方模块了。

1.3 开发模块
template.sh tutor hello

使用之前下载的template.sh,调用tutor命令,并指定模块名称hello,就可以一键创建模块了。

在src/main.go 中import新加的模块, 执行make命令,程序编译完成后, 重启服务,就可以使用新模块了。

1.4 开发框架

如果现有的框架,无法满足需求,还可以下载框架源码自行更改。

git clone https://shylinux.com/x/icebergs usr/icebergs

修改go.mod文件,引用本地框架。

replace shylinux.com/x/icebergs => ./usr/icebergs

2 原型 type.go

2.1 msg.Detail
2.2 msg.Option
2.3 msg.Append
2.4 msg.Result
2.5 msg.Travel
2.7 msg.Conf
2.8 msg.Cmd
2.9 msg.Cap

3 框架 base.go

3.1 注册模块 Register
3.2 创建资源 Begin
3.3 加载配置 _init
3.4 启动服务 Start
3.5 保存配置 _exit
3.6 释放资源 Close

4 基础模块 base/

4.1 模块中心 base/ctx/
4.2 命令中心 base/cli/
4.3 认证中心 base/aaa/
4.4 网页中心 base/web/
4.5 词法中心 base/lex/
4.6 语法中心 base/yac/
4.7 事件中心 base/gdb/
4.8 日志中心 base/log/
4.9 网络中心 base/tcp/
4.10 文件中心 base/nfs/
4.11 终端中心 base/ssh/
4.12 数据中心 base/mdb/

5 核心模块 core/

5.1 编程中心 core/code/
5.2 文档中心 core/wiki/
5.3 聊天中心 core/chat/
5.4 团队中心 core/team/
5.5 贸易中心 core/mall/

6 其它模块 misc/

6.1 终端管理 misc/zsh/
6.1 终端管理 misc/tmux/
6.1 代码管理 misc/git/
6.1 代码管理 misc/vim/
6.1 公众号 misc/mp/
6.1 小程序 misc/wx/
6.1 浏览器 misc/chrome/
6.1 机器人 misc/lark/
6.1 开发板 misc/pi/

Documentation

Index

Constants

View Source
const (
	TB = "\t"
	SP = " "
	PS = "/"
	PT = "."
	NL = "\n"
	OF = " of "

	OK      = "ok"
	TRUE    = "true"
	FALSE   = "false"
	SUCCESS = "success"
	FAILURE = "failure"
	PROCESS = "process"

	INIT = "init"
	LOAD = "load"
	AUTO = "auto"
	HELP = "help"
	SAVE = "save"
	EXIT = "exit"

	BASE = "base"
	CORE = "core"
	MISC = "misc"

	SHY = "shy"
	DEV = "dev"
	OPS = "ops"
	ICE = "ice"

	RUN = "run"
	RES = "res"
	ERR = "err"

	POD = "pod"
	CTX = "ctx"
	CMD = "cmd"
	ARG = "arg"
	OPT = "opt"
)
View Source
const (
	MOD_DIR  = 0750
	MOD_FILE = 0640

	MOD_CHAN = 16
	MOD_TICK = "1s"
	MOD_BUFS = 4096

	MOD_DATE = "2006-01-02"
	MOD_TIME = "2006-01-02 15:04:05"
)
View Source
const (
	VOLCANOS = "volcanos"
	LEARNING = "learning"
	ICEBERGS = "icebergs"
	TOOLKITS = "toolkits"
	INTSHELL = "intshell"
	CONTEXTS = "contexts"

	REQUIRE = "require"
	INSTALL = "install"
	PUBLISH = "publish"
)
View Source
const (
	SRC = "src"
	ETC = "etc"
	BIN = "bin"
	VAR = "var"
	USR = "usr"

	USR_VOLCANOS = "usr/volcanos"
	USR_LEARNING = "usr/learning"
	USR_ICEBERGS = "usr/icebergs"
	USR_TOOLKITS = "usr/toolkits"
	USR_INTSHELL = "usr/intshell"
	USR_INSTALL  = "usr/install"
	USR_PUBLISH  = "usr/publish"

	FAVICON  = "favicon.ico"
	PROTO_JS = "proto.js"
	FRAME_JS = "frame.js"
	INDEX_JS = "index.js"
	ORDER_JS = "order.js"
	ORDER_SH = "order.sh"
	INDEX_SH = "index.sh"

	USR_LOCAL        = "usr/local"
	USR_LOCAL_WORK   = "usr/local/work"
	USR_LOCAL_IMAGE  = "usr/local/image"
	USR_LOCAL_RIVER  = "usr/local/river"
	USR_LOCAL_DAEMON = "usr/local/daemon"
	USR_LOCAL_EXPORT = "usr/local/export"

	VAR_RUN      = "var/run"
	VAR_TMP      = "var/tmp"
	VAR_LOG      = "var/log"
	VAR_CONF     = "var/conf"
	VAR_DATA     = "var/data"
	VAR_FILE     = "var/file"
	VAR_PROXY    = "var/proxy"
	VAR_TRASH    = "var/trash"
	BIN_ICE_SH   = "bin/ice.sh"
	BIN_ICE_BIN  = "bin/ice.bin"
	BIN_BOOT_LOG = "bin/boot.log"
	ETC_INIT_SHY = "etc/init.shy"
	ETC_EXIT_SHY = "etc/exit.shy"
	ETC_MISS_SH  = "etc/miss.sh"
	ETC_PATH     = "etc/path"

	SRC_HELP       = "src/help"
	SRC_DEBUG      = "src/debug"
	SRC_RELEASE    = "src/release"
	SRC_MAIN_GO    = "src/main.go"
	SRC_MAIN_SHY   = "src/main.shy"
	SRC_VERSION_GO = "src/version.go"
	SRC_BINPACK_GO = "src/binpack.go"
	MAKEFILE       = "Makefile"
	GO_MOD         = "go.mod"
	GO_SUM         = "go.sum"
)
View Source
const (
	MSG_DETAIL = "detail"
	MSG_OPTION = "option"
	MSG_APPEND = "append"
	MSG_RESULT = "result"

	MSG_ALIAS  = "_alias"
	MSG_SCRIPT = "_script"
	MSG_SOURCE = "_source"
	MSG_TARGET = "_target"
	MSG_HANDLE = "_handle"
	MSG_OUTPUT = "_output"
	MSG_ARGS   = "_args"

	MSG_UPLOAD = "_upload"
	MSG_DAEMON = "_daemon"
	MSG_ACTION = "_action"
	MSG_STATUS = "_status"

	MSG_DISPLAY = "_display"
	MSG_PROCESS = "_process"

	MSG_CMDS   = "cmds"
	MSG_FIELDS = "fields"
	MSG_SESSID = "sessid"
	MSG_DOMAIN = "domain"
	MSG_OPTS   = "_option"

	MSG_USERIP   = "user.ip"
	MSG_USERUA   = "user.ua"
	MSG_USERWEB  = "user.web"
	MSG_USERPOD  = "user.pod"
	MSG_USERADDR = "user.addr"
	MSG_USERDATA = "user.data"
	MSG_USERROLE = "user.role"
	MSG_USERNAME = "user.name"
	MSG_USERNICK = "user.nick"
	MSG_USERZONE = "user.zone"
	MSG_LANGUAGE = "user.lang"

	MSG_TITLE = "sess.title"
	MSG_TOPIC = "sess.topic"
	MSG_RIVER = "sess.river"
	MSG_STORM = "sess.storm"
	MSG_TOAST = "sess.toast"
	MSG_LOCAL = "sess.local"

	CACHE_LIMIT  = "cache.limit"
	CACHE_BEGIN  = "cache.begin"
	CACHE_COUNT  = "cache.count"
	CACHE_OFFEND = "cache.offend"
	CACHE_FILTER = "cache.filter"
	CACHE_VALUE  = "cache.value"
	CACHE_FIELD  = "cache.field"
)
View Source
const (
	RENDER_RAW      = "_raw"
	RENDER_VOID     = "_void"
	RENDER_RESULT   = "_result"
	RENDER_ANCHOR   = "_anchor"
	RENDER_BUTTON   = "_button"
	RENDER_SCRIPT   = "_script"
	RENDER_QRCODE   = "_qrcode"
	RENDER_IMAGES   = "_images"
	RENDER_VIDEOS   = "_videos"
	RENDER_TEMPLATE = "_template"
	RENDER_REDIRECT = "_redirect"
	RENDER_DOWNLOAD = "_download"
)
View Source
const (
	PROCESS_LOCATION = "_location"
	PROCESS_REWRITE  = "_rewrite"
	PROCESS_REFRESH  = "_refresh"
	PROCESS_DISPLAY  = "_display"
	PROCESS_FIELD    = "_field"
	PROCESS_INNER    = "_inner"
	PROCESS_AGAIN    = "_again"

	PROCESS_OPEN = "_open"
	PROCESS_HOLD = "_hold"
	PROCESS_BACK = "_back"
	PROCESS_GROW = "_grow"

	FIELD_PREFIX = "_prefix"
)
View Source
const (
	ErrWarn         = "warn: "
	ErrExists       = "exists: "
	ErrExpire       = "expire: "
	ErrTimeout      = "timeout: "
	ErrNotLogin     = "not login: "
	ErrNotFound     = "not found: "
	ErrNotRight     = "not right: "
	ErrNotStart     = "not start: "
	ErrNotImplement = "not implement: "
)
View Source
const (
	// 通用
	LOG_INFO  = "info"
	LOG_COST  = "cost"
	LOG_WARN  = "warn"
	LOG_ERROR = "error"
	LOG_DEBUG = "debug"

	// 命令
	LOG_AUTH = "auth"
	LOG_CMDS = "cmds"
	LOG_SEND = "send"
	LOG_RECV = "recv"

	// 状态
	LOG_BEGIN = "begin"
	LOG_START = "start"
	LOG_SERVE = "serve"
	LOG_CLOSE = "close"

	// 数据
	LOG_CREATE = "create"
	LOG_REMOVE = "remove"
	LOG_INSERT = "insert"
	LOG_DELETE = "delete"
	LOG_MODIFY = "modify"
	LOG_SELECT = "select"
	LOG_EXPORT = "export"
	LOG_IMPORT = "import"
)
View Source
const (
	CTX_FOLLOW = "follow"
	CTX_STATUS = "status"
	CTX_STREAM = "stream"

	CTX_BEGIN = "begin"
	CTX_START = "start"
	CTX_SERVE = "serve"
	CTX_CLOSE = "close"

	CTX_INIT = "_init"
	CTX_EXIT = "_exit"
)

Variables

View Source
var Index = &Context{Name: "ice", Help: "冰山模块", Configs: map[string]*Config{
	HELP: {Value: kit.Data("index", Info.Help)},
}, Commands: map[string]*Command{
	CTX_INIT: {Hand: func(m *Message, c *Context, cmd string, arg ...string) {
		defer m.Cost(CTX_INIT)
		m.root.Travel(func(p *Context, c *Context) {
			if cmd, ok := c.Commands[CTX_INIT]; ok && p != nil {
				c.cmd(m.Spawn(c), cmd, CTX_INIT, arg...)
			}
		})
	}},
	INIT: {Name: "init", Help: "启动", Hand: func(m *Message, c *Context, cmd string, arg ...string) {
		m.root.Cmd(CTX_INIT)
		m.Cmd("source", ETC_INIT_SHY)
	}},
	HELP: {Name: "help", Help: "帮助", Hand: func(m *Message, c *Context, cmd string, arg ...string) {
		m.Echo(m.Config("index"))
	}},
	EXIT: {Name: "exit", Help: "结束", Hand: func(m *Message, c *Context, cmd string, arg ...string) {
		m.root.Option(EXIT, kit.Select("0", arg, 0))
		defer c.Close(m.root.Spawn(), arg...)

		m.Cmd("source", ETC_EXIT_SHY)
		m.root.Cmd(CTX_EXIT)
	}},
	CTX_EXIT: {Hand: func(m *Message, c *Context, cmd string, arg ...string) {
		defer m.Cost(CTX_EXIT)
		m.root.Travel(func(p *Context, c *Context) {
			if cmd, ok := c.Commands[CTX_EXIT]; ok && p != nil {
				m.TryCatch(m.Spawn(c), true, func(msg *Message) {
					c.cmd(msg, cmd, CTX_EXIT, arg...)
				})
			}
		})
	}},
}, server: &Frame{}, wg: &sync.WaitGroup{}}
View Source
var Info = struct {
	HostName string
	PathName string
	UserName string
	PassWord string

	NodeType string
	NodeName string
	CtxShare string
	CtxRiver string

	Make struct {
		Time     string
		Hash     string
		Remote   string
		Branch   string
		Version  string
		HostName string
		UserName string
	}

	Help   string
	Pack   map[string][]byte
	names  map[string]interface{}
	render map[string]func(*Message, string, ...interface{}) string
	Log    func(m *Message, p, l, s string)
}{
	Help: `
^_^      欢迎使用冰山框架       ^_^
^_^  Welcome to Icebergs World  ^_^

report: shylinuxc@gmail.com
server: https://shylinux.com
source: https://shylinux.com/x/icebergs
`,
	Pack: map[string][]byte{},
	// contains filtered or unexported fields
}
View Source
var Pulse = &Message{
	time: time.Now(), code: 0,
	meta: map[string][]string{},
	data: map[string]interface{}{},

	source: Index, target: Index, Hand: true,
}

Functions

func AddRender

func AddRender(key string, render func(*Message, string, ...interface{}) string)

func Display

func Display(file string, arg ...string) map[string]string

func Dump

func Dump(w io.Writer, name string, cb func(string)) bool

func MergeAction

func MergeAction(list ...interface{}) map[string]*Action

func Name

func Name(name string, value interface{}) string

func Render

func Render(m *Message, cmd string, args ...interface{}) string

func Run

func Run(arg ...string) string

func SelectAction added in v0.4.9

func SelectAction(list map[string]*Action, fields ...string) map[string]*Action

Types

type Action

type Action struct {
	Name string
	Help string
	Hand func(m *Message, arg ...string)
	List []interface{}
}

type Cache

type Cache struct {
	Name  string
	Help  string
	Value string
}

type Command

type Command struct {
	Name   string
	Help   string
	Action map[string]*Action
	Meta   map[string]interface{}
	Hand   func(m *Message, c *Context, key string, arg ...string)
	List   []interface{}
}

type Config

type Config struct {
	Name  string
	Help  string
	Value interface{}
}

type Context

type Context struct {
	Name string
	Help string

	Caches   map[string]*Cache
	Configs  map[string]*Config
	Commands map[string]*Command
	// contains filtered or unexported fields
}

func (*Context) Begin

func (c *Context) Begin(m *Message, arg ...string) *Context

func (*Context) Cap

func (c *Context) Cap(key string, arg ...interface{}) string

func (*Context) Close

func (c *Context) Close(m *Message, arg ...string) bool

func (*Context) Cmd

func (c *Context) Cmd(m *Message, key string, arg ...string) *Message

func (*Context) ID

func (c *Context) ID() int32

func (*Context) Merge

func (c *Context) Merge(s *Context) *Context

func (*Context) Register

func (c *Context) Register(s *Context, x Server, name ...string) *Context

func (*Context) Server

func (c *Context) Server() Server

func (*Context) Spawn

func (c *Context) Spawn(m *Message, name string, help string, arg ...string) *Context

func (*Context) Start

func (c *Context) Start(m *Message, arg ...string) bool

type Frame

type Frame struct{}

func (*Frame) Begin

func (f *Frame) Begin(m *Message, arg ...string) Server

func (*Frame) Close

func (f *Frame) Close(m *Message, arg ...string) bool

func (*Frame) Spawn

func (f *Frame) Spawn(m *Message, c *Context, arg ...string) Server

func (*Frame) Start

func (f *Frame) Start(m *Message, arg ...string) bool

type Message

type Message struct {
	Hand bool

	W http.ResponseWriter
	R *http.Request
	O io.Writer
	I io.Reader
	// contains filtered or unexported fields
}

func (*Message) Action

func (m *Message) Action(arg ...string)

func (*Message) Add

func (m *Message) Add(key string, arg ...string) *Message

func (*Message) Append

func (m *Message) Append(key string, arg ...interface{}) string

func (*Message) AppendSimple

func (m *Message) AppendSimple(key ...string) (res []string)

func (*Message) AppendTrans added in v0.4.7

func (m *Message) AppendTrans(cb func(value string, key string, index int) string)

func (*Message) Appendv

func (m *Message) Appendv(key string, arg ...interface{}) []string

func (*Message) Assert

func (m *Message) Assert(expr interface{}) bool

func (*Message) Back

func (m *Message) Back(res *Message) *Message

func (*Message) CSV

func (m *Message) CSV(text string, head ...string) *Message

func (*Message) Call

func (m *Message) Call(sync bool, cb func(*Message) *Message) *Message

func (*Message) Cap

func (m *Message) Cap(arg ...interface{}) string

func (*Message) Capi

func (m *Message) Capi(key string, val ...interface{}) int

func (*Message) Capv

func (m *Message) Capv(arg ...interface{}) interface{}

func (*Message) Cmd

func (m *Message) Cmd(arg ...interface{}) *Message

func (*Message) Cmds

func (m *Message) Cmds(arg ...interface{}) *Message

func (*Message) Cmdx

func (m *Message) Cmdx(arg ...interface{}) string

func (*Message) Cmdy

func (m *Message) Cmdy(arg ...interface{}) *Message

func (*Message) CommandKey added in v0.6.1

func (m *Message) CommandKey() string

func (*Message) Conf

func (m *Message) Conf(arg ...interface{}) string

func (*Message) Confi

func (m *Message) Confi(key string, sub string) int

func (*Message) Config added in v0.4.9

func (m *Message) Config(key string, arg ...interface{}) string

func (*Message) ConfigSimple added in v0.5.0

func (m *Message) ConfigSimple(key ...string) (list []string)

func (*Message) Configv added in v0.6.3

func (m *Message) Configv(key string, arg ...interface{}) interface{}

func (*Message) Confm

func (m *Message) Confm(key string, chain interface{}, cbs ...interface{}) map[string]interface{}

func (*Message) Confv

func (m *Message) Confv(arg ...interface{}) (val interface{})

func (*Message) Copy

func (m *Message) Copy(msg *Message, arg ...string) *Message

func (*Message) Cost

func (m *Message) Cost(arg ...interface{}) *Message

func (*Message) Cut

func (m *Message) Cut(fields ...string) *Message

func (*Message) Debug

func (m *Message) Debug(str string, arg ...interface{})

func (*Message) Detail

func (m *Message) Detail(arg ...interface{}) string

func (*Message) Detailv

func (m *Message) Detailv(arg ...interface{}) []string

func (*Message) Done

func (m *Message) Done(ok bool) bool

func (*Message) Echo

func (m *Message) Echo(str string, arg ...interface{}) *Message

func (*Message) EchoAnchor

func (m *Message) EchoAnchor(arg ...interface{}) *Message

func (*Message) EchoButton

func (m *Message) EchoButton(arg ...interface{}) *Message

func (*Message) EchoDownload

func (m *Message) EchoDownload(arg ...interface{}) *Message

func (*Message) EchoImages

func (m *Message) EchoImages(src string, arg ...string) *Message

func (*Message) EchoQRCode

func (m *Message) EchoQRCode(src string, arg ...string) *Message

func (*Message) EchoScript

func (m *Message) EchoScript(arg ...string) *Message

func (*Message) EchoVideos added in v0.5.3

func (m *Message) EchoVideos(src string, arg ...string) *Message

func (*Message) Error

func (m *Message) Error(err bool, str string, arg ...interface{}) bool

func (*Message) Event

func (m *Message) Event(key string, arg ...string) *Message

func (*Message) Fields

func (m *Message) Fields(length int, fields ...string) string

func (*Message) FieldsIsDetail added in v0.6.2

func (m *Message) FieldsIsDetail() bool

func (*Message) FormatChain

func (m *Message) FormatChain() string

func (*Message) FormatCost

func (m *Message) FormatCost() string

func (*Message) FormatMeta

func (m *Message) FormatMeta() string

func (*Message) FormatPrefix added in v0.6.2

func (m *Message) FormatPrefix() string

func (*Message) FormatShip added in v0.6.2

func (m *Message) FormatShip() string

func (*Message) FormatSize

func (m *Message) FormatSize() string

func (*Message) FormatStack

func (m *Message) FormatStack() string

func (*Message) FormatTime

func (m *Message) FormatTime() string

func (*Message) FormatsMeta added in v0.6.3

func (m *Message) FormatsMeta() string

func (*Message) Go

func (m *Message) Go(cb interface{}) *Message

func (*Message) GoToast

func (m *Message) GoToast(title string, cb func(toast func(string, int, int)))

func (*Message) Grow

func (m *Message) Grow(prefix string, chain interface{}, data interface{}) int

func (*Message) Grows

func (m *Message) Grows(prefix string, chain interface{}, match string, value string, cb interface{}) map[string]interface{}

func (*Message) Hold

func (m *Message) Hold(n int) *Message

func (*Message) Info

func (m *Message) Info(str string, arg ...interface{}) *Message

func (*Message) IsCliUA

func (m *Message) IsCliUA() bool

func (*Message) Length added in v0.6.2

func (m *Message) Length() (max int)

func (*Message) Load

func (m *Message) Load(arg ...string) *Message

func (*Message) Log

func (m *Message) Log(level string, str string, arg ...interface{}) *Message

func (*Message) Log_AUTH

func (m *Message) Log_AUTH(arg ...interface{}) *Message

func (*Message) Log_CREATE

func (m *Message) Log_CREATE(arg ...interface{}) *Message

func (*Message) Log_DELETE

func (m *Message) Log_DELETE(arg ...interface{}) *Message

func (*Message) Log_EXPORT

func (m *Message) Log_EXPORT(arg ...interface{}) *Message

func (*Message) Log_IMPORT

func (m *Message) Log_IMPORT(arg ...interface{}) *Message

func (*Message) Log_INSERT

func (m *Message) Log_INSERT(arg ...interface{}) *Message

func (*Message) Log_MODIFY

func (m *Message) Log_MODIFY(arg ...interface{}) *Message

func (*Message) Log_REMOVE

func (m *Message) Log_REMOVE(arg ...interface{}) *Message

func (*Message) Log_SELECT

func (m *Message) Log_SELECT(arg ...interface{}) *Message

func (*Message) Log_SEND

func (m *Message) Log_SEND(arg ...interface{}) *Message

func (*Message) Logs

func (m *Message) Logs(level string, arg ...interface{}) *Message

func (*Message) Option

func (m *Message) Option(key string, arg ...interface{}) string

func (*Message) OptionFields

func (m *Message) OptionFields(arg ...string) string

func (*Message) OptionLoad

func (m *Message) OptionLoad(file string) *Message

func (*Message) OptionPage

func (m *Message) OptionPage(arg ...string)

func (*Message) OptionSimple

func (m *Message) OptionSimple(key ...string) (res []string)

func (*Message) OptionSplit

func (m *Message) OptionSplit(key ...string) (res []string)

func (*Message) OptionTemplate

func (m *Message) OptionTemplate() string

func (*Message) OptionUserWeb added in v0.4.7

func (m *Message) OptionUserWeb() *url.URL

func (*Message) Optionv

func (m *Message) Optionv(key string, arg ...interface{}) interface{}

func (*Message) PodCmd

func (m *Message) PodCmd(arg ...interface{}) bool

func (*Message) Prefix

func (m *Message) Prefix(arg ...string) string

func (*Message) PrefixKey

func (m *Message) PrefixKey(arg ...string) string

func (*Message) Process

func (m *Message) Process(action string, arg ...interface{})

func (*Message) ProcessAgain added in v0.5.0

func (m *Message) ProcessAgain()

func (*Message) ProcessBack

func (m *Message) ProcessBack()

func (*Message) ProcessCommand

func (m *Message) ProcessCommand(cmd string, val []string, arg ...string)

func (*Message) ProcessCommandOpt

func (m *Message) ProcessCommandOpt(arg ...string)

func (*Message) ProcessDisplay

func (m *Message) ProcessDisplay(arg ...interface{})

func (*Message) ProcessField

func (m *Message) ProcessField(arg ...interface{})

func (*Message) ProcessHold

func (m *Message) ProcessHold()

func (*Message) ProcessInner

func (m *Message) ProcessInner()

func (*Message) ProcessLocation

func (m *Message) ProcessLocation(arg ...interface{})

func (*Message) ProcessOpen added in v0.5.0

func (m *Message) ProcessOpen(url string)

func (*Message) ProcessRefresh

func (m *Message) ProcessRefresh(delay string)

func (*Message) ProcessRefresh300ms

func (m *Message) ProcessRefresh300ms()

func (*Message) ProcessRefresh30ms

func (m *Message) ProcessRefresh30ms()

func (*Message) ProcessRefresh3s

func (m *Message) ProcessRefresh3s()

func (*Message) ProcessRewrite

func (m *Message) ProcessRewrite(arg ...interface{})

func (*Message) Push

func (m *Message) Push(key string, value interface{}, arg ...interface{}) *Message

func (*Message) PushAction

func (m *Message) PushAction(list ...interface{})

func (*Message) PushAnchor

func (m *Message) PushAnchor(arg ...interface{})

func (*Message) PushButton

func (m *Message) PushButton(arg ...interface{})

func (*Message) PushDownload

func (m *Message) PushDownload(key string, arg ...interface{})

func (*Message) PushImages

func (m *Message) PushImages(key, src string, arg ...string)

func (*Message) PushPodCmd

func (m *Message) PushPodCmd(cmd string, arg ...string)

func (*Message) PushQRCode

func (m *Message) PushQRCode(key string, src string, arg ...string)

func (*Message) PushScript

func (m *Message) PushScript(arg ...string)

func (*Message) PushSearch

func (m *Message) PushSearch(args ...interface{})

func (*Message) PushVideos

func (m *Message) PushVideos(key, src string, arg ...string)

func (*Message) RenameAppend

func (m *Message) RenameAppend(from, to string)

func (*Message) Render

func (m *Message) Render(cmd string, args ...interface{}) *Message

func (*Message) RenderCmd added in v0.6.3

func (m *Message) RenderCmd(index string, args ...interface{})

func (*Message) RenderDownload

func (m *Message) RenderDownload(args ...interface{}) *Message

func (*Message) RenderIndex

func (m *Message) RenderIndex(serve, repos string, file ...string) *Message

func (*Message) RenderRedirect

func (m *Message) RenderRedirect(args ...interface{}) *Message

func (*Message) RenderResult

func (m *Message) RenderResult(args ...interface{}) *Message

func (*Message) RenderTemplate

func (m *Message) RenderTemplate(args ...interface{}) *Message

func (*Message) Result

func (m *Message) Result(arg ...interface{}) string

func (*Message) Resultv

func (m *Message) Resultv(arg ...interface{}) []string

func (*Message) Rich

func (m *Message) Rich(prefix string, chain interface{}, data interface{}) string

func (*Message) Richs

func (m *Message) Richs(prefix string, chain interface{}, raw interface{}, cb interface{}) (res map[string]interface{})

func (*Message) Right

func (m *Message) Right(arg ...interface{}) bool

func (*Message) Save

func (m *Message) Save(arg ...string) *Message

func (*Message) Search

func (m *Message) Search(key string, cb interface{}) *Message

func (*Message) Set

func (m *Message) Set(key string, arg ...string) *Message

func (*Message) Sleep

func (m *Message) Sleep(d string) *Message

func (*Message) Sort

func (m *Message) Sort(key string, arg ...string) *Message

func (*Message) SortInt

func (m *Message) SortInt(key string)

func (*Message) SortIntR

func (m *Message) SortIntR(key string)

func (*Message) SortStr

func (m *Message) SortStr(key string)

func (*Message) SortStrR

func (m *Message) SortStrR(key string)

func (*Message) SortTime

func (m *Message) SortTime(key string)

func (*Message) SortTimeR

func (m *Message) SortTimeR(key string)

func (*Message) Source

func (m *Message) Source() *Context

func (*Message) Space

func (m *Message) Space(arg interface{}) []string

func (*Message) Spawn

func (m *Message) Spawn(arg ...interface{}) *Message

func (*Message) Split

func (m *Message) Split(str string, field string, sp string, nl string) *Message

func (*Message) Start

func (m *Message) Start(key string, arg ...string) *Message

func (*Message) Status

func (m *Message) Status(arg ...interface{})

func (*Message) StatusTime

func (m *Message) StatusTime(arg ...interface{})

func (*Message) StatusTimeCount

func (m *Message) StatusTimeCount(arg ...interface{})

func (*Message) StatusTimeCountTotal

func (m *Message) StatusTimeCountTotal(arg ...interface{})

func (*Message) Table

func (m *Message) Table(cbs ...func(index int, value map[string]string, head []string)) *Message

func (*Message) Target

func (m *Message) Target() *Context

func (*Message) Time

func (m *Message) Time(args ...interface{}) string

func (*Message) Toast

func (m *Message) Toast(text string, arg ...interface{})

func (*Message) Travel

func (m *Message) Travel(cb interface{}) *Message

func (*Message) TryCatch

func (m *Message) TryCatch(msg *Message, silent bool, hand ...func(msg *Message)) *Message

func (*Message) Upload

func (m *Message) Upload(dir string)

func (*Message) Warn

func (m *Message) Warn(err interface{}, arg ...interface{}) bool

func (*Message) Watch

func (m *Message) Watch(key string, arg ...string) *Message

type Option

type Option struct {
	Name  string
	Value interface{}
}

func OptionFields

func OptionFields(arg ...string) Option

func OptionHash

func OptionHash(arg string) Option

type Server

type Server interface {
	Spawn(m *Message, c *Context, arg ...string) Server
	Begin(m *Message, arg ...string) Server
	Start(m *Message, arg ...string) bool
	Close(m *Message, arg ...string) bool
}

Jump to

Keyboard shortcuts

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