This post describes the MicroDB shell, which is a Unix-like shell for interacting with MicroDB.
show [-t] OID [TAG] --- show all tags or OID or the chosen tag
tag [-f] OID TAG VALUE [TYPE] --- set tag TAG to VALUE on OID (opt. type)
rm OID [TAG] --- remove all or nominated tag(s) from OID
ls [-l] OID --- list tags on an object
help --- show the help
pwd --- print working database information
whoami --- print username
. [-f] FILE --- execute commands from FILE
exec [-f] FILE --- execute commands from FILE
Here:
OID
is an object identifier. Object identifiers are unicode strings.
The empty string is not a valid OID. All other strings are, in principle,
valid object identifiers, as long as they do not include the slash
character (/
). It is recommended that tag names follow the MicroDB
tag conventions, but this is not required.TAG
is the name of a tag (a string).VALUE
is a tag value, appropriately formatted (see BELOW1).TYPE
is a type specifier (see BELOW2).FILE
is an absolute or relative path to a file,.Tags in MicroDB can contain values, and those values have types.
One of the values a tag can have is the null value null
. There is no
distinction between a tag whose value is null and a tag without a value.
MicroDB uses both base types, MIME types and special types.
The base types stored in MicroDB are:
null
(code n
): the null valuebool
(code b
): a boolean value, true
or false
, (synonym: boolean
)int
(code i
): an integer value (synonym integer
)real
(code: r
): a floating point value (synonym: float
)str
(code: s
): a floating point value (synonym: text
)date
(code: D
): a date with no time component, always formatted
using ISO 8601.datetime
(code: d
): date with a time component, always formatted using ISO 8601, with optional time zones information.MicroDB currently understands a subset of MIME types in addition to base types. This set is likely to expand over time, and it is possible that MicroDB will eventually understand arbitrary MIME types.
Currently supported MIME types are:
text/html
(code H
)text/xml
(code X
)text/css
(code C
)text/plain
(code T
)application/json
(code J
)link
(code L
) — a hyperlinkautolink
(code a
) — an automatic hyperlinkcompound
(code c
) — a compound typetemplate
(code t
) — a templateunknown
(code unknown
) — a value of unknown type.When using the tag
command, the type of values will be inferred,
if not specified explicitly, using common-sense rules.
If tag names are chosen that look like file names with extensions, the extension will be used to infer the type when this is possible. The following tag extensions are used for this inference.
.html
: tag value will be interpreted as text/html
.xml
: tag value will be interpreted as text/xml
.rss
: tag value will be interpreted as text/xml
.txt
: tag value will be interpreted as text/plain
.json
: tag value will be interpreted as application/json
.D
: tag value will be interpreted as a date
.d
: tag value will be interpreted as a datetime
.c
: tag value will be interpreted as compound