mdb

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 10 Imported by: 24

Documentation

Index

Constants

View Source
const (
	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 (
	DICT = kit.MDB_DICT
	META = kit.MDB_META

	UNIQ    = kit.MDB_UNIQ
	FOREACH = kit.MDB_FOREACH
	RANDOMS = kit.MDB_RANDOMS
)
View Source
const (
	// 数据
	ID   = kit.MDB_ID
	KEY  = kit.MDB_KEY
	TIME = kit.MDB_TIME
	TYPE = kit.MDB_TYPE
	NAME = kit.MDB_NAME
	TEXT = kit.MDB_TEXT

	// 文件
	LINK = kit.MDB_LINK
	SCAN = kit.MDB_SCAN
	SHOW = kit.MDB_SHOW
	HELP = kit.MDB_HELP
	DATA = kit.MDB_DATA
	FILE = kit.MDB_FILE

	// 存储
	SHORT = kit.MDB_SHORT
	FIELD = kit.MDB_FIELD
	TOTAL = kit.MDB_TOTAL
	COUNT = kit.MDB_COUNT
	LIMIT = kit.MDB_LIMIT
	LEAST = kit.MDB_LEAST
	STORE = kit.MDB_STORE
	FSIZE = kit.MDB_FSIZE

	// 索引
	INDEX  = kit.MDB_INDEX
	VALUE  = kit.MDB_VALUE
	EXTRA  = kit.MDB_EXTRA
	ALIAS  = kit.MDB_ALIAS
	EXPIRE = kit.MDB_EXPIRE
	STATUS = kit.MDB_STATUS
	STREAM = kit.MDB_STREAM
)
View Source
const (
	DETAIL = "detail"
	RANDOM = "random"
	ACTION = "action"

	INPUTS = "inputs"
	CREATE = "create"
	REMOVE = "remove"
	INSERT = "insert"
	DELETE = "delete"
	MODIFY = "modify"
	SELECT = "select"
	PRUNES = "prunes"
	EXPORT = "export"
	IMPORT = "import"

	UPLOAD = "upload"
	REVERT = "revert"
	REPEAT = "repeat"

	NEXT   = "next"
	PREV   = "prev"
	PAGE   = "page"
	OFFEND = "offend"

	JSON = "json"
	CSV  = "csv"
)
View Source
const (
	CACHE_CLEAR_ON_EXIT = "cache.clear.on.exit"

	SOURCE = "_source"
	TARGET = "_target"
)
View Source
const ENGINE = "engine"
View Source
const HASH = "hash"
View Source
const (
	HASH_FIELD = "time,hash,type,name,text"
)
View Source
const LIST = "list"
View Source
const (
	LIST_FIELD = "time,id,type,name,text"
)
View Source
const MDB = "mdb"
View Source
const PLUGIN = "plugin"
View Source
const RENDER = "render"
View Source
const SEARCH = "search"
View Source
const ZONE = "zone"
View Source
const (
	ZONE_FIELD = "zone,id,time,type,name,text"
)

Variables

View Source
var Index = &ice.Context{Name: MDB, Help: "数据模块", Commands: ice.Commands{
	ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}},
	ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}},
	INPUTS: {Name: "inputs key sub type field value", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
		switch arg[3] = strings.TrimPrefix(arg[3], "extra."); arg[3] {
		case ice.POD:
			m.Cmdy("route")
		case ice.CTX:
			m.Cmdy("context")
		case ice.CMD:
			m.Cmdy("context", kit.Select(m.Option(ice.CTX), m.Option(kit.Keys(EXTRA, ice.CTX))), "command")
		case "index":
			m.OptionFields(arg[0])
			m.Cmdy("command", SEARCH, "command", kit.Select("", arg, 1))
		default:
			switch arg[2] {
			case ZONE:
				_zone_inputs(m, arg[0], arg[1], arg[3], kit.Select(NAME, arg, 4), kit.Select("", arg, 5))
			case HASH:
				_hash_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4))
			case LIST:
				_list_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4))
			}
		}
	}},
	INSERT: {Name: "insert key sub type arg...", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
		defer m.ProcessRefresh3ms()
		switch arg[2] {
		case ZONE:
			_zone_insert(m, arg[0], arg[1], arg[3], arg[4:]...)
		case HASH:
			_hash_insert(m, arg[0], arg[1], arg[3:]...)
		case LIST:
			_list_insert(m, arg[0], arg[1], arg[3:]...)
		}
	}},
	DELETE: {Name: "delete key sub type field value", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
		defer m.ProcessRefresh3ms()
		switch arg[2] {
		case ZONE:

		case HASH:
			_hash_delete(m, arg[0], arg[1], arg[3], arg[4])
		case LIST:

		}
	}},
	MODIFY: {Name: "modify key sub type field value arg...", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
		switch arg[2] {
		case ZONE:
			_zone_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...)
		case HASH:
			_hash_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...)
		case LIST:
			_list_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...)
		}
	}},
	SELECT: {Name: "select key sub type field value", Help: "查询", Hand: func(m *ice.Message, arg ...string) {
		switch arg[2] {
		case ZONE:
			_zone_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select("", arg, 4))
		case HASH:
			_hash_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select(FOREACH, arg, 4))
		case LIST:
			_list_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select("", arg, 4))
		}
	}},
	PRUNES: {Name: "prunes key sub type [field value]...", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
		switch arg[2] {
		case ZONE:

		case HASH:
			_hash_prunes(m, arg[0], arg[1], arg[3:]...)
			m.Tables(func(value ice.Maps) { _hash_delete(m, arg[0], arg[1], HASH, value[HASH]) })
		case LIST:

		}
	}},
	EXPORT: {Name: "export key sub type file", Help: "导出", Hand: func(m *ice.Message, arg ...string) {
		if m.Option(CACHE_LIMIT) == "" {
			m.Option(CACHE_LIMIT, "-1")
		}
		switch file := _file_name(m, arg...); arg[2] {
		case ZONE:
			m.OptionFields(ZoneShort(m), m.Config(FIELD))
			_zone_export(m, arg[0], arg[1], file)
		case HASH:
			_hash_export(m, arg[0], arg[1], file)
		case LIST:
			m.OptionFields(m.Config(FIELD))
			_list_export(m, arg[0], arg[1], file)
		}
	}},
	IMPORT: {Name: "import key sub type file", Help: "导入", Hand: func(m *ice.Message, arg ...string) {
		switch file := _file_name(m, arg...); arg[2] {
		case ZONE:
			_zone_import(m, arg[0], arg[1], file)
		case HASH:
			_hash_import(m, arg[0], arg[1], file)
		case LIST:
			_list_import(m, arg[0], arg[1], file)
		}
	}},
}}

Functions

func AutoConfig added in v0.9.9

func AutoConfig(args ...ice.Any) *ice.Action

func Grow added in v1.3.0

func Grow(m *ice.Message, prefix string, chain Any, data Any) int

func HashAction

func HashAction(args ...Any) ice.Actions

func HashArgs added in v1.2.9

func HashArgs(m *ice.Message, arg ...Any) []string

func HashCloseAction added in v1.3.0

func HashCloseAction(args ...Any) ice.Actions

func HashCreate added in v1.2.0

func HashCreate(m *ice.Message, arg ...Any) string

func HashExport added in v1.2.8

func HashExport(m *ice.Message, arg ...Any) *ice.Message

func HashField added in v1.2.9

func HashField(m *ice.Message) string

func HashImport added in v1.2.8

func HashImport(m *ice.Message, arg ...Any) *ice.Message

func HashInputs added in v1.2.8

func HashInputs(m *ice.Message, arg ...Any) *ice.Message

func HashModify added in v1.2.8

func HashModify(m *ice.Message, arg ...Any) *ice.Message

func HashPrunes added in v0.6.4

func HashPrunes(m *ice.Message, cb func(Maps) bool) *ice.Message

func HashPrunesValue added in v1.2.9

func HashPrunesValue(m *ice.Message, field, value string)

func HashRemove added in v1.2.7

func HashRemove(m *ice.Message, arg ...Any) *ice.Message

func HashSearchAction added in v1.3.0

func HashSearchAction(arg ...Any) ice.Actions

func HashSelect added in v0.5.3

func HashSelect(m *ice.Message, arg ...string) *ice.Message

func HashSelectClose added in v1.3.0

func HashSelectClose(m *ice.Message) *ice.Message

func HashSelectDetail added in v1.2.9

func HashSelectDetail(m *ice.Message, key string, cb Any) bool

func HashSelectField added in v1.3.0

func HashSelectField(m *ice.Message, key string, field string) (value string)

func HashSelectSearch added in v1.2.9

func HashSelectSearch(m *ice.Message, args []string, keys ...string) *ice.Message

func HashSelectUpdate added in v1.2.9

func HashSelectUpdate(m *ice.Message, key string, cb Any) *ice.Message

func HashSelectValue added in v1.2.9

func HashSelectValue(m *ice.Message, cb Any) *ice.Message

func HashSelects added in v1.2.9

func HashSelects(m *ice.Message, arg ...string) *ice.Message

func HashShort added in v1.2.9

func HashShort(m *ice.Message) string

func HashStatusAction added in v1.3.0

func HashStatusAction(args ...Any) ice.Actions

func HashStatusCloseAction added in v1.3.0

func HashStatusCloseAction(args ...Any) ice.Actions

func ListAction

func ListAction(args ...ice.Any) ice.Actions

func ListArgs added in v1.2.9

func ListArgs(m *ice.Message, arg ...ice.Any) []string

func ListField added in v1.2.9

func ListField(m *ice.Message) string

func ListSelect added in v0.6.1

func ListSelect(m *ice.Message, arg ...string) *ice.Message

func Lock added in v1.3.0

func Lock(m *ice.Message, arg ...ice.Any) func()

func NextPage

func NextPage(m *ice.Message, total string, arg ...string)

func NextPageLimit added in v0.5.0

func NextPageLimit(m *ice.Message, total string, arg ...string)

func OptionPage added in v1.3.0

func OptionPage(m *ice.Message, arg ...string) int

func OptionPages added in v1.3.0

func OptionPages(m *ice.Message, arg ...string) (page int, size int)

func PrevPage

func PrevPage(m *ice.Message, total string, arg ...string)

func PrevPageLimit added in v0.5.0

func PrevPageLimit(m *ice.Message, total string, arg ...string)

func RLock added in v1.3.0

func RLock(m *ice.Message, arg ...ice.Any) func()

func RenderAction added in v1.2.9

func RenderAction(args ...ice.Any) ice.Actions

func Rich added in v1.3.0

func Rich(m *ice.Message, prefix string, chain Any, data Any) string

func SearchAction added in v1.3.0

func SearchAction() ice.Actions

func ZoneAction

func ZoneAction(args ...ice.Any) ice.Actions

func ZoneArgs added in v1.2.9

func ZoneArgs(m *ice.Message, arg ...Any) []string

func ZoneCreate added in v1.2.9

func ZoneCreate(m *ice.Message, arg ...Any)

func ZoneExport added in v1.2.9

func ZoneExport(m *ice.Message, arg ...Any)

func ZoneField added in v1.2.9

func ZoneField(m *ice.Message) string

func ZoneImport added in v1.2.9

func ZoneImport(m *ice.Message, arg ...Any)

func ZoneInputs added in v1.2.9

func ZoneInputs(m *ice.Message, arg ...Any)

func ZoneInsert added in v1.2.9

func ZoneInsert(m *ice.Message, arg ...Any)

func ZoneModify added in v1.2.9

func ZoneModify(m *ice.Message, arg ...Any)

func ZoneRemove added in v1.2.9

func ZoneRemove(m *ice.Message, arg ...Any)

func ZoneSelect added in v0.6.1

func ZoneSelect(m *ice.Message, arg ...string) *ice.Message

func ZoneSelectAll added in v0.8.1

func ZoneSelectAll(m *ice.Message, arg ...string) *ice.Message

func ZoneSelectCB added in v0.8.1

func ZoneSelectCB(m *ice.Message, zone string, cb Any) *ice.Message

func ZoneSelectPage added in v1.2.9

func ZoneSelectPage(m *ice.Message, arg ...string) *ice.Message

func ZoneSelects added in v1.3.0

func ZoneSelects(m *ice.Message, arg ...string) *ice.Message

func ZoneShort added in v1.2.9

func ZoneShort(m *ice.Message) string

Types

type Any added in v1.2.9

type Any = interface{}

func HashTarget added in v1.2.9

func HashTarget(m *ice.Message, h string, add func() Any) (p Any)

type Map added in v1.2.9

type Map = map[string]Any

func Grows added in v1.3.0

func Grows(m *ice.Message, prefix string, chain Any, match string, value string, cb Any) Map

func Richs added in v1.3.0

func Richs(m *ice.Message, prefix string, chain Any, raw Any, cb Any) (res Map)

type Maps added in v1.2.9

type Maps = map[string]string

Jump to

Keyboard shortcuts

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