drizzle-orm
Advanced tools
Comparing version 0.10.22 to 0.10.23
@@ -9,4 +9,7 @@ "use strict"; | ||
const nextPosition = position || 1; | ||
const query = `"${this._column.getColumnName()}"=${this._value === null || this._value === undefined ? 'null' : `$${nextPosition}`}`; | ||
return { query, values: [this._column.getColumnType().insertStrategy(this._value)] }; | ||
const valueToInsert = this._value === null || this._value === undefined | ||
? this._value | ||
: this._column.getColumnType().insertStrategy(this._value); | ||
const query = `"${this._column.getColumnName()}"=$${nextPosition}`; | ||
return { query, values: [valueToInsert] }; | ||
}; | ||
@@ -13,0 +16,0 @@ this._column = column; |
@@ -20,3 +20,4 @@ "use strict"; | ||
Table name: ${tableName} | ||
Filter query: ${filter ? filter.toQuery() : 'undefined'} | ||
Filter query: ${filter ? filter.toQuery().query : 'undefined'} | ||
Values: ${filter ? filter.toQuery().values : 'undefined'} | ||
Column names: ${columns.map((column) => column.getColumnName()).join(', ')}\n-----\n`; | ||
@@ -23,0 +24,0 @@ } |
{ | ||
"name": "drizzle-orm", | ||
"version": "0.10.22", | ||
"version": "0.10.23", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
117
test.js
"use strict"; | ||
// import DbConnector from './db/dbConnector'; | ||
// import CitiesTable from './docs/tables/citiesTable'; | ||
// import UsersTable from './docs/tables/usersTable'; | ||
// import ConsoleLogger from './logger/consoleLogger'; | ||
// import MigrationSerializer from './serializer/serializer'; | ||
// import AbstractTable from './tables/abstractTable'; | ||
// (async () => { | ||
// try { | ||
// const db = await new DbConnector() | ||
// .connectionString('postgresql://postgres@127.0.0.1/migrator') | ||
// .connect(); | ||
// const usersTable = new UsersTable(db); | ||
// const citiesTable = new CitiesTable(db); | ||
// db.useLogger(new ConsoleLogger()); | ||
// const res = await usersTable.select() | ||
// // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
// .leftJoin(CitiesTable, (table) => table.id, (table) => table.id) | ||
// // .leftJoin(CitiesTable, UsersTable, (table) => table.userId, (table) => table.id) | ||
// // .leftJoin(UsersTable, UsersTable, (table) => table.id, (table) => table.id) | ||
// .execute(); | ||
// // const ser = new MigrationSerializer(); | ||
// // const res = ser.generate([usersTable as AbstractTable<UsersTable>], []); | ||
// // console.log(JSON.stringify(res, null, 2)); | ||
// // const f = { | ||
// // id: count(usersTable.id), | ||
// // }; | ||
// // type d = ExtractModel<typeof f>; | ||
// // const res = await usersTable.select({ | ||
// // piska: count(), | ||
// // mongodibil: count(usersTable.phone), | ||
// // }) | ||
// // .where({ | ||
// // piska: eq(), | ||
// // mongodibil: eq(usersTable.phone), | ||
// // }).leftJoin(UsersTable, (table) => table.id, (table) => table.id) | ||
// // .leftJoin(UsersTable, UsersTable, (table) => table.id, (table) => table.id) | ||
// // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
// // .orderBy((table, join1, join2, join3) => [{table.id}, join1.id, join1.phone]) | ||
// // .execute(); | ||
// // const res = await usersTable.select() | ||
// // // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
// // .leftJoin(UsersTable, (table) => table.foundationDate, (table) => table.id) | ||
// // .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id) | ||
// // .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id) | ||
// // // .groupBy({ | ||
// // // usersTable: usersTable.id, | ||
// // // firstJoin: [usersTable.id], | ||
// // // secondJoin: usersTable.id, | ||
// // // thirdJoin: usersTable.id, | ||
// // // }) | ||
// // .execute(); | ||
// // console.log(res); | ||
// } catch (e) { | ||
// console.log(e); | ||
// } | ||
// })(); | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const static_1 = require("./builders/requestBuilders/where/static"); | ||
const dbConnector_1 = require("./db/dbConnector"); | ||
const citiesTable_1 = require("./docs/tables/citiesTable"); | ||
const usersTable_1 = require("./docs/tables/usersTable"); | ||
const consoleLogger_1 = require("./logger/consoleLogger"); | ||
(async () => { | ||
try { | ||
const db = await new dbConnector_1.default() | ||
.connectionString('postgresql://postgres@127.0.0.1/migrator') | ||
.connect(); | ||
const usersTable = new usersTable_1.default(db); | ||
const citiesTable = new citiesTable_1.default(db); | ||
db.useLogger(new consoleLogger_1.default()); | ||
const phone = undefined; | ||
const res = await usersTable.update() | ||
// .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
.where(static_1.eq(usersTable.id, 16)) | ||
.set({ | ||
phone, | ||
}) | ||
// .leftJoin(CitiesTable, UsersTable, (table) => table.userId, (table) => table.id) | ||
// .leftJoin(UsersTable, UsersTable, (table) => table.id, (table) => table.id) | ||
.execute(); | ||
// const ser = new MigrationSerializer(); | ||
// const res = ser.generate([usersTable as AbstractTable<UsersTable>], []); | ||
// console.log(JSON.stringify(res, null, 2)); | ||
// const f = { | ||
// id: count(usersTable.id), | ||
// }; | ||
// type d = ExtractModel<typeof f>; | ||
// const res = await usersTable.select({ | ||
// piska: count(), | ||
// mongodibil: count(usersTable.phone), | ||
// }) | ||
// .where({ | ||
// piska: eq(), | ||
// mongodibil: eq(usersTable.phone), | ||
// }).leftJoin(UsersTable, (table) => table.id, (table) => table.id) | ||
// .leftJoin(UsersTable, UsersTable, (table) => table.id, (table) => table.id) | ||
// .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
// .orderBy((table, join1, join2, join3) => [{table.id}, join1.id, join1.phone]) | ||
// .execute(); | ||
// const res = await usersTable.select() | ||
// // .groupBy((table, join1, join2, join3) => [table.id, join1.id, join1.phone]) | ||
// .leftJoin(UsersTable, (table) => table.foundationDate, (table) => table.id) | ||
// .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id) | ||
// .leftJoin(UsersTable, UsersTable, (table) => table.role, (table) => table.id) | ||
// // .groupBy({ | ||
// // usersTable: usersTable.id, | ||
// // firstJoin: [usersTable.id], | ||
// // secondJoin: usersTable.id, | ||
// // thirdJoin: usersTable.id, | ||
// // }) | ||
// .execute(); | ||
// console.log(res); | ||
} | ||
catch (e) { | ||
console.log(e); | ||
} | ||
})(); |
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
278137
5678