@spinajs/orm-sqlite
Advanced tools
Comparing version 1.0.8 to 1.0.9
import { SqlColumnQueryCompiler, SqlTableQueryCompiler } from "@spinajs/orm-sql"; | ||
import { ICompilerOutput } from "@spinajs/orm"; | ||
import { ICompilerOutput, OrderByBuilder, OrderByQueryCompiler } from "@spinajs/orm"; | ||
export declare class SqliteOrderByCompiler extends OrderByQueryCompiler { | ||
protected _builder: OrderByBuilder; | ||
constructor(builder: OrderByBuilder); | ||
compile(): ICompilerOutput; | ||
} | ||
export declare class SqliteTableQueryCompiler extends SqlTableQueryCompiler { | ||
@@ -4,0 +9,0 @@ compile(): ICompilerOutput; |
@@ -8,6 +8,37 @@ "use strict"; | ||
}; | ||
var __metadata = (this && this.__metadata) || function (k, v) { | ||
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const orm_sql_1 = require("@spinajs/orm-sql"); | ||
const orm_1 = require("@spinajs/orm"); | ||
const di_1 = require("@spinajs/di"); | ||
const _ = require("lodash"); | ||
let SqliteOrderByCompiler = class SqliteOrderByCompiler extends orm_1.OrderByQueryCompiler { | ||
constructor(builder) { | ||
super(); | ||
if (!builder) { | ||
throw new Error('builder cannot be null or undefined'); | ||
} | ||
this._builder = builder; | ||
} | ||
compile() { | ||
const sort = this._builder.getSort(); | ||
let stmt = ''; | ||
const bindings = []; | ||
if (sort) { | ||
stmt = ` ORDER BY ? ${sort.order.toLowerCase() === "asc" ? "ASC" : "DESC"}`; | ||
bindings.push(sort.column); | ||
} | ||
return { | ||
bindings, | ||
expression: stmt, | ||
}; | ||
} | ||
}; | ||
SqliteOrderByCompiler = __decorate([ | ||
di_1.NewInstance(), | ||
__metadata("design:paramtypes", [orm_1.OrderByBuilder]) | ||
], SqliteOrderByCompiler); | ||
exports.SqliteOrderByCompiler = SqliteOrderByCompiler; | ||
let SqliteTableQueryCompiler = class SqliteTableQueryCompiler extends orm_sql_1.SqlTableQueryCompiler { | ||
@@ -14,0 +45,0 @@ compile() { |
@@ -93,2 +93,3 @@ "use strict"; | ||
this.Container.register(compilers_1.SqliteTableQueryCompiler).as(orm_1.TableQueryCompiler); | ||
this.Container.register(compilers_1.SqliteOrderByCompiler).as(orm_1.OrderByQueryCompiler); | ||
} | ||
@@ -95,0 +96,0 @@ async transaction(qrOrCallback) { |
{ | ||
"name": "@spinajs/orm-sqlite", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "SpinaJS orm sqlite support. Contains sqlite driver.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23220
342