mdb

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: MIT Imports: 11 Imported by: 21

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
	DATA = kit.MDB_DATA

	LINK = kit.MDB_LINK
	FILE = kit.MDB_FILE
	SCAN = kit.MDB_SCAN
	SHOW = kit.MDB_SHOW
	HELP = kit.MDB_HELP

	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

	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
	TOOLS = "tools"

	SOURCE = "_source"
	TARGET = "_target"

	CACHE_CLEAR_ON_EXIT = "cache.clear.on.exit"
)
View Source
const (
	DETAIL = "detail"
	RANDOM = "random"
	ACTION = "action"
	FIELDS = "fields"
	PARAMS = "params"

	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 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 = "time,id,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", Hand: func(m *ice.Message, arg ...string) {
		const (
			SPACE   = "space"
			CONTEXT = "context"
			COMMAND = "command"
			INDEX   = "index"
		)
		switch arg[3] = strings.TrimPrefix(arg[3], EXTRA+ice.PT); arg[3] {
		case ice.POD:
			m.Cmdy(SPACE)
		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.Cmdy(COMMAND, SEARCH, COMMAND, kit.Select("", arg, 1), ice.OptionFields(arg[3]))
		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...", Hand: func(m *ice.Message, arg ...string) {
		defer m.ProcessRefresh()
		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", Hand: func(m *ice.Message, arg ...string) {
		defer m.ProcessRefresh()
		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...", 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", 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]...", 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", Hand: func(m *ice.Message, arg ...string) {
		m.OptionDefault(CACHE_LIMIT, "-1")
		switch file := _file_name(m, arg...); arg[2] {
		case ZONE:
			_zone_export(m, arg[0], arg[1], file)
		case HASH:
			_hash_export(m, arg[0], arg[1], file)
		case LIST:
			_list_export(m, arg[0], arg[1], file)
		}
		m.StatusTime(LINK, "/share/local/"+m.Result()).Process("_clear")
	}},
	IMPORT: {Name: "import key sub type file", 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 Cache added in v1.4.4

func Cache(m *ice.Message, key string, add func() ice.Any) ice.Any

func ClearHashOnExitAction added in v1.4.4

func ClearHashOnExitAction() ice.Actions

func Config added in v1.4.4

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

func Grow added in v1.3.0

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

func HashAction

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

func HashCreate added in v1.2.0

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

func HashCreateDeferRemove added in v1.4.4

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

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 HashKey added in v1.3.6

func HashKey(m *ice.Message) string

func HashModify added in v1.2.8

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

func HashModifyDeferRemove added in v1.4.4

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

func HashPrunes added in v0.6.4

func HashPrunes(m *ice.Message, cb func(Map) 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) (has bool)

func HashSelectDetails added in v1.4.4

func HashSelectDetails(m *ice.Message, key string, cb func(ice.Map) bool) ice.Map

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 ListAction

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

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 PageListAction added in v1.4.4

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

func PageListSelect added in v1.4.4

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

func PageZoneAction added in v1.4.4

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

func PageZoneSelect added in v1.4.4

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

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 StatusHashAction added in v1.4.4

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

func ZoneAction

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

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 ZoneKey added in v1.4.4

func ZoneKey(m *ice.Message) string

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 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 HashSelectTarget added in v1.4.4

func HashSelectTarget(m *ice.Message, key string, create Any) (target Any)

type List added in v1.5.2

type List = []interface{}

type Map added in v1.2.9

type Map = map[string]Any

func Grows added in v1.3.0

func Grows(m 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

type Message added in v1.4.7

type Message interface {
	Confv(arg ...Any) (val Any)
	Option(key string, arg ...Any) string
}

Jump to

Keyboard shortcuts

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