54 Commits

Author SHA1 Message Date
Arthur Peruzzo
0d082463ce
docs: Update select-query-builder.md (#10763)
Crystal Maiden, not Cristal.
2025-01-20 21:20:49 +01:00
YoungKi Lyu
c1ff5d3fa5
docs: add Lock tables in Set Locking (#10921) 2025-01-05 21:42:55 +01:00
Felipe Pena
6fe7afa747
docs: Update select-query-builder.md (#11120) 2025-01-05 21:24:10 +01:00
Victor Domene Gimeno
30f801f9f0
docs: Update select-query-builder.md (#11166)
change row by column y description
2024-12-30 09:27:45 +01:00
Esdras Rodrigues do Carmo
d3a2e53801
docs: fix table of contents missing sections (#10625) 2024-01-26 10:33:15 +05:00
seungwonleee
c8ec5429eb
docs: update select-query-builder.md (#10520)
To use alias as the first argument in the createQueryBuilder method, the entity must be imported into the getRepository method to be used.
2023-12-29 13:11:16 +05:00
Mohammad Rayyan
35a3a7f049
docs: added missing import in select-query-builder.md (#10385)
The example for the deleteAt was missing from the import in example of soft delete
2023-09-30 14:44:06 +05:00
Mohammad Rayyan
6378b21119
docs: update select-query-builder.md (#10297)
In the line 315 there was a mistake due to which the technical sense of the sentence was lost. I corrected the typo.
2023-09-02 14:49:44 +05:00
JT Smith
98f22052be
docs: added a documentation section on debugging query builder (#9846)
* Added a section on debugging query builder

It covers using getQuery() and getQueryAndParameters() which are both useful when trying to figure out why your query isn't doing what you might expect it should do.

* forgot await

* fix typo
2023-04-05 15:55:10 +05:00
JT Smith
f7b210bedb
docs: documented getCount() method (#9847)
* documented getCount()

getCount() is currently only mentioned in the documentation once, and you're never shown how to use it. This patch adds a little documentation for getCount()

* clarification
2023-04-05 15:42:30 +05:00
Mattias Fjellvang
defb409f56
feat: support time travel queries, upsert, enums, spatial types in cockroachdb (#9128)
* feature: adds support for enum type (fixes #9068)

* temporarily ran package to test on different repo

* playing around - bumped version

* Revert "playing around - bumped version"

This reverts commit 7df4adb3e698419c174c2daee88614f8dafdbb6c.

* Revert "temporarily ran package to test on different repo"

This reverts commit 48f394e8eb32c22fe757010b446c85740bf80b5f.

* feat: add support for geometry data type

* feature: properly hydrate enum array values

* feature: adds support for geography and geometry for cockroachdb

* bugfix: fixes issue with primary generated columns being invalid column type (fixes #8532)

* Revert "bugfix: fixes issue with primary generated columns being invalid column type (fixes #8532)"

This reverts commit e00cdb090638d34668e3e10acd5f8267fe3bd028.

* bugfix: type casts to string when using ANY

* feature: cast geometry/geography to geojson

* feature: added references to srid

* bugfix: prevent error if trying to close already closed connection

* feature: added cockrachodb as part of postgres family

* feature: ensures support for spatial columns for cockroachdb

* feature: adds support for UPSERT for CockroachDB (fixes #9199)

* minor: added TODO; unsure how to achieve this

* feature: adds support for time travelling queries for cockroachdb

* bugfix: only run time travel query on SELECT statements

* refactor: changed UsertType from 'upsert' to 'primary-key' since this is more logical

* feature: added posibility to set timeTravelQuery to false, instead of the parameter function; help for disabling time travel queries during tests

* feature: allow timeTravelQueries in find* queries

* bugfix: when using timetravel queries with joinAttributes it now prevents error 'AS OF SYSTEM TIME must be in top level' error

* lint

* minor fix

* fixed failing test

* implemented ENUM type;
added tests;

* fixed failing tests

* fixed failing test

* fixed spatial types synchronization;
implemented spatial indices;
added tests for spatial columns;

* refactored Time Travel Query functionality;
removed TTQ from find options;
added tests for TTQ;

* added docs for Time Travel Queries

* minor changes

* added GeoJSON types;
other minor fixes;

* updated docs

* updated docs

Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
2023-01-03 19:25:22 +05:00
r-shirasu
648222a006
docs: correct typo (#9655) 2022-12-27 14:08:30 +05:00
Taylor Hakes
68e8f22894
feat: add setOnLocked for SKIP LOCKED and NOWAIT (#9317) 2022-08-26 00:24:16 +05:00
Umed Khudoiberdiev
7198a7a732
Revert "feat: add array parameter on groupBy (#9243)" (#9320)
This reverts commit 77866d85d20991930f55000cd5d4e340c68930b4.
2022-08-24 22:49:15 +05:00
wirekang
77866d85d2
feat: add array parameter on groupBy (#9243)
* feat: add array parameter on groupBy

* docs: add groupBy(string[])
2022-08-24 21:36:24 +05:00
Marouane
a145f0046d
docs: fix code indentation (#8864)
bad indentation break syntax highlighting.
2022-04-11 21:14:38 +05:00
Daniel Hritzkiv
68a5c23077
docs: update select-query-builder.md (#8787)
InsertQueryBuilder should not `await`ed when passed into `addCommonTableExpression`
2022-03-23 23:39:18 +05:00
Michał Wadas
7cc1848fd4
feat: support for Common Table Expressions (#8534)
* feat: support for Common Table Expressions

Resolves #1116 #5899

* test: disable test for #4753 if no MySQL is present in ormconfig.json
2022-03-23 18:29:45 +05:00
Umed Khudoiberdiev
3b8a031ece
0.3.0 (#8616)
* added find options and new option relationLoadStrategy

* find now returns null instead of undefined; removed primary relations support; bugfixing; added some changes and tests from next branch;

* added typename to connection options; added data loader types, lot of deprecations; new es2020 emit by tsc; new custom repositories syntax

* applied lint fixing

* replaced some instanceof checks

* reverting docker compose image versions

* optimizing imports

* reverting back some instanceof checks to prevent compiler errors

* downgrading es compilation version

* docs: remove "primary" from relation options (#8619)

remove ex-line 26 for being deprecated in 0.3.0:
"* `primary: boolean` - Indicates whether this relation's column will be a primary column or not."

* Revert "reverting back some instanceof checks to prevent compiler errors"

This reverts commit 7bf12a39e2297d097aa2a42989afd0e9e4f49bb0.

* Revert "optimizing imports"

This reverts commit 7588ac14e4f1bf1a82e3b7883134b9c2c8ae5f3f.

* Revert "replaced some instanceof checks"

This reverts commit bfa5a2d706f697ed1c1beb38b4455c0d33121e5a.

* fixing few comments

* removing transaction decorators

* this test is invalid - it's not clear why the hell getTreeRepository will throw an error and it's not clear what kind of error its going to throw

* addded mixed list support in connection options

* trying to fix oracle length issue

* lintfix

* removed shorten usages

* added named entity target support to the connection

* fixing entity target support in relation options via entity schema

* debugging oracle issue

* fixed issue with alias not being shortened in many to many alias cases

* some day we'll have a prettier.

* fixing oracle tests

* fixing oracle failing test

* removed "null" support in where expressions; fixed softDelete and restore incorrect usages

* renamed FindConditions to FindOptionsWhere

* version bump

* docs: update loading relation in find method (v 0.3.0) (#8621)

* docs: update relation definition method

Update the method that allows loading a specific relation inside the find method.
This method is found on the one-to-one-relations page.
Change `const users = await userRepository.find({ relations: ["profile"] });` to `const users = await userRepository.find({ relations: {profile: true});`.

* fix formatting

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>

* docs: change relations option definition (#8620)

* docs: change relations option definition

change line 139 from 
`const users = await connection.getRepository(User).find({ relations: ["profile", "photos", "videos"] });`
to
`const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });`
to reflect version 0.3.0 changes

* docs: change relations option definition

Rectified a type on line 139
from:
`const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true] });`
to
`const users = await connection.getRepository(User).find({ relations: { profile: true, photos: true, videos: true} });`

* formatting

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>

* lint

* improved find options types

* fixed types and removed nonnever because it causes circual issue for some reason

* docs: update entitymanager definition (#8623)

* docs: update entitymanager definition

change the "What is EntityManager?" page to be up-to-date with v 0.3.0

1. line 6 changes from
`You can access the entity manager via 'getManager()' or from 'Connection'.`
to 
`You can access the entity manager via DataSource's manager.`

2. the import on `getManager` in line 10 becomes `Manager` that the user have configured beforehand:
`import {getManager} from "typeorm";`
becomes 
`import {Manager} from "./config/DataSource";`

3.change entityManager definition in line 13:
from
`const entityManager = getManager(); // you can also get it via getConnection().manager`
to
`const entityManager = Manager;`

* docs: update entitymanager definition

changed line 10 from: 
`import {Manager} from "./config/DataSource";`
to
`import {DataSource} from "typeorm";`

and changed line 13 and 14 from: 
`const entityManager = Manager;`
`const user = await entityManager.findOne(User, 1);`
to 
`const myDataSource = new DataSource({ /*...*/ });`
`const user = await myDataSource.manager.findOne(User, 1);`

for a simpler way of describing the origin of DataSource and how it works.

* In return type doesn't seem to work in all cases

* feat: mssql v7 support (#8592)

Adds support for v7 of the mssql library as v6 is EOL. This also makes use of the new toReadableStream method on requests to return a native stream where required.

* fix: prefix relation id columns contained in embedded entities (#6977) (#7432)

* fix: prefix relation id columns contained in embedded entities (#6977)

Searches embedded entity columns for relation ID column if relation column
is in embedded entity. If not found, creates new relation ID with embedded
metadata set to match the relation column.

fixes: #2254
fixes: #3132
fixes: #3226
fixes: #6977

* test: prefix subcounters sub-entity with "sub" to fit in 30 character identifier for oracle

Problem introduced with #6981

* fix: find by Date object in sqlite driver (#7538)

* fix: find by Date object in sqlite driver

In sqlite, Date objects are persisted as UtcDatetimeString.
But a Date object parameter was escaped with .toISOString(), making such queries impossible.
This commit aligns both transforms.
This bug does *not* apply to better-sql where you can only bind numbers, strings, bigints, buffers,
and null.
This is breaking for when the user inserted their dates manually as ISO and relied on this old
maltransformation, after this their find()s by Date won't work anymore.

BREAKING CHANGE: Change Date serialization in selects
Closes: #2286

* add failing test

* fix: find by Date object in sqlite driver (with query builder)

Also consider query builder parameter escaping

* test: add test for 3426

Co-authored-by: James Ward <james@notjam.es>

* manually ported changes from #7796

* updated changelog

* fixes after merge

* new findOne syntax

* new find* syntax

* new find* syntax

* lint

* tsc version bump

* tsc version bump and fixed mongodb issues

* moved date fns into non dev deps

* returned oracledb dep into place

* removed lock files

* returned lock files back

* eslint upgrade

* fixing mongodb issue

* fixing mongodb issue

* test: keep junction aliases short (#8637)

Tests a fix for an issue where junction aliases (e.g. in many-to-many relations)
are not unique because they are too long and thus truncated by the driver.

Closes: #8627
Related to: 76cee41dcf1c146d02715c7f48fed33672d28c67

* fixing mongodb issues

* fixing sqlite test

* fixing sqlite test

* fixing sqlite test

* fixing mongodb test

* fixing entity schema tests

* fixing entity schema tests

* merged latest master

* removed driver instanceof checks

* removed function instanceof checks

* removed Object instanceof checks

* removing instanceof checks...

* fixing instanceof checks

* added InstanceChecker to remove remaining instanceof checks

* fixed failing test

* linting

* fixing failing test

* version bump

* compiler fixes

* Connection type usages replace to DataSource

* updated dev deps

* updated deps, add prettier, removed oracledb due to m1 issue

* chalk downgrade

* fixing failing test

* applied prettier formatting

* replaced eslint to prettier

* okay I think we can call it lint

* fixing linting

* fixed prettier introduced compiler bug

* fixed failing test

* prettier;

* fixed failing test

* alias shortening only for junction tables;
fixed failing tests;

* changed aurora db names and reverted change of junction table name shorten algorithm

* format

* removed platform from docker compose

* made numeric parameters to not use parameters to prevent parameters number limit issue. Also enabled shorten only for junction tables

* fixing test

* fixing returning columns bugs

* fixing test

* fixed returning issue

* fixing merge conflicts

* updating documentation

* working on docs / improving api

* working on docs

* fixed isConnected issue

* re-worked commands

* commenting cli command tests for now

* commenting cli command tests for now

* removed platform

* returned Connection back

* refactor: export tree repository helper methods (#8753)

* Migrated protected tree methods to util class

* Added tree repository extend override

* Ran prettier format

* merge master into 0.3.0

Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de>

* working on documentation

Co-authored-by: Bilel Taktak <47742269+Parsath@users.noreply.github.com>
Co-authored-by: Salah Azzouz <52634440+Salah-Azzouz@users.noreply.github.com>
Co-authored-by: Daniel Hensby <dhensby@users.noreply.github.com>
Co-authored-by: Nebojša Cvetković <nebkat@gmail.com>
Co-authored-by: Philip Waritschlager <philip+github@waritschlager.de>
Co-authored-by: James Ward <james@notjam.es>
Co-authored-by: Felix Gohla <37421906+felix-gohla@users.noreply.github.com>
Co-authored-by: Dmitry Zotov <dmzt08@gmail.com>
Co-authored-by: Jimmy Chen <50786287+Q16solver@users.noreply.github.com>
Co-authored-by: Bitcollage <serkan.sipahi@yahoo.de>
2022-03-17 21:01:45 +05:00
Leandro
60a5b84826
docs: update select-query-builder RelationQueryBuilder with a example (#8658) 2022-02-17 20:49:22 +05:00
Christian Forgács
fe7f328fd5
feat: query builder negating with "NotBrackets" for complex expressions (#8476)
Co-authored-by: Christian Forgács <christian@wunderbit.de>
2022-01-15 19:56:45 +05:00
Audwin
90a8deb638
docs: Improve various formatting code syntax and capitalisation (#8449)
* docs: Improve various docs formatting

code syntax highlight on `leftJoinAndSelect`
capitalise SQL word

* docs: capitalise SQL word on classes methods docs

* docs: lowercase SQL word to trigger auto-test

* docs: uppercase SQL word to trigger auto-test
2021-12-11 12:58:57 +05:00
Hong Truong
f79ae589cd
feat: support using custom index with SelectQueryBuilder in MySQL (#7755)
* Support using custom index for MySqlDriver.

* Update select-query-builder.md

Co-authored-by: Umed Khudoiberdiev <pleerock.me@gmail.com>
2021-11-09 17:24:16 +05:00
tzahush
75ed3c3db0
docs: add examples for querying soft-deleted records (#8138) 2021-10-02 13:08:04 -04:00
Hong Truong
0564c348b9
feat: support MAX_EXECUTION_TIME for MySQL driver. (#7638) 2021-05-15 14:33:34 +05:00
Dennis Ameling
1656a11c89
docs: add note about unique parameters in QueryBuilder (#7572)
When using the QueryBuilder, unique parameters need to be provided in WHERE expressions. This commit adds that information to the docs, as it's easy to overlook for users.
2021-04-17 14:39:46 +05:00
James Ward
920e7812cd
feat: Add SelectQueryBuilder.getOneOrFail() (#6885)
This adds a `getOneOrFail` which which is to `getOne` as
`findOneOrFail` is to `findOne` - it never returns `undefined`,
it will instead throw an `EntityNotFoundError`

closes #6246
2020-10-15 22:54:57 -04:00
Tulio Molina
a8b2845d08
docs: update select-query-builder.md (#6681)
Found a typo on the "Adding WHERE expression" section: user.firstName is used in the SQL snippet where you actually meant user.id
2020-09-08 18:37:13 +05:00
Domagoj
37fd946670
docs: fix select query builder link (#5980) 2020-05-16 04:09:44 +03:00
Štefan Malček
e92c743fb5
docs: fix raw query (#5845)
The code examples assume many results (see a comment below in each example), but queries were filtered by user.id. Instead groupBy clausule should be used in order to select user.id after using aggregation function.
2020-04-13 14:54:25 +03:00
Endurance Idehen
9603ad28de
docs: demostrate an IN Query (#5440)
Solves: https://github.com/typeorm/typeorm/issues/1329
2020-02-17 20:38:32 +05:00
wsm
1293065063 feat: add distinct on() support for postgres (#4954)
* Added distinct on property to query builder exp map.
* Initial distinct on implementation for postgres
* Move distinct on to postgres only enabled test run.
* Added documentation for distinct-on, formatting.
2019-11-21 20:02:51 -08:00
Mike Harris
c8dbf099ba docs: Fix Typo (#4412) 2019-07-10 18:17:31 +05:00
Abel Separovich C. Santos
4ee63c8578 fixed broken doc on select-query-builder.md (#4180) 2019-05-24 00:11:20 +02:00
Alfonso Alonso Lorenzo
b571f5dd69 added dirty read(NOLOCK) in SQLServer 2019-05-13 13:29:55 +02:00
Johannes Schobel
d8907ce398 fixing typos in the EN docs 2019-03-02 12:30:13 +01:00
Umed Khudoiberdiev
7bd42e6bb7
fixed names to match context 2019-02-03 23:05:37 +05:00
Dave Wasmer
141180990c
Add documentation for array parameter syntax
Fixes #2845
2019-02-02 18:32:01 -07:00
Benjamin
21693dd5e1 addressed PR comment 2019-01-22 09:17:03 +10:00
Benjamin
b90f4da1ec added a note in the parameters section 2019-01-21 09:02:27 +10:00
Kononnable
9570052bc0
Merge pull request #2755 from astrohsy/master
add missing parentheses in the bracket example
2018-10-11 22:47:59 +02:00
Hoseung Lee
87891c8dda add missing parentheses in the bracket example on select-query-builder.md 2018-09-01 10:47:09 +00:00
David Baumgold
8494f6ae10 Fix groupBy() docs typo 2018-08-29 18:49:14 +02:00
Umed Khudoiberdiev
b4385a0ec1
fixes #2291 2018-06-07 17:03:12 +05:00
Hoseung Lee
1be9def5a4 add a Brackets example on Where section in select-query-build.md 2018-04-25 11:23:44 +00:00
Leonardo Perria
49d9d20243
Fix "Partial selection" block code formatting 2018-02-21 14:34:22 +00:00
lo78cn
60f9d819e3
Update select-query-builder.md
name should be password
2018-02-11 09:36:26 +01:00
Muzafar Umarov
83168bdb14
Updated the hidden column to reflect the query
There were two columns with the name `name`. The example query builder to fetch that column was selecting `password`.
2018-01-31 08:03:28 -05:00
Umed Khudoiberdiev
20c0756d0f
Merge pull request #1513 from crutchcorn/master
Update documentation for `select`, `NULL`, and subscribers
2018-01-31 12:20:06 +05:00
Matt Neal
94ede56f67
Update select-query-builder.md
Grammatical and punctuation fixes. Major readability and comprehension changes, as well as an additional link to SQL Join documentation.
2018-01-29 13:02:23 -05:00