Skip to content

Commit 7c8c8dd

Browse files
authored
Merge pull request #1 from upringjs/init
Init
2 parents 493636a + 845d52a commit 7c8c8dd

File tree

6 files changed

+1099
-21
lines changed

6 files changed

+1099
-21
lines changed

.gitignore

+24-20
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
logs
33
*.log
44
npm-debug.log*
5-
yarn-debug.log*
6-
yarn-error.log*
75

86
# Runtime data
97
pids
108
*.pid
119
*.seed
12-
*.pid.lock
1310

1411
# Directory for instrumented libs generated by jscoverage/JSCover
1512
lib-cov
@@ -23,37 +20,44 @@ coverage
2320
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
2421
.grunt
2522

26-
# Bower dependency directory (https://bower.io/)
27-
bower_components
28-
2923
# node-waf configuration
3024
.lock-wscript
3125

3226
# Compiled binary addons (http://nodejs.org/api/addons.html)
3327
build/Release
3428

3529
# Dependency directories
36-
node_modules/
37-
jspm_packages/
38-
39-
# Typescript v1 declaration files
40-
typings/
30+
node_modules
31+
jspm_packages
4132

4233
# Optional npm cache directory
4334
.npm
4435

45-
# Optional eslint cache
46-
.eslintcache
47-
4836
# Optional REPL history
4937
.node_repl_history
5038

51-
# Output of 'npm pack'
52-
*.tgz
39+
# 0x
40+
profile-*
41+
42+
# mac files
43+
.DS_Store
44+
45+
# vim swap files
46+
*.swp
47+
48+
# webstorm
49+
.idea
50+
51+
# vscode
52+
.vscode
5353

54-
# Yarn Integrity file
55-
.yarn-integrity
54+
# flamegraphs
55+
profile*
5656

57-
# dotenv environment variables file
58-
.env
57+
# lock files
58+
yarn.lock
59+
package-lock.json
5960

61+
# generated code
62+
examples/typescript-server.js
63+
test/types/index.js

.travis.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
language: node_js
2+
3+
node_js:
4+
- "8"
5+
- "9"
6+
7+
env:
8+
- CXX=g++-4.8
9+
10+
addons:
11+
apt:
12+
sources:
13+
- ubuntu-toolchain-r-test
14+
packages:
15+
- g++-4.8

README.md

+154-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,154 @@
1-
# upring-set
1+
# upring-set
2+
3+
[![Build Status](https://travis-ci.org/upringjs/upring-set.svg?branch=master)](https://travis-ci.org/upringjs/upring-set) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
4+
5+
Redis set api on top of Upring
6+
7+
## Install
8+
9+
```
10+
npm i upring-set --save
11+
```
12+
13+
## Usage
14+
15+
This library exposes the standard `upring` plugin interface.
16+
Once you register it, it adds a `set` name space with the API documented below.
17+
This plugin needs that [`upring-kv`](https://github.com/upringjs/upring-kv) is registered as well.
18+
```js
19+
const upring = require('upring')({
20+
logLevel: 'info',
21+
base: [],
22+
hashring: {
23+
joinTimeout: 200,
24+
replicaPoints: 10
25+
}
26+
})
27+
28+
upring.use(require('upring-kv'))
29+
upring.use(require('upring-set'))
30+
31+
upring.on('up', onReady)
32+
33+
async function onReady () {
34+
await upring.set.sadd('set', ['one', 'two', 'three'])
35+
const members = await upring.set.smembers('set')
36+
console.log(members) // ['one', 'two', 'three']
37+
}
38+
```
39+
40+
## API
41+
The API is not yet completed, if you need an API that is not implemented please fire a [pull request](https://github.com/upringjs/upring-set/pulls)!
42+
43+
#### `sadd`
44+
[Redis docs](https://redis.io/commands/sadd)
45+
```js
46+
await upring.set.sadd('set', ['one', 'two', 'three'])
47+
await upring.set.sadd('key', 'value')
48+
```
49+
50+
#### `zadd`
51+
[Redis docs](https://redis.io/commands/zadd)
52+
```js
53+
await upring.set.zadd('key', 1, 'value')
54+
```
55+
56+
#### `srem`
57+
[Redis docs](https://redis.io/commands/srem)
58+
```js
59+
await upring.set.srem('key', 'value')
60+
await upring.set.srem('set', ['one', 'two', 'three'])
61+
```
62+
63+
#### `zrem`
64+
[Redis docs](https://redis.io/commands/zrem)
65+
```js
66+
await upring.set.zrem('key', 'value')
67+
await upring.set.zrem('set', ['one', 'two', 'three'])
68+
```
69+
70+
#### `del`
71+
[Redis docs](https://redis.io/commands/del)
72+
```js
73+
await upring.set.del('key')
74+
```
75+
76+
#### `sinter`
77+
[Redis docs](https://redis.io/commands/sinter)
78+
```js
79+
await upring.set.sinter(['set1', 'set2', 'set3'])
80+
```
81+
82+
#### `sunion`
83+
[Redis docs](https://redis.io/commands/sunion)
84+
```js
85+
await upring.set.sunion(['set1', 'set2', 'set3'])
86+
```
87+
88+
#### `scard`
89+
[Redis docs](https://redis.io/commands/scard)
90+
```js
91+
await upring.set.scard('set')
92+
```
93+
94+
#### `zcard`
95+
[Redis docs](https://redis.io/commands/zcard)
96+
```js
97+
await upring.set.zcard('set')
98+
```
99+
100+
#### `smembers`
101+
[Redis docs](https://redis.io/commands/smembers)
102+
```js
103+
await upring.set.smembers('set')
104+
```
105+
106+
#### `sismembers`
107+
[Redis docs](https://redis.io/commands/sismembers)
108+
```js
109+
await upring.set.sismembers('set', 'value')
110+
```
111+
112+
#### `sunionstore`
113+
[Redis docs](https://redis.io/commands/sunionstore)
114+
```js
115+
await upring.set.sunionstore('set', ['set1', 'set2', 'set3'])
116+
```
117+
118+
#### `sdiff`
119+
[Redis docs](https://redis.io/commands/sdiff)
120+
```js
121+
await upring.set.sdiff(['set1', 'set2', 'set3'])
122+
```
123+
124+
#### `zrange`
125+
[Redis docs](https://redis.io/commands/zrange)
126+
```js
127+
await upring.set.zrange('set', 0, -1)
128+
```
129+
130+
#### `zrevrange`
131+
[Redis docs](https://redis.io/commands/zrevrange)
132+
```js
133+
await upring.set.zrevrange('set', 0, -1)
134+
```
135+
136+
#### `zscore`
137+
[Redis docs](https://redis.io/commands/zscore)
138+
```js
139+
await upring.set.zscore('set', 'value')
140+
```
141+
142+
#### `zincrby`
143+
[Redis docs](https://redis.io/commands/zincrby)
144+
```js
145+
await upring.set.zincrby('set', 1, 'value')
146+
```
147+
148+
## Acknowledgements
149+
150+
This project is kindly sponsored by [LetzDoIt](http://www.letzdoitapp.com/).
151+
152+
## License
153+
154+
Licensed under [MIT](./LICENSE).

0 commit comments

Comments
 (0)