-
Notifications
You must be signed in to change notification settings - Fork 0
/
hget.js
46 lines (43 loc) · 1.06 KB
/
hget.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const instance = require('./instance');
const redis = instance.redis;
const client = instance.client;
const platform = require('connect-platform');
platform.core.node({
path: '/redis/hget',
public: false,
inputs: [
'key',
'field'
],
outputs: [
'value'
],
controlOutputs: [
'error'
],
hints: {
node: 'Returns the <span class="hl-blue">value</span> associated with field in the hash stored at <span class="hl-blue">key</span>.',
inputs: {
key: 'The has key to be used for the get operation.',
field: 'The field(s) to be used for the set operation.'
},
outputs: {
value: 'The returned value.'
},
controlOutputs: {
error: 'An error was triggered during the send process.'
},
}
}, (inputs, output, control, error) => {
if (!redis) error(new Error('Redis not configured properly.'));
else {
client.hget(inputs.key, inputs.field, function (err, res) {
if(err) {
control('error');
console.error(err);
return ;
}
output('value', res);
});
}
});