Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Red-black-tree-based data storage (for small program / light application / node / browser ), efficient and lightweight, support for persistence and temporary storage!
Red-black-tree-based data storage (for small program / light application / node / browser ), efficient and lightweight, support for persistence and temporary storage!
npm i apdb --save
import apdb from 'apdb/node';
import apdb from 'apdb/wechat';
import apdb from 'apdb/web';
const apdb = new apdb( params );
key | desc | default |
---|---|---|
table | [string] storage table name | 'default' |
const result = await apdb.insert( params );
if insert successful, result is true
key | desc | default |
---|---|---|
key | [string] primary key | Date.now() + Math.random() |
value | [object] value | null |
update | [boolean] update current tree to storage, improve multi-line insert performance | true |
await apdb.insert({
key: 'apdb key',
value: {
name: 'apdb',
author: 'echosoar'
}
});
const result = await apdb.select( params );
key | desc |
---|---|
total | [number] Total number of data |
result | [array] all lines satisfying conditions |
result[n].key | primary key |
result[n].value | value |
key | desc | default |
---|---|---|
table | [string] storage table name | 'default' |
key | [array string] which fields are returned | []: return all fields |
where | [object] conditions for select, key value pair; use $key as key to select primary key | null |
order | [object] depend on certain columns for sorting, the value can be desc or asc | null |
limit | [object] | null |
limit.start | [number] limit which line to start returning | 0 |
limit.size | [number] limit number of returns | null : return all lines |
const list = await apdb.select({
where: {
$key: /8/
},
order: {
num: 'desc'
},
limit: {
size: 5
}
});
const result = await apdb.update( params );
result is the amount of updated lines
key | desc | default |
---|---|---|
table | [string] storage table name | 'default' |
where | [object] conditions for update, key value pair; use $key as key to select primary key | null |
value | [object] new value | {} |
newValue | [boolean] if ture, the original value columns will be discarded | false |
const updateCount = await apdb.update({
where: {
num: 302910
},
value: {
up: 'test new value'
},
});
const result = await apdb.delete( params );
result is the amount of deleted lines
key | desc | default |
---|---|---|
table | [string] storage table name | 'default' |
where | [object] conditions for delete, key value pair; use $key as key to select primary key | null |
const deleteCount = await apdb.delete({
where: {
num: 302909
}
});
type | amount(lines) | operate | time usage(ms) | space usage(MB) |
---|---|---|---|---|
json | 1,000,000 | init | 2000 | - |
json | 1,000,000 | insert | 14451 | 130.8 |
msgpack | 1,000,000 | init | 7281 | - |
msgpack | 1,000,000 | insert | 16288 | 100.7 |
- all | 1,000,000 | order desc | 1729 | |
- all | 1,000,000 | order asc | 1746 | |
- all | 1,000,000 | select where normal | 103 | |
- all | 1,000,000 | select where regexp | 7197 |
{
key: "1545802142928test13",
value: {
"num":302910,
"key":"1545801896834test302910"
}
}
FAQs
Red-black-tree-based data storage (for small program / light application / node / browser ), efficient and lightweight, support for persistence and temporary storage!
The npm package apdb receives a total of 0 weekly downloads. As such, apdb popularity was classified as not popular.
We found that apdb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.