mdb

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 13 Imported by: 24

Documentation

Index

Constants

View Source
const (
	MONTH = "720h"
	DAYS  = "72h"
	HOUR  = "1h"

	CACHE_CLEAR_ONEXIT = "cache.clear.onexit"
)
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
	VIEW = kit.MDB_VIEW

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

	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

	ICONS     = "icons"
	UNITS     = "units"
	TOOLS     = "tools"
	SOURCE    = "_source"
	TARGET    = "_target"
	IMPORTANT = "important"
	VALID     = "valid"
	EXPIRED   = "expired"
	DISABLE   = "disable"
	ENABLE    = "enable"
)
View Source
const (
	INPUTS = "inputs"
	CREATE = "create"
	REMOVE = "remove"
	UPDATE = "update"
	INSERT = "insert"
	DELETE = "delete"
	MODIFY = "modify"
	SELECT = "select"
	PRUNES = "prunes"
	EXPORT = "export"
	IMPORT = "import"

	DETAIL = "detail"
	FIELDS = "fields"
	PARAMS = "params"
	OFFEND = "offend"
	OFFSET = "offset"
	RANDOM = "random"
	SUBKEY = "mdb.sub"

	ACTION = "action"
	UPLOAD = "upload"
	RECENT = "recent"
	REPEAT = "repeat"
	REVERT = "revert"
	RENAME = "rename"
	ORDER  = "order"
	PRUNE  = "prune"

	PAGE = "page"
	NEXT = "next"
	PREV = "prev"
	PLAY = "play"

	SORT = "sort"
	JSON = "json"
	CSV  = "csv"
	SUB  = "sub"

	QS = ice.QS
	EQ = ice.EQ
	AT = ice.AT
	FS = ice.FS
)
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) {
		kit.Switch(arg[2],
			HASH, func() { _hash_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) },
			ZONE, func() { _zone_inputs(m, arg[0], arg[1], arg[3], kit.Select(NAME, arg, 4), kit.Select("", arg, 5)) },
			LIST, func() { _list_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) },
		)
		for _, inputs := range ice.Info.Inputs {
			if arg[2] == ZONE {
				inputs(m, arg[4])
			} else {
				inputs(m, arg[3])
			}
		}
	}},
	INSERT: {Name: "insert key sub type arg...", Hand: func(m *ice.Message, arg ...string) {
		kit.Switch(arg[2],
			HASH, func() { _hash_insert(m, arg[0], arg[1], arg[3:]...) },
			ZONE, func() {
				if arg[3] == ZONE {
					_zone_insert(m, arg[0], arg[1], arg[4], arg[5:]...)
				} else {
					_zone_insert(m, arg[0], arg[1], arg[3], arg[4:]...)
				}
			},
			LIST, func() { _list_insert(m, arg[0], arg[1], arg[3:]...) },
		)
	}},
	DELETE: {Name: "delete key sub type field value", Hand: func(m *ice.Message, arg ...string) {
		kit.Switch(arg[2],
			HASH, func() { _hash_delete(m, arg[0], arg[1], arg[3], arg[4]) },
		)
	}},
	MODIFY: {Name: "modify key sub type field value arg...", Hand: func(m *ice.Message, arg ...string) {
		kit.Switch(arg[2],
			HASH, func() { _hash_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...) },
			ZONE, func() { _zone_modify(m, arg[0], arg[1], arg[3], arg[4], arg[5:]...) },
			LIST, func() { _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) {
		kit.Switch(arg[2],
			HASH, func() { _hash_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select(FOREACH, arg, 4)) },
			ZONE, func() { _zone_select(m, arg[0], arg[1], kit.Select("", arg, 3), kit.Select("", arg, 4)) },
			LIST, func() { _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) {
		kit.Switch(arg[2],
			HASH, func() {
				_hash_prunes(m, arg[0], arg[1], arg[3:]...)
				m.Table(func(value Maps) { _hash_delete(m, arg[0], arg[1], HASH, value[HASH]) })
			},
		)
	}},
	EXPORT: {Name: "export key sub type file", Hand: func(m *ice.Message, arg ...string) {
		m.OptionDefault(CACHE_LIMIT, "-1")
		file := _mdb_export_file(m, arg...)
		kit.Switch(arg[2],
			HASH, func() {
				_hash_export(m, arg[0], arg[1], file)
			},
			ZONE, func() {
				_zone_export(m, arg[0], arg[1], file)
				_hash_export(m, arg[0], arg[1], file)
			},
			LIST, func() { _list_export(m, arg[0], arg[1], file) },
		)
	}},
	IMPORT: {Name: "import key sub type file", Hand: func(m *ice.Message, arg ...string) {
		file := _mdb_export_file(m, arg...)
		kit.Switch(arg[2],
			HASH, func() {
				_hash_import(m, arg[0], arg[1], file)
			},
			ZONE, func() {
				_hash_import(m, arg[0], arg[1], file)
				_zone_import(m, arg[0], arg[1], file)
			},
			LIST, func() { _list_import(m, arg[0], arg[1], file) },
		)
	}},
}}

Functions

func AutoConfig added in v0.9.9

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

func ClearOnExitHashAction added in v1.5.5

func ClearOnExitHashAction() ice.Actions

func Conf added in v1.5.5

func Conf(m configMessage, arg ...Any) string

func Config added in v1.4.4

func Config(m configMessage, key string, arg ...Any) string

func ConfigSimple added in v1.8.0

func ConfigSimple(m configMessage, key ...string) (res []string)

func ExportHashAction added in v1.5.18

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

func ExportZoneAction added in v1.6.3

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

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 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 HashSelectField added in v1.3.0

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

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 ImportantHashAction added in v1.5.7

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

func ImportantZoneAction added in v1.5.7

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

func IsSearchPreview added in v1.5.13

func IsSearchPreview(m *ice.Message, arg []string, cb ...func() []string) bool

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 configMessage, arg ...string) 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 configMessage, arg ...string) func()

func RenderAction added in v1.2.9

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

func Rich added in v1.3.0

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

func StatusHashAction added in v1.4.4

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

func ZoneAction

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

func ZoneConfig added in v1.6.1

func ZoneConfig(arg ...Any) *ice.Action

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 = ice.Any

func Cache added in v1.4.4

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

func Configv added in v1.5.5

func Configv(m configMessage, key string, arg ...Any) Any

func Confv added in v1.5.5

func Confv(m configMessage, arg ...Any) Any

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 = ice.List

type Map added in v1.2.9

type Map = ice.Map

func Confm added in v1.5.5

func Confm(m configMessage, key string, sub Any, cbs ...Any) Map

func Grows added in v1.3.0

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

func HashSelectDetails added in v1.4.4

func HashSelectDetails(m *ice.Message, key string, cb func(Map) bool) 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 = ice.Maps

func ToMaps added in v1.5.5

func ToMaps(value Map) Maps

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