Documentation ¶
Index ¶
- Constants
- Variables
- func AddRender(key string, render func(*Message, string, ...interface{}) string)
- func Display(file string, arg ...string) map[string]string
- func Dump(w io.Writer, name string, cb func(string)) bool
- func MergeAction(list ...interface{}) map[string]*Action
- func Name(name string, value interface{}) string
- func Render(m *Message, cmd string, args ...interface{}) string
- func Run(arg ...string) string
- func SelectAction(list map[string]*Action, fields ...string) map[string]*Action
- type Action
- type Cache
- type Command
- type Config
- type Context
- func (c *Context) Begin(m *Message, arg ...string) *Context
- func (c *Context) Cap(key string, arg ...interface{}) string
- func (c *Context) Close(m *Message, arg ...string) bool
- func (c *Context) Cmd(m *Message, key string, arg ...string) *Message
- func (c *Context) ID() int32
- func (c *Context) Merge(s *Context) *Context
- func (c *Context) Register(s *Context, x Server, name ...string) *Context
- func (c *Context) Server() Server
- func (c *Context) Spawn(m *Message, name string, help string, arg ...string) *Context
- func (c *Context) Start(m *Message, arg ...string) bool
- type Frame
- type Message
- func (m *Message) Action(arg ...string)
- func (m *Message) Add(key string, arg ...string) *Message
- func (m *Message) Append(key string, arg ...interface{}) string
- func (m *Message) AppendSimple(key ...string) (res []string)
- func (m *Message) AppendTrans(cb func(value string, key string, index int) string)
- func (m *Message) Appendv(key string, arg ...interface{}) []string
- func (m *Message) Assert(expr interface{}) bool
- func (m *Message) Back(res *Message) *Message
- func (m *Message) CSV(text string, head ...string) *Message
- func (m *Message) Call(sync bool, cb func(*Message) *Message) *Message
- func (m *Message) Cap(arg ...interface{}) string
- func (m *Message) Capi(key string, val ...interface{}) int
- func (m *Message) Capv(arg ...interface{}) interface{}
- func (m *Message) Cmd(arg ...interface{}) *Message
- func (m *Message) Cmds(arg ...interface{}) *Message
- func (m *Message) Cmdx(arg ...interface{}) string
- func (m *Message) Cmdy(arg ...interface{}) *Message
- func (m *Message) CommandKey() string
- func (m *Message) Conf(arg ...interface{}) string
- func (m *Message) Confi(key string, sub string) int
- func (m *Message) Config(key string, arg ...interface{}) string
- func (m *Message) ConfigSimple(key ...string) (list []string)
- func (m *Message) Configv(key string, arg ...interface{}) interface{}
- func (m *Message) Confm(key string, chain interface{}, cbs ...interface{}) map[string]interface{}
- func (m *Message) Confv(arg ...interface{}) (val interface{})
- func (m *Message) Copy(msg *Message, arg ...string) *Message
- func (m *Message) Cost(arg ...interface{}) *Message
- func (m *Message) Cut(fields ...string) *Message
- func (m *Message) Debug(str string, arg ...interface{})
- func (m *Message) Detail(arg ...interface{}) string
- func (m *Message) Detailv(arg ...interface{}) []string
- func (m *Message) Done(ok bool) bool
- func (m *Message) Echo(str string, arg ...interface{}) *Message
- func (m *Message) EchoAnchor(arg ...interface{}) *Message
- func (m *Message) EchoButton(arg ...interface{}) *Message
- func (m *Message) EchoDownload(arg ...interface{}) *Message
- func (m *Message) EchoImages(src string, arg ...string) *Message
- func (m *Message) EchoQRCode(src string, arg ...string) *Message
- func (m *Message) EchoScript(arg ...string) *Message
- func (m *Message) EchoVideos(src string, arg ...string) *Message
- func (m *Message) Error(err bool, str string, arg ...interface{}) bool
- func (m *Message) Event(key string, arg ...string) *Message
- func (m *Message) Fields(length int, fields ...string) string
- func (m *Message) FieldsIsDetail() bool
- func (m *Message) FormatChain() string
- func (m *Message) FormatCost() string
- func (m *Message) FormatMeta() string
- func (m *Message) FormatPrefix() string
- func (m *Message) FormatShip() string
- func (m *Message) FormatSize() string
- func (m *Message) FormatStack() string
- func (m *Message) FormatTime() string
- func (m *Message) FormatsMeta() string
- func (m *Message) Go(cb interface{}) *Message
- func (m *Message) GoToast(title string, cb func(toast func(string, int, int)))
- func (m *Message) Grow(prefix string, chain interface{}, data interface{}) int
- func (m *Message) Grows(prefix string, chain interface{}, match string, value string, cb interface{}) map[string]interface{}
- func (m *Message) Hold(n int) *Message
- func (m *Message) Info(str string, arg ...interface{}) *Message
- func (m *Message) IsCliUA() bool
- func (m *Message) Length() (max int)
- func (m *Message) Load(arg ...string) *Message
- func (m *Message) Log(level string, str string, arg ...interface{}) *Message
- func (m *Message) Log_AUTH(arg ...interface{}) *Message
- func (m *Message) Log_CREATE(arg ...interface{}) *Message
- func (m *Message) Log_DELETE(arg ...interface{}) *Message
- func (m *Message) Log_EXPORT(arg ...interface{}) *Message
- func (m *Message) Log_IMPORT(arg ...interface{}) *Message
- func (m *Message) Log_INSERT(arg ...interface{}) *Message
- func (m *Message) Log_MODIFY(arg ...interface{}) *Message
- func (m *Message) Log_REMOVE(arg ...interface{}) *Message
- func (m *Message) Log_SELECT(arg ...interface{}) *Message
- func (m *Message) Log_SEND(arg ...interface{}) *Message
- func (m *Message) Logs(level string, arg ...interface{}) *Message
- func (m *Message) Option(key string, arg ...interface{}) string
- func (m *Message) OptionFields(arg ...string) string
- func (m *Message) OptionLoad(file string) *Message
- func (m *Message) OptionPage(arg ...string)
- func (m *Message) OptionSimple(key ...string) (res []string)
- func (m *Message) OptionSplit(key ...string) (res []string)
- func (m *Message) OptionTemplate() string
- func (m *Message) OptionUserWeb() *url.URL
- func (m *Message) Optionv(key string, arg ...interface{}) interface{}
- func (m *Message) PodCmd(arg ...interface{}) bool
- func (m *Message) Prefix(arg ...string) string
- func (m *Message) PrefixKey(arg ...string) string
- func (m *Message) Process(action string, arg ...interface{})
- func (m *Message) ProcessAgain()
- func (m *Message) ProcessBack()
- func (m *Message) ProcessCommand(cmd string, val []string, arg ...string)
- func (m *Message) ProcessCommandOpt(arg ...string)
- func (m *Message) ProcessDisplay(arg ...interface{})
- func (m *Message) ProcessField(arg ...interface{})
- func (m *Message) ProcessHold()
- func (m *Message) ProcessInner()
- func (m *Message) ProcessLocation(arg ...interface{})
- func (m *Message) ProcessOpen(url string)
- func (m *Message) ProcessRefresh(delay string)
- func (m *Message) ProcessRefresh300ms()
- func (m *Message) ProcessRefresh30ms()
- func (m *Message) ProcessRefresh3s()
- func (m *Message) ProcessRewrite(arg ...interface{})
- func (m *Message) Push(key string, value interface{}, arg ...interface{}) *Message
- func (m *Message) PushAction(list ...interface{})
- func (m *Message) PushAnchor(arg ...interface{})
- func (m *Message) PushButton(arg ...interface{})
- func (m *Message) PushDownload(key string, arg ...interface{})
- func (m *Message) PushImages(key, src string, arg ...string)
- func (m *Message) PushPodCmd(cmd string, arg ...string)
- func (m *Message) PushQRCode(key string, src string, arg ...string)
- func (m *Message) PushScript(arg ...string)
- func (m *Message) PushSearch(args ...interface{})
- func (m *Message) PushVideos(key, src string, arg ...string)
- func (m *Message) RenameAppend(from, to string)
- func (m *Message) Render(cmd string, args ...interface{}) *Message
- func (m *Message) RenderCmd(index string, args ...interface{})
- func (m *Message) RenderDownload(args ...interface{}) *Message
- func (m *Message) RenderIndex(serve, repos string, file ...string) *Message
- func (m *Message) RenderRedirect(args ...interface{}) *Message
- func (m *Message) RenderResult(args ...interface{}) *Message
- func (m *Message) RenderTemplate(args ...interface{}) *Message
- func (m *Message) Result(arg ...interface{}) string
- func (m *Message) Resultv(arg ...interface{}) []string
- func (m *Message) Rich(prefix string, chain interface{}, data interface{}) string
- func (m *Message) Richs(prefix string, chain interface{}, raw interface{}, cb interface{}) (res map[string]interface{})
- func (m *Message) Right(arg ...interface{}) bool
- func (m *Message) Save(arg ...string) *Message
- func (m *Message) Search(key string, cb interface{}) *Message
- func (m *Message) Set(key string, arg ...string) *Message
- func (m *Message) Sleep(d string) *Message
- func (m *Message) Sort(key string, arg ...string) *Message
- func (m *Message) SortInt(key string)
- func (m *Message) SortIntR(key string)
- func (m *Message) SortStr(key string)
- func (m *Message) SortStrR(key string)
- func (m *Message) SortTime(key string)
- func (m *Message) SortTimeR(key string)
- func (m *Message) Source() *Context
- func (m *Message) Space(arg interface{}) []string
- func (m *Message) Spawn(arg ...interface{}) *Message
- func (m *Message) Split(str string, field string, sp string, nl string) *Message
- func (m *Message) Start(key string, arg ...string) *Message
- func (m *Message) Status(arg ...interface{})
- func (m *Message) StatusTime(arg ...interface{})
- func (m *Message) StatusTimeCount(arg ...interface{})
- func (m *Message) StatusTimeCountTotal(arg ...interface{})
- func (m *Message) Table(cbs ...func(index int, value map[string]string, head []string)) *Message
- func (m *Message) Target() *Context
- func (m *Message) Time(args ...interface{}) string
- func (m *Message) Toast(text string, arg ...interface{})
- func (m *Message) Travel(cb interface{}) *Message
- func (m *Message) TryCatch(msg *Message, silent bool, hand ...func(msg *Message)) *Message
- func (m *Message) Upload(dir string)
- func (m *Message) Warn(err interface{}, arg ...interface{}) bool
- func (m *Message) Watch(key string, arg ...string) *Message
- type Option
- type Server
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 }
Functions ¶
Types ¶
type Action ¶
type Command ¶
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) Register ¶
func (*Context) Spawn ¶
type Frame ¶
type Frame struct{}
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) AppendTrans ¶ added in v0.4.7
func (*Message) Config ¶ added in v0.4.9
func (*Message) ConfigSimple ¶ added in v0.5.0
func (*Message) Configv ¶ added in v0.6.3
func (*Message) Confm ¶
func (*Message) EchoVideos ¶ added in v0.5.3
func (*Message) GoToast ¶
func (*Message) Grow ¶
func (*Message) Grows ¶
func (*Message) ProcessCommand ¶
func (*Message) Push ¶
func (*Message) RenderCmd ¶ added in v0.6.3
func (*Message) RenderIndex ¶
func (*Message) Rich ¶
func (*Message) Richs ¶
func (*Message) Split ¶
func (*Message) Table ¶
func (*Message) TryCatch ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.