93 Commits

Author SHA1 Message Date
Kkmatt11
629909475c
Fix MSSQL with returns on inserts and deletes on tables with triggers (#4152) 2020-12-18 01:12:04 +02:00
Nico Burns
8d43019873
Implement "UPSERT" (Postgres/MySQL/Sqlite) (#3763) 2020-10-31 17:22:52 +02:00
Ivan Zhuravlev
5845dc632f
feat(QueryBuilder): add method clear(statement) (#4051) 2020-10-29 01:18:32 +02:00
Bogdan Chadkin
80355e4850
Replace inherits package with builtin utility (#4059) 2020-10-05 23:59:12 +03:00
Bogdan Chadkin
6f817a3b6e
Avoid lodash typecheks (#4056)
* Avoid lodash typecheks

Lodash is quite big project. Even with direct imports it loads [tons](https://github.com/knex/knex/pull/3804) of
code and still bloats node_modules. Especially since lodash mostly used
as a polyfill for modern features.

In this diff I attempted to reduce lodash usage by replacing type checks
with `typeof` operator which might be sufficient.

Also replaced lodash/isObject with custom simplified utility which does not
consider functions as objects and allows to simplify code in one place.
2020-10-05 21:29:39 +03:00
Simon Lorenz
b65245e1fe
warn if whereNot is used with 'in' or 'between' (#4038)
Co-authored-by: Simon Lorenz <simon.lorenz@stadt-duisburg.de>
2020-09-19 23:45:11 +03:00
Igor Savin
e37aeaa31c
Prepare for 0.21.0 release (#3811) 2020-04-19 00:40:23 +02:00
tkalliom
02d94d96b0
Reduce size of lodash in bundle (#3804) 2020-04-18 19:41:23 +02:00
Edvaldo Szymonek
336b41e148
Add clearGroup method (#3771) 2020-04-13 01:09:51 +02:00
Igor Savin
4feefdf3d2 Enforce Unix (lf) line terminators (#3598) 2019-12-29 20:28:40 +01:00
Lorefnon
f87b28c3e3 Add support for distinct on for postgres (#3513)
Resolves #3472
2019-11-11 00:51:47 +01:00
EthanHur
c53227564d add validation in .offset() (#2908) 2019-10-15 13:24:49 +02:00
Igor Savin
516b074790
Enable linting in CI (#3450) 2019-10-06 20:20:46 +02:00
Felix Mosheev
8111bb3ee8 Feat: Allow to extend knex query builder (#3334) 2019-07-23 20:45:03 +02:00
Igor Savin
49456691d8
Update dependencies (#3366) 2019-07-23 18:00:13 +02:00
Lorefnon
3e1a5ee0de Minor enhancements around aliasing of aggregates (#3354)
- Allows an options object to specify alias (as suggested in https://github.com/tgriesser/knex/issues/3315#issuecomment-507439215) (Closes #3315)
- Allows multiple aliases when using object syntax (Closes #2871)
2019-07-16 18:48:28 +02:00
Ricardo Graça
9aa7085b05 Rename src directory to lib (#3338) 2019-07-10 23:48:43 +02:00
Mikael Lepistö
7140a48226 Remove generated lib from repository and run build in prepublish 2016-01-21 09:59:30 +02:00
Sky Morey
f9a9bddb5d lib files. lib should really be moved to the .gitignore since babel creates them 2015-12-10 15:22:29 -06:00
Sky Morey
4f340d6096 Merge branch 'master' of github.com:tgriesser/knex 2015-12-10 15:16:23 -06:00
Rhys van der Waerden
84472e6e7e Merge pull request #1081 from tgriesser/fix/1080
Include `_debug` property in `QueryBuilder#clone`.
2015-12-10 15:31:14 +11:00
Sky Morey
7c1120e0e2 in progress 2015-12-08 11:37:31 -06:00
Rhys van der Waerden
8ef5d5899d Include _debug property in QueryBuilder#clone.
Adds a test for `QueryBuilder#clone`. Changes `clone()` behaviour to transfer the debug flag (`QueryBuilder#_debug`) to the cloned instance.

Fixes #1080
2015-11-30 00:21:08 +11:00
Hannah Wolfe
f72892b5b9 Distinct modifier support for aggregate functions
closes #1028

- add support for count(distinct *), avg(distinct *) and sum(distinct *)
- min and max don't really make sense with distinct, so didn't add those
2015-11-09 12:48:42 +00:00
Daniel Teixeira
8e780a8115 rename .using to .withSchema 2015-08-14 19:17:06 -03:00
Daniel Teixeira
17df5c6542 add basic schema support on queries 2015-08-09 20:38:26 -03:00
Jani Evakallio
cb89930155 Add queryBuilder as first parameter to queryBuilder.modify 2015-07-16 15:49:30 +01:00
Jani Evakallio
299bbfa60b Rename compose to modify 2015-07-16 15:15:04 +01:00
Jani Evakallio
de8a2e5da6 Commit babel artifacts for queryBuilder.compose 2015-07-09 16:10:14 +01:00
Tim Griesser
d0faa82a0f QueryBuilder -> Builder 2015-05-12 21:48:02 -04:00
Tim Griesser
521a6f9e97 Remove use strict, assumed in ES6 2015-05-09 14:01:19 -04:00
Tim Griesser
7e884cb325 Babel src -> lib, remove gulp 2015-05-09 13:58:18 -04:00
Tim Griesser
c529358fcb Allow object syntax for join, #743 2015-04-29 15:13:15 -04:00
Tim Griesser
e011768124 Adding back debug 2015-04-28 19:34:11 -04:00
Tim Griesser
2e47b9d2e8 Nicer query builder interface 2015-04-28 09:14:13 -04:00
Tim Griesser
17b04db6da Test for #647, chained update calls aggregate updates 2015-04-28 08:41:08 -04:00
Tim Griesser
7b17cc404a Oracle test suite up to date 2015-04-27 20:22:05 -04:00
Tim Griesser
36ced91ed5 Testing transactions, beginning to use tape, adding query to error message 2015-04-24 10:10:34 -04:00
Tim Griesser
26726c728b Fixing test config 2015-04-22 12:11:23 -04:00
Tim Griesser
f9aab9dc76 Major internal refactor
Beefed up transaction implementation, still needs tests
and cleanup of nested transaction queues.

Left todo:
- Fix commented out tests
- Fix oracle driver's transactions
2015-04-22 10:34:14 -04:00
Tim Griesser
eee4e9c005 Fixing the overall class dependency approach, lots of internal cleanup, WIP 2015-04-19 16:31:52 -04:00
Santi Albo
daecf96c9e Allow raw columns in where clauses 2015-04-17 17:41:52 +01:00
Tim Griesser
c14efb7b01 Add fromJS method, alternate solution for #761 2015-04-17 10:35:01 -04:00
Ozum Eldogan
e7e4f8d840 Fix: whereNot and orWhereNot for _objectWhere
_objectWhere is not generating correct sql when used with whereNot
and/or orWhereNot
2015-02-26 17:07:26 +02:00
Ozum Eldogan
ff9ede59e9 whereNot, orWhereNot
whereNot, orWhereNot methods added to single and wrapped wheres.
2015-02-26 16:31:30 +02:00
George Gensure
16b234c565 Adding multiple union tests for unwrapped/wrapped
Tests revealed some problems with argument and wrap interpretation,
corrected.
2015-02-03 21:11:42 -05:00
George Gensure
f6952c42b5 Respect union wrap parameter as last argument
union's wrap parameter was being ignored and misinterpreted when
building statements.  Maintain the spirit of the original implementation
(variable number of callbacks) consistent with other instances of
variadic-like behavior (select/columns), including handling list of
callbacks in array, while still processing the wrap parameter.
2015-02-03 12:33:17 -05:00
Philipp Waldmann
8866af423d support for nested having 2014-11-20 20:52:18 +01:00
Tim Griesser
5280e6e91c Handle empty array case for whereIn, fix #477 2014-10-01 15:50:48 -04:00
Tim Griesser
b4333f9fee Consistent handling of 'not' cases similar to 'or' 2014-10-01 15:22:49 -04:00