本文整理匯總了TypeScript中underscore.UnderscoreStatic類的典型用法代碼示例。如果您正苦於以下問題:TypeScript UnderscoreStatic類的具體用法?TypeScript UnderscoreStatic怎麽用?TypeScript UnderscoreStatic使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了UnderscoreStatic類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
angular.forEach(node.nodeAttributes.attributes, function (attr) {
if (attr.selected) {
// Determine column alias
var alias = _.find(self.getColumnAliases(node.name, attr.name), function (name: any) {
return (aliasCount[name] === 1)
});
if (typeof(alias) === "undefined") {
var i = 0;
do {
++i;
alias = attr.name + "_" + i;
} while (aliasCount[alias] > 0);
aliasCount[alias] = 1;
}
// Add column to target list
targetList.push({
description: attr.description,
name: (alias !== attr.name) ? alias : null,
val: {fields: [table, attr.name]}
});
self.selectedColumnsAndTables_.push({
column: attr.name,
alias: TABLE_PREFIX + node.id, tableName: node.name,
tableColumn: attr.name, dataType: attr.dataType
});
}
});
示例2: constructor
/**
* Constructs a {@code ConnectionDialog}.
*/
constructor($scope: any, $mdDialog: angular.material.IDialogService, isNew: any, connectionDataModel: any, source: any, dest: any) {
$scope.isValid = false;
$scope.connectionDataModel = angular.copy(connectionDataModel);
$scope.source = angular.copy(source);
$scope.dest = angular.copy(dest);
$scope.joinTypes = [{name: "Inner Join", value: "INNER JOIN"}, {name: "Left Join", value: "LEFT JOIN"}, {name: "Right Join", value: "RIGHT JOIN"}];
$scope.isNew = isNew;
if (isNew) {
//attempt to auto find matches
let sourceNames: any = [];
let destNames: any = [];
angular.forEach(source.data.nodeAttributes.attributes, function (attr: any) {
sourceNames.push(attr.name);
});
angular.forEach(dest.data.nodeAttributes.attributes, function (attr: any) {
destNames.push(attr.name);
});
let matches = _.intersection(sourceNames, destNames);
if (matches && matches.length && matches.length > 0) {
let col = matches[0];
if (matches.length > 1) {
if (matches[0] == 'id') {
col = matches[1];
}
}
$scope.connectionDataModel.joinKeys.sourceKey = col;
$scope.connectionDataModel.joinKeys.destKey = col;
$scope.connectionDataModel.joinType = "INNER JOIN"
}
}
$scope.onJoinTypeChange = function () {
// .log('joinType changed')
};
$scope.hide = function () {
$mdDialog.hide();
};
$scope.validate = function () {
$scope.isValid =
$scope.connectionDataModel.joinType != '' && $scope.connectionDataModel.joinType != null && $scope.connectionDataModel.joinKeys.sourceKey != null
&& $scope.connectionDataModel.joinKeys.destKey != null;
};
$scope.save = function () {
connectionDataModel.name = $scope.connectionDataModel.name;
connectionDataModel.joinType = $scope.connectionDataModel.joinType;
connectionDataModel.joinKeys = $scope.connectionDataModel.joinKeys;
$mdDialog.hide('save');
};
$scope.cancel = function () {
$mdDialog.hide('cancel');
};
$scope.delete = function () {
$mdDialog.hide('delete');
};
$scope.validate();
}
示例3: Error
getJoinTree: function (src: any, dst: any, connection: any, graph: any, joinClauses: any) {
var self = this;
// Determine left arg
var larg = (joinClauses.length > 0)
? joinClauses.pop()
: self.getRangeVar(src);
// Use default if missing join keys
if (angular.isUndefined(connection.joinKeys.destKey) || angular.isUndefined(connection.joinKeys.sourceKey) || angular.isUndefined(connection.joinType)) {
joinClauses.push({
type: VisualQueryService.NodeTag.JoinExpr,
jointype: VisualQueryService.JoinType.JOIN,
larg: larg,
rarg: self.getRangeVar(dst),
quals: null
});
return;
}
// Create JOIN clause
graph[dst.id].seen = true;
var joinType;
if (connection.joinType === "INNER JOIN") {
joinType = VisualQueryService.JoinType.JOIN_INNER;
} else if (connection.joinType === "LEFT JOIN") {
joinType = VisualQueryService.JoinType.JOIN_LEFT;
} else if (connection.joinType === "RIGHT JOIN") {
joinType = VisualQueryService.JoinType.JOIN_RIGHT;
} else {
throw new Error("Not a supported join type: " + connection.joinType);
}
var tree: any = {
type: VisualQueryService.NodeTag.JoinExpr,
jointype: joinType,
larg: larg,
rarg: self.getRangeVar(dst),
quals: {
type: VisualQueryService.NodeTag.A_Expr,
name: "=",
lexpr: {
fields: [TABLE_PREFIX + dst.id, (connection.source.nodeID === src.id) ? connection.joinKeys.sourceKey : connection.joinKeys.destKey]
},
rexpr: {
fields: [TABLE_PREFIX + src.id, (connection.source.nodeID === src.id) ? connection.joinKeys.destKey : connection.joinKeys.sourceKey]
}
}
};
// Add conditions for 'seen' tables
_.values(graph[dst.id].edges)
.filter(function (edge: any) {
return (edge != null && edge.source.nodeID !== src.id && graph[edge.source.nodeID].seen && edge.dest.nodeID !== src.id && graph[edge.dest.nodeID].seen);
})
.forEach(function (edge: any) {
var lexpr = tree.quals;
var rexpr = {
type: VisualQueryService.NodeTag.A_Expr,
name: "=",
lexpr: {
fields: [TABLE_PREFIX + edge.source.nodeID, edge.joinKeys.sourceKey]
},
rexpr: {
fields: [TABLE_PREFIX + edge.dest.nodeID, edge.joinKeys.destKey]
}
};
tree.quals = {
type: VisualQueryService.NodeTag.BoolExpr,
boolop: VisualQueryService.BoolExprType.AND_EXPR,
args: [lexpr, rexpr]
};
// Remove join from graph
graph[edge.source.nodeID].edges[edge.dest.nodeID] = null;
graph[edge.dest.nodeID].edges[edge.source.nodeID] = null;
});
joinClauses.push(tree);
},