當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript model.SchemaNode.getChildren方法代碼示例

本文整理匯總了TypeScript中@connections/shared/schema-node.model.SchemaNode.getChildren方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript model.SchemaNode.getChildren方法的具體用法?TypeScript model.SchemaNode.getChildren怎麽用?TypeScript model.SchemaNode.getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@connections/shared/schema-node.model.SchemaNode的用法示例。


在下文中一共展示了model.SchemaNode.getChildren方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

  it("should create, root with 3 levels", () => {
    console.log("========== [SchemaNode] should create, root with 3 levels");
    schemaNode = SchemaNode.create(
      {
        "name": "myCatalog",
        "type": "catalog",
        "path": "catalog=myCatalog",
        "connectionName": "conn1",
        "queryable": false,
        "children": [
          {
            "name": "mySchema1",
            "type": "schema",
            "path": "catalog=myCatalog/schema=mySchema1",
            "connectionName": "conn1",
            "queryable": false,
            "children": [
              {
                "name": "myTable1",
                "type": "table",
                "path": "catalog=myCatalog/schema=mySchema1/table=myTable1",
                "connectionName": "conn1",
                "queryable": true,
                "children": []
              },
              {
                "name": "myTable2",
                "type": "table",
                "path": "catalog=myCatalog/schema=mySchema1/table=myTable2",
                "connectionName": "conn1",
                "queryable": true,
                "children": []
              }
            ]
          },
          {
            "name": "mySchema2",
            "type": "schema",
            "path": "catalog=myCatalog/schema=mySchema2",
            "connectionName": "conn1",
            "queryable": false,
            "children": [
              {
                "name": "myTableA",
                "type": "table",
                "path": "catalog=myCatalog/schema=mySchema2/table=myTableA",
                "connectionName": "conn1",
                "queryable": true,
                "children": []
              },
              {
                "name": "myTableB",
                "type": "table",
                "path": "catalog=myCatalog/schema=mySchema2/table=myTableB",
                "connectionName": "conn1",
                "queryable": true,
                "children": []
              },
              {
                "name": "myTableC",
                "type": "table",
                "path": "catalog=myCatalog/schema=mySchema2/table=myTableC",
                "connectionName": "conn1",
                "queryable": true,
                "children": []
              }
            ]
          },
        ],
      });

    // Root Node (myCatalog)
    expect(schemaNode.getName()).toEqual("myCatalog");
    expect(schemaNode.getType()).toEqual("catalog");
    expect(schemaNode.getPath()).toEqual("catalog=myCatalog");
    expect(schemaNode.getConnectionName()).toEqual("conn1");
    expect(schemaNode.isQueryable()).toEqual(false);
    expect(schemaNode.getMaxLevels()).toEqual(3);
    expect(schemaNode.getChildren().length).toEqual(2);

    // Root Child 1 (mySchema1)
    const schema1: SchemaNode = schemaNode.getChildren()[0];
    expect(schema1.getName()).toEqual("mySchema1");
    expect(schema1.getType()).toEqual("schema");
    expect(schema1.getPath()).toEqual("catalog=myCatalog/schema=mySchema1");
    expect(schema1.getConnectionName()).toEqual("conn1");
    expect(schema1.isQueryable()).toEqual(false);
    expect(schema1.getMaxLevels()).toEqual(2);
    expect(schema1.getChildren().length).toEqual(2);

    // Root Child 2 (mySchema2)
    const schema2: SchemaNode = schemaNode.getChildren()[1];
    expect(schema2.getName()).toEqual("mySchema2");
    expect(schema2.getType()).toEqual("schema");
    expect(schema2.getPath()).toEqual("catalog=myCatalog/schema=mySchema2");
    expect(schema2.getConnectionName()).toEqual("conn1");
    expect(schema2.isQueryable()).toEqual(false);
    expect(schema2.getMaxLevels()).toEqual(2);
    expect(schema2.getChildren().length).toEqual(3);

//.........這裏部分代碼省略.........
開發者ID:tejones,項目名稱:beetle-studio,代碼行數:101,代碼來源:schema-node.model.spec.ts


注:本文中的@connections/shared/schema-node.model.SchemaNode.getChildren方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。