當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。