SCT nosql database command reference 0.2.1

sct nosql memory database is a data structure storage database that supports rich data structure types.

Basic data types include: i08, u08, i16, u16, i32, u32, i64, u64, float, double, string, date, datetime

The first layer of the database uses a hash mapping structure by default, and the default maximum number of keys generated is 1024*1024

If a string key is used, store the relationship of a string key<->integer key.

If you use the string key when querying, first query the corresponding integer key from this mapping.

The string key is enclosed in double quotation marks ("), and the string supports C++ standard character escape \n,\x,\u,\U, etc.

Each stored hash structure can be one of the following

trie          //The storage data type only supports string
vector        //Sequential container
stack         //Stack container
queue         //Queue container
deque         //Double queue container
heap          //Heap container
set           //Binary balanced tree container
map           //Binary balanced tree key-value mapping container
list          //Linked list container
multiset      //Multi-valued binary balanced tree container
multimap      //Multi-valued binary balanced tree key-value mapping container
hashtable     //Hash table container (only integer types are supported, and the default size must be specified)
hashmap       //Hash table key value mapping container (only key integer type is supported, and the default size must be specified)

The key value management uses the following command

kvs                                                 //Display all stored key-value stores and stored container types, key and value types, the number of stores and the ten and hexadecimal values of key values.
kvs key                                             //Only display the corresponding key storage information, if it does not exist, return to failure.
erase key                                           //Delete the corresponding key, if it does not exist, return to failure.
clear                                               //Clear all key value information.
create container type key type [value type] [parameter] [string key]  //Create a container value. The non-key-value mapping container does not need to specify the value type, the non-hash type does not need to specify the parameters, and the string key does not need to specify the string key.
backup   path                                       //Backup the entire database to a file
restore  path                                       //Recover all data from data files

Each container can use the get/set/ins/del command to get/set/insert/delete

The command format is:

Command key or string key operation parameters

Different containers can use different operations, unsupported operations return failures

Each container operation supports the following:

get:
all       trie,vector,stack,queue,deque,heap,set,map,list,multiset,multimap,hashtable,hashmap
count     trie,vector,stack,queue,deque,heap,set,map,list,multiset,multimap,hashtable,hashmap
nth       vector,queue,deque
first     vector,queue,deque,list
last      vector,queue,deque,stack,list
range     vector,deque,list
first_k   vector,deque,list
last_k    vector,deque,list
idx_of    vector,deque,list
ptr_of    list
ptr_next  list
ptr_prev  list
coutain   trie
ucontain  trie
lege      set,multiset
ltge      set,multiset
legt      set,multiset
ltgt      set,multiset
rank      set,multiset
max       set,map,multiset,multimap
min       set,map,heap,multiset,multimap
max_k     set,multiset
min_k     set,multiset
eq        set,map,heap,multiset,multimap,hashtable,hashmap
gt        set,multiset
lt        set,multiset
ge        set,multiset
le        set,multiset
value_of  map,multimap,hashmap

The data structure of various operations corresponds to the implementation of the standard data structure, and the corresponding operation complexity is retained.

The following are some examples of usage:

create trie

create trie "abc"
create vector u64
create stack i32
create queue string
create deque date
create heap double
create bst float
create set float
create list string
create multiset int

create vector u64 "abc"
create stack i32 "abc"
create list string "abc"
create queue string "abc"
create deque date "abc"
create heap double "abc"
create bst float "abc"
create set float "abc"
create multiset int "abc"

create map int string
create multimap int string
create hashtable int 200

create map int string "abc"
create multimap int string "abc"
create hashtable int 200 "abc"
create hashmap int string 200


create hashmap string int 200 "abcd"


erase 11
erase "abc"

backup "aaa.nos"
restore "aaa.nos"


//get:
get "abcd" all;
get 100 all
get 100 nth 10
get 100 ptr_of 123
get 100 idx_of 123
get 100 first
get 100 last
get 100 range 1 1000
get 100 first_k 200
get 100 last_k 200

get 100 lege 2 10
get 100 ltge 2 100
get 100 legt 2 100
get 100 ltgt 2 100
get 100 max
get 100 min
get 100 max_k 10
get 100 min_k 10
get 100 eq 1.1
get 100 gt 1.2
get 100 lt 1.5
get 100 ge 2.0
get 100 le 3.0
get 100 rank 1.11

//trie
get 100 contain "abc"
get 100 ucontain "abcd"

//list
get 100 ptr_of 322
ins 100 ptr_of 1202340023
get 100 ptr_next 1202340023
set 100 ptr_of 1202340023 999

//map
get 100 value_of "abc"


set 100 all 999
set 100 nth 10 999
set 100 first 999
set 100 last 999
set 100 range 1 1000 999
set 100 first_k 200 999
set 100 last_k 200 999

set 100 lege 2 10 999
set 100 ltge 2 100 999
set 100 legt 2 100 999
set 100 ltgt 2 100 999
set 100 max 999
set 100 min 999
set 100 max_k 10 999
set 100 min_k 10 999
set 100 eq 1.1 999
set 100 gt 1.2 999
set 100 lt 1.5 999
set 100 ge 2.0 999
set 100 le 3.0 999

//insert

ins 100 999
ins 100 nth 10 999
ins 100 first 999
ins 100 last 999

ins 100 200 300


//delete
del 100 all
del 100 nth 10
del 100 first
del 100 last
del 100 range 1 1000
del 100 first_k 200
del 100 last_k 200

del 100 lege 2 10
del 100 ltge 2 100
del 100 legt 2 100
del 100 ltgt 2 100
del 100 max
del 100 min
del 100 max_k 10
del 100 min_k 10
del 100 eq 1.1
del 100 gt 1.2
del 100 lt 1.5
del 100 ge 2.0
del 100 le 3.0