corm(1)corm

NAME

corm - corm(1)

Corm command-line tool โ€” create, query, and associate persistent maps.

Simple CLI for the Corm engine. Replaces the old qdb and links directly against libcorm.

Overview

Creates/opens key-value databases in memory or on disk; supports queries, associations, mirrors, and iteration. Supports uint32_t and string types. Auto-index is only active if the key type is a.

Installation

See: https://github.com/tty-pt/ci/blob/main/docs/install.md#install-ttypt-packages

Usage

corm [-qa ARG] [[-rl] [-RpdgmcD ARG] ...] file[[:k]:v]

Use . as the KEY for all keys. Run corm -? to show the full help.

Options

-q/-a options are processed in order; each entry extends the lookup chain.

Type specifiers (k and v)

u               uint32_t
s               string (default for both key and value)
a               key only: uint32_t with auto-index
2<base-type>    key only: multivalue support (enables CM_MULTIVALUE|CM_SORTED)

Notes

Examples

# Automatic IDs: key 'a', values as strings
corm -p Mathew owners.db:a:s              # -> Mathew's ID
corm -p cat    pets.db:a:s                # -> cat's ID

# Association (no duplicates)
corm -p 1:1 assoc.db:u:u                  # owner_id:pet_id

# Get Mathew's pet (use -q/-a to resolve names/IDs)
corm -q owners.db:a:s -a pets.db:a:s -g Mathew assoc.db:u:u

# Random value for a KEY
corm -q owners.db:a:s -a pets.db:a:s -R Mathew assoc.db:u:u

# Chained lookups (multiple -q/-a in order)
corm -q owners.db:a:s -q pets.db:a:s -g Mathew assoc.db:u:u

# Multivalue support - duplicate keys
corm -p 100:value1 multi.db:2u:s          # Create multivalue map
corm -p 100:value2 multi.db:2u:s          # Add duplicate key
corm -p 100:value3 multi.db:2u:s          # Add another
corm -r -g 100 multi.db:2u:s              # -> value1 (first match)
corm -r -m 100 multi.db:2u:s              # -> value1 value2 value3 (all)
corm -r -c 100 multi.db:2u:s              # -> 3 (count)
corm -r -d 100 multi.db:2u:s              # Delete first only
corm -r -D 100 multi.db:2u:s              # Delete all with key 100

See also

corm_handle

corm_common

corm_assoc

corm_iteration

corm_type