本文整理匯總了TypeScript中@arangodb/general-graph._graph函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript _graph函數的具體用法?TypeScript _graph怎麽用?TypeScript _graph使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了_graph函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: String
var action = String(function (args) {
var gm = require("@arangodb/general-graph");
var graph = gm._graph('partyGraph');
var _ = require('underscore');
var party = graph.party.save(_.omit(args[0], 'members'));
graph.member.save(party._id, args[1]._id, { admin: true });
return party;
});
示例2: String
var action = String(function (args) {
var gm = require("@arangodb/general-graph");
var graph = gm._graph('qaGraph');
var _ = require('underscore');
var questionData = _.pick(args[0], 'title', 'options');
questionData.updatedAt = new Date();
return graph.question.update(args[0]._key, questionData);
});
示例3: String
var action = String(function (args) {
var gm = require("@arangodb/general-graph");
var graph = gm._graph('qaGraph');
var _ = require('underscore');
var answerData = _.pick(args[0], 'chosen', 'opinion');
answerData.updatedAt = new Date();
return graph.answer.update(args[0]._key, answerData);
});
示例4: String
var action = String(function (args) {
var gm = require("@arangodb/general-graph");
var graph = gm._graph('userGraph');
var _ = require('underscore');
var userData = _.omit(args[0],
(v, k) => _.isUndefined(v, k) || k === 'location');
var user = graph.user.update(userData._key, userData);
if (args[0].location) {
userData._id = 'user/' + userData._key;
args[0].location._id = 'location/' + args[0].location._key;
graph.livesIn.removeByExample({ _from: userData._id });
graph.livesIn.save(userData._id, args[0].location._id, {});
}
return user;
});