Azure Functions Storage table bindingsの「ストレージテーブル入力バインド」を読んでください。これにはfunction.json
とNode関数の例があります。
何かがまだ明らかでない場合は、正確な問題を解決してください。
UPDATE:ここ
は、あなたの洗練された問題のための試料溶液です。私はC#でそれを持って、あなたはノードの実装を派生できることを願っています。
csx
#r "Microsoft.WindowsAzure.Storage"
using System;
using System.Net;
using Microsoft.WindowsAzure.Storage.Table;
public class Entity : TableEntity
{
public int num {get; set;}
}
public static HttpResponseMessage Run(HttpRequestMessage req, string partition,
string rowkey, Entity inputEntity, out Entity outputEntity)
{
if (inputEntity == null)
outputEntity = new Entity { PartitionKey = partition, RowKey = rowkey, num = 1};
else
{
inputEntity.num += 1;
outputEntity = inputEntity;
}
return req.CreateResponse(HttpStatusCode.OK, $"Done, num = {outputEntity.num}");
}
function.json
:
{
"bindings": [
{
"authLevel": "function",
"name": "req",
"type": "httpTrigger",
"direction": "in",
"route": "HttpTriggerTableUpdate/{partition}/{rowkey}"
},
{
"name": "$return",
"type": "http",
"direction": "out"
},
{
"type": "table",
"name": "inputEntity",
"tableName": "MyTable",
"partitionKey": "{partition}",
"rowKey": "{rowkey}",
"connection": "my_STORAGE",
"direction": "in"
},
{
"type": "table",
"name": "outputEntity",
"tableName": "MyTable",
"partitionKey": "{partition}",
"rowKey": "{rowkey}",
"connection": "my_STORAGE",
"direction": "out"
}
],
"disabled": false
}
リンクは紺碧の機能バインディングNode.jsの使用紺碧・テーブル内のエンティティを削除/更新/照会する方法を提供していません。そのためのコードスニペットを提供できますか?また、リンクhttps://stackoverflow.com/questions/42492777/how-to-update-a-azure-table-row-in-azure-function-using-bindings同じ問題に対処します。このための回避策はありますか? – sameeksha
replaceEntityなどの標準的なazure-tableメソッドshow error – sameeksha
@sameeksha任意のクエリ/削除などが必要な場合は、関数バインディングの直接の助けを借りて手動で行う必要があります。私はあなたに指定されていないタスクのスニペットを与えることはできません。 – Mikhail