本文整理汇总了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
});
}
});
开发者ID:prashanthc97,项目名称:kylo,代码行数:28,代码来源:VisualQueryService.ts
示例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();
}
开发者ID:prashanthc97,项目名称:kylo,代码行数:72,代码来源:connection-dialog.component.ts
示例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);
},
开发者ID:prashanthc97,项目名称:kylo,代码行数:81,代码来源:VisualQueryService.ts
注:本文中的underscore.UnderscoreStatic类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论