Comparing version 0.0.3 to 0.0.4
@@ -17,4 +17,4 @@ /* UNIQORM | ||
constructor() { | ||
super(); | ||
constructor(cfg) { | ||
super(cfg); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -17,4 +17,4 @@ /* UNIQORM | ||
constructor() { | ||
super(); | ||
constructor(cfg) { | ||
super(cfg); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -17,4 +17,4 @@ /* UNIQORM | ||
constructor(...args) { | ||
super(...args); | ||
constructor(cfg) { | ||
super(cfg); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -17,4 +17,4 @@ /* UNIQORM | ||
constructor() { | ||
super(); | ||
constructor(cfg) { | ||
super(cfg); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -17,4 +17,4 @@ /* UNIQORM | ||
constructor() { | ||
super(); | ||
constructor(cfg) { | ||
super(cfg); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -17,4 +17,4 @@ /* UNIQORM | ||
constructor() { | ||
super(); | ||
constructor(cfg) { | ||
super(cfg); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -118,2 +118,7 @@ /* UNIQORM | ||
}); | ||
Object.defineProperty(ctor.prototype, '_relations', { | ||
value: [], | ||
writable: false, | ||
configurable: false | ||
}); | ||
return ctor; | ||
@@ -143,3 +148,3 @@ }; | ||
const relation = new RelationO2O(this, field, model, pk); | ||
(this.prototype._relations = this.prototype._relations || []).push(relation); | ||
this.prototype._relations.push(relation); | ||
return relation; | ||
@@ -146,0 +151,0 @@ }; |
@@ -74,2 +74,12 @@ /* UNIQORM | ||
offset(value) { | ||
this._offset = value; | ||
return this; | ||
} | ||
limit(value) { | ||
this._limit = value; | ||
return this; | ||
} | ||
/** | ||
@@ -82,3 +92,3 @@ * @private | ||
const model = self.model; | ||
const database = model.schema.dbPool; | ||
const database = model.schema.owner.dbPool; | ||
const defaultSchema = database.schema; | ||
@@ -103,2 +113,5 @@ const schema = model.schema.name && | ||
for (const item of selFields) { | ||
if (item === 'KOZA_BITIS_TARIHI') { | ||
let a = 1; | ||
} | ||
const f = model.getFieldInfo(item); | ||
@@ -170,6 +183,10 @@ assert(f, `Field (${item}) is not defined in model (${model.name})`); | ||
} | ||
if (self._limit) | ||
statement.limit(self._limit); | ||
if (self._offset) | ||
statement.offset(self._offset); | ||
//console.log(statement.build(database)); | ||
/*console.log('--------'); | ||
console.log(dbPool.serializer.build(statement).sql); | ||
console.log('--------');*/ | ||
console.log(database.serializer.build(statement).sql); | ||
console.log('--------');*/ | ||
return statement; | ||
@@ -176,0 +193,0 @@ } |
@@ -29,2 +29,3 @@ /* UNIQORM | ||
self.dbPool = dbPool; | ||
self.defaultSchema = undefined; | ||
@@ -51,3 +52,3 @@ /* Create a case in sensitive map*/ | ||
self.schemas[defaultSchemaSymbol] = new Schema(this, ''); | ||
self.schemas[self.defaultSchema || defaultSchemaSymbol] = new Schema(this, ''); | ||
} | ||
@@ -59,8 +60,15 @@ | ||
* | ||
* @param {string} name | ||
* @param {string} [schemaName] | ||
* @param {string} modelName | ||
* @return {Model} | ||
* @public | ||
*/ | ||
create(name) { | ||
const ctor = this.getModel(name); | ||
create(schemaName, modelName) { | ||
if (!modelName) { | ||
modelName = schemaName; | ||
schemaName = undefined; | ||
} | ||
const ctor = this.getModel(schemaName, modelName); | ||
assert(ctor, `Model not found ${schemaName ? schemaName + '.' + | ||
modelName : modelName}`); | ||
return Reflect.construct(ctor, []); | ||
@@ -77,3 +85,3 @@ } | ||
getSchema(schemaName) { | ||
return this.schemas[schemaName || defaultSchemaSymbol]; | ||
return this.schemas[schemaName || this.defaultSchema || defaultSchemaSymbol]; | ||
} | ||
@@ -80,0 +88,0 @@ |
{ | ||
"name": "uniqorm", | ||
"description": "Easy to use, multi-dialect ORM framework for JavaScript", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": "Panates Ltd.", | ||
@@ -30,3 +30,3 @@ "contributors": [ | ||
"babel-eslint": "^7.2.3", | ||
"eslint": "^3.19.0", | ||
"eslint": "^4.0.0", | ||
"eslint-config-google": "^0.8.0", | ||
@@ -33,0 +33,0 @@ "istanbul": "^0.4.5", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
47427
1666
0