Skip to content

Implement OSET for easy tandem creation, warn on tandem for existing keys (add --force to orders) #20

@splinterhq

Description

@splinterhq

This is short for ordered set and functionally similar to Redis' HSET.

Currently, in order to set up an ordered key, you have to do something like this because tandems clear the value region on setup:

SHUNT() {
    SET "${1}" " "
    splinterpctl orders set "${1}" 2
    SET "${1}" "${2}"
    TYPE "${1}" vartext
    TYPE "${1}.1" json
    LABEL "${1}" "shunt-attractor" 
}

Note that I first have to set an empty key, then call orders to create a tandem, then actually set the key (because orders will clear the value). This should be a single call in the API and CLI as splinter_oset(key, value, orders_to_setup) and oset orders_to_setup value in the CLI.

Likewise, it should be harder to wipe out a key accidentally with orders, so have it fail on non-empty (more than 1 byte long) keys unless -f / --force is passed.

May need to integrate argparse with orders.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions