{"version":3,"sources":["../browser/src/schema-builder/view/View.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH;IAiBI,4EAA4E;IAC5E,cAAc;IACd,4EAA4E;IAE5E,cAAY,OAAqB;QAC7B,IAAI,OAAO,EAAE;YACT,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;YACzB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;SACxC;IACL,CAAC;IAED,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACH,oBAAK,GAAL;QACI,OAAO,IAAI,IAAI,CAAe;YAC1B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;SAC9B,CAAC,CAAC;IACP,CAAC;IAED,4EAA4E;IAC5E,iBAAiB;IACjB,4EAA4E;IAE5E;;OAEG;IACI,WAAM,GAAb,UAAc,cAA8B,EAAE,MAAc;QACxD,IAAM,OAAO,GAAgB;YACzB,IAAI,EAAE,MAAM,CAAC,cAAc,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC;YACrG,UAAU,EAAE,cAAc,CAAC,UAAW;SACzC,CAAC;QAEF,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAEL,WAAC;AAAD,CA1DA,AA0DC,IAAA","file":"View.js","sourcesContent":["import {Connection, Driver, SelectQueryBuilder} from \"../..\";\nimport {EntityMetadata} from \"../..\";\nimport {ViewOptions} from \"../options/ViewOptions\";\n\n/**\n * View in the database represented in this class.\n */\nexport class View {\n\n // -------------------------------------------------------------------------\n // Public Properties\n // -------------------------------------------------------------------------\n\n /**\n * Contains database name, schema name and table name.\n * E.g. \"myDB\".\"mySchema\".\"myTable\"\n */\n name: string;\n\n /**\n * View definition.\n */\n expression: string|((connection: Connection) => SelectQueryBuilder<any>);\n\n // -------------------------------------------------------------------------\n // Constructor\n // -------------------------------------------------------------------------\n\n constructor(options?: ViewOptions) {\n if (options) {\n this.name = options.name;\n this.expression = options.expression;\n }\n }\n\n // -------------------------------------------------------------------------\n // Public Methods\n // -------------------------------------------------------------------------\n\n /**\n * Clones this table to a new table with all properties cloned.\n */\n clone(): View {\n return new View(<ViewOptions> {\n name: this.name,\n expression: this.expression,\n });\n }\n\n // -------------------------------------------------------------------------\n // Static Methods\n // -------------------------------------------------------------------------\n\n /**\n * Creates view from a given entity metadata.\n */\n static create(entityMetadata: EntityMetadata, driver: Driver): View {\n const options: ViewOptions = {\n name: driver.buildTableName(entityMetadata.tableName, entityMetadata.schema, entityMetadata.database),\n expression: entityMetadata.expression!,\n };\n\n return new View(options);\n }\n\n}\n"],"sourceRoot":"../.."}
|