当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript UnderscoreStatic.values方法代码示例

本文整理汇总了TypeScript中underscore.UnderscoreStatic.values方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UnderscoreStatic.values方法的具体用法?TypeScript UnderscoreStatic.values怎么用?TypeScript UnderscoreStatic.values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在underscore.UnderscoreStatic的用法示例。


在下文中一共展示了UnderscoreStatic.values方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

    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.values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。