mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 21:37:32 -08:00
🐛 Fix bug that redis node did not set data #121
This commit is contained in:
parent
6984f21a34
commit
c5b7b7e06d
|
@ -303,9 +303,6 @@ export class Redis implements INodeType {
|
||||||
type = await clientType(keyName);
|
type = await clientType(keyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(keyName + ': ' + type);
|
|
||||||
|
|
||||||
|
|
||||||
if (type === 'string') {
|
if (type === 'string') {
|
||||||
const clientGet = util.promisify(client.get).bind(client);
|
const clientGet = util.promisify(client.get).bind(client);
|
||||||
return await clientGet(keyName);
|
return await clientGet(keyName);
|
||||||
|
@ -394,6 +391,7 @@ export class Redis implements INodeType {
|
||||||
|
|
||||||
} else if (['delete', 'get', 'keys', 'set'].includes(operation)) {
|
} else if (['delete', 'get', 'keys', 'set'].includes(operation)) {
|
||||||
const items = this.getInputData();
|
const items = this.getInputData();
|
||||||
|
const returnItems: INodeExecutionData[] = [];
|
||||||
|
|
||||||
let item: INodeExecutionData;
|
let item: INodeExecutionData;
|
||||||
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
|
||||||
|
@ -405,6 +403,7 @@ export class Redis implements INodeType {
|
||||||
const clientDel = util.promisify(client.del).bind(client);
|
const clientDel = util.promisify(client.del).bind(client);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
await clientDel(keyDelete);
|
await clientDel(keyDelete);
|
||||||
|
returnItems.push(items[itemIndex]);
|
||||||
} else if (operation === 'get') {
|
} else if (operation === 'get') {
|
||||||
const propertyName = this.getNodeParameter('propertyName', itemIndex) as string;
|
const propertyName = this.getNodeParameter('propertyName', itemIndex) as string;
|
||||||
const keyGet = this.getNodeParameter('key', itemIndex) as string;
|
const keyGet = this.getNodeParameter('key', itemIndex) as string;
|
||||||
|
@ -412,6 +411,7 @@ export class Redis implements INodeType {
|
||||||
|
|
||||||
const value = await getValue(client, keyGet, keyType);
|
const value = await getValue(client, keyGet, keyType);
|
||||||
set(item.json, propertyName, value);
|
set(item.json, propertyName, value);
|
||||||
|
returnItems.push(item);
|
||||||
} else if (operation === 'keys') {
|
} else if (operation === 'keys') {
|
||||||
const keyPattern = this.getNodeParameter('keyPattern', itemIndex) as string;
|
const keyPattern = this.getNodeParameter('keyPattern', itemIndex) as string;
|
||||||
|
|
||||||
|
@ -424,23 +424,23 @@ export class Redis implements INodeType {
|
||||||
|
|
||||||
for (const keyName of keys) {
|
for (const keyName of keys) {
|
||||||
promises[keyName] = await getValue(client, keyName);
|
promises[keyName] = await getValue(client, keyName);
|
||||||
console.log(promises[keyName]);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const keyName of keys) {
|
for (const keyName of keys) {
|
||||||
set(item.json, keyName, await promises[keyName]);
|
set(item.json, keyName, await promises[keyName]);
|
||||||
}
|
}
|
||||||
|
returnItems.push(item);
|
||||||
} else if (operation === 'set') {
|
} else if (operation === 'set') {
|
||||||
const keySet = this.getNodeParameter('key', itemIndex) as string;
|
const keySet = this.getNodeParameter('key', itemIndex) as string;
|
||||||
const value = this.getNodeParameter('value', itemIndex) as string;
|
const value = this.getNodeParameter('value', itemIndex) as string;
|
||||||
const keyType = this.getNodeParameter('keyType', itemIndex) as string;
|
const keyType = this.getNodeParameter('keyType', itemIndex) as string;
|
||||||
|
|
||||||
await setValue(client, keySet, value, keyType);
|
await setValue(client, keySet, value, keyType);
|
||||||
|
returnItems.push(items[itemIndex]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(this.prepareOutputData(items));
|
resolve(this.prepareOutputData(returnItems));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue