fewer
Version:
A minimal ORM for Node.js.
40 lines • 1.22 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ColumnType_1 = __importDefault(require("../ColumnType"));
exports.ColumnType = ColumnType_1.default;
class SchemaTable {
constructor(database, name, config, builder) {
this.database = database;
this.name = name;
this.config = config;
this.primaryKey = config.primaryKey;
}
}
"@@INTERNAL_TYPE" /* INTERNAL_TYPE */;
exports.SchemaTable = SchemaTable;
class Schema {
constructor(version, tables = {}) {
this.version = version;
this.tables = tables;
}
/**
* TODO: Documentation.
*/
table(database, name, config, builder) {
const table = new SchemaTable(database, name, config, builder);
// @ts-ignore TODO:
return new Schema(this.version, Object.assign({}, this.tables, { [name]: table }));
}
}
exports.Schema = Schema;
/**
* TODO: Documentation.
*/
function createSchema(version) {
return new Schema(version);
}
exports.createSchema = createSchema;
//# sourceMappingURL=index.js.map