tcpleveldb
A node-js-tcp database environment with server and client on top of the leveldb.
You can run the server in a separate node-app as a standalone instance. Go to server. Then you can use the client in your node-app, web-app or another magic stuff to query the database. Go to client. You can find a web-gui to manage the database-servers here - tcpleveldb-panel.
Web-GUI - https://github.com/yamigr/tcpleveldb-panel
Installing
npm install tcpleveldb --save
Server
var tcpleveldb = var port = 2222var host = 'localhost'var user = ''var password = '' var srv = port host user passwordsrv //you can use some socket-events if neededsrvsrvsrvsrvsrvsrv
Client
- You can define a new database at './db'. If needed, do something like './users' or './dashboards', ... .
- While putting some data in the db and no key is set, auto-key is active. When the key containes '@key' (single or multiple-times), this substring will be replaced with a auto-key.
var tcpleveldb = var port = 2222var host = 'localhost'var user = ''var password = '' var client = port host user password // Define your own key which should be replaced by a unique idclientkey = '{mykey}' // add some additional query data to handle it on the server-side-event 'clientMessage' or 'data'clientaddQuery = topic : 'Hello' //if key is empty it will create one like c10zlYDlfclient client client client var batches = type: 'del' key: 'father' type: 'put' key: 'yamigr' value: 'https://github.com/yamigr' type: 'put' key: 'obj:1' value: a : 123 b: 'abc' c :'Hello World!' type: 'put' key: 'obj:2' value: a : 1 b: 'xyz' c :'Hello World!' client // ops : gte:'key', lte: 'key~', reverse, limit, lt, gt, start, end for timeseries...*/// For api options details see https://www.npmjs.com/package/leveldb. Thx :)// For gte and lte query see https://medium.com/@kevinsimper/how-to-get-range-of-keys-in-leveldb-and-how-gt-and-lt-works-29a8f1e11782 Thx :)clientclient // stream all keysclient // stream all keysclient clientclient /* mongodb like array-filtering. a huge thx to davidtpate, https://www.npmjs.com/package/bloc the array to filter looks like [ { key : '', value : '' or object }, ....]. a single entry with object as value looks like {key : 'test', value: { test : 'mongooselike', obj : { nested : 'filter'}}} the nested filter looks like { 'value.obj.nested' : { $in : ['filter'] }} in the example bellow, the value is a string*/client client // use the query method the use all query-options in one methodclient clientclientclientclient
Authors
- Yannick Grund - Initial work - yamigr
License
This project is licensed under the MIT License - see the LICENSE.md file for details