Ivan Vanderbyl
afa3beca6b
dialect/sql: add on-conflict handling to sql builder ( #1370 )
...
* Adds conflict handling to sql builder
* Revert some builder tests
* Fix builder test
* Revert
* Revert another line
* Update dialect/sql/builder.go
* Move conflict ops
* Refactor conflict handling builder
Co-authored-by: Ivan Vanderbyl <ivanvanderbyl@gmail.com >
Co-authored-by: Ivan Vanderbyl <ivanvanderbyl@users.noreply.github.com >
2021-03-22 12:36:43 +02:00
Ruben de Vries
68a6bd7fcd
dialect/sql: add helpers for basic predicates for comparing 2 columns. ( #1358 )
2021-03-22 11:42:12 +02:00
Ariel Mashraki
66ec8ceb1a
dialect/sql: add ParamFormatter interafce ( #1279 )
...
Allow wrapping placeholder parameters with custom format.
For example, '?' => 'ST_GeomFromWKB(?)'.
2021-02-26 14:34:10 +02:00
Ariel Mashraki
d6f6c81a22
dialect/sql: allow creating predicate from raw expression ( #1263 )
2021-02-19 17:29:16 +02:00
Ariel Mashraki
ae0cdf0445
dialect/sql: minor test changes ( #1247 )
2021-02-07 19:08:22 +02:00
Ruben de Vries
9e610c7b54
dialect/sql: fix Builder.Join implementation for postgres ( #1212 )
...
Don't use .Total() in builder.Join and purely rely on len(args).
2021-02-07 18:07:48 +02:00
Ariel Mashraki
dd4792f5b3
go: rename module from github.com/facebook/ent => entgo.io/ent ( #1226 )
2021-02-02 23:03:04 +02:00
Marwan Sulaiman
ddb25280cd
dialect/sql: Add context.Context to sql.Selector ( #1185 )
2021-01-18 17:32:42 +02:00
Ariel Mashraki
d4d10d3977
dialect/sql: support sql expression in predicate args ( #1166 )
2021-01-13 14:12:01 +02:00
Ariel Mashraki
5fc907451f
dialect/sql: test order by expression
2021-01-11 17:22:20 +02:00
Marwan Sulaiman
5118e82422
dialect/sql: skip schema prefix when dialect is SQLite ( #1135 )
...
* Skip schema prefix when dialect is SQLite
* Update dialect/sql/builder.go
Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com >
* abstract schema checks
Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com >
2021-01-05 22:10:36 +02:00
Marwan Sulaiman
cc4c3afe92
Add schema options for sql builders ( #1134 )
2021-01-05 19:42:53 +02:00
Ariel Mashraki
0f7ab71e24
dialect/sql: reset predicate before execute ( #1092 )
2020-12-28 11:45:16 +02:00
Ariel Mashraki
eca18b0894
dialect/sql: add check clause for column builder ( #1065 )
2020-12-20 10:33:34 +02:00
Ariel Mashraki
1270ba1bd8
dialect/sql: add support for setting the table_schema in select_table ( #1001 )
2020-11-30 13:36:49 +02:00
Ariel Mashraki
122ee020b7
dialect/sql: add support for table options ( #925 )
2020-11-06 18:14:23 +02:00
Alex Snast
cd0a79e821
sql/builder: expand limit / offset into query instead of args ( #816 )
2020-10-04 13:13:56 +03:00
maxilozoz
21c2b3b467
dialect/sql: add left/right join support for selector builder
2020-10-01 20:03:45 +03:00
Ariel Mashraki
09be472be8
dialect/sql: add option for adding and getting error from builders
2020-09-10 22:53:25 +03:00
Ariel Mashraki
ce48ab99b8
dialect/sql/sqljson: move json predicates to a package ( #735 )
2020-09-07 21:22:12 +03:00
Ariel Mashraki
e4767ed83e
dialect/sql: add json-eq op for predicates ( #728 )
2020-09-05 20:21:13 +03:00
Ariel Mashraki
6a1829cc33
dialect/sql: add DotPath option to json option ( #725 )
2020-09-04 14:13:29 +03:00
Ariel Mashraki
6f960ec392
dialect/sql: add has-key for json predicates ( #723 )
2020-09-02 17:57:20 +03:00
Ariel Mashraki
e215ae0cd7
dialect/sql: make WriteOp chainable ( #710 )
2020-08-29 21:18:10 +03:00
Ariel Mashraki
48389c5e94
dialect/sql: add the basic operators to WriteOp ( #700 )
...
* dialect/sql: add the basic operators to WriteOp
2020-08-26 18:20:45 +03:00
Ariel Mashraki
94eee235b4
dialect/sql: add json-path for sql builders
2020-08-25 11:05:32 +03:00
Ariel Mashraki
b18716931d
dialect/sql: change boolean operators wrapping ( #678 )
...
The reason is to parentheses only when it's necessary.
2020-08-20 10:08:31 +03:00
Ariel Mashraki
fd0a7f9f02
all: facebookincubator/ent => facebook/ent ( #660 )
...
ent repository is going to be migrated to facebook organization
2020-08-18 11:05:08 +03:00
Ariel Mashraki
d9c8130d08
dialect/sql: configure contains-fold per dialect ( #666 )
2020-08-13 17:26:19 +03:00
Ariel Mashraki
2208b243db
dialect/sql/schema: initial work for incremental migration ( #428 )
...
This is a WIP PR and should be ignored this moment.
It's based on PR #221 created by Erik Hollensbe (He should
get his credit for his work before we land this).
2020-04-12 19:12:33 +03:00
Ariel Mashraki
cb5b9f6f9e
dialect/sql: add drop/add-index for older version of mysql ( #315 )
...
Add support for MySQL 5.6.35
2020-01-23 20:25:48 +02:00
Ariel Mashraki
fd8c07717c
dialect/sql: add change-column for mysql ( #304 )
...
Old versions of MySQL (<8) do not support the 'RENAME' caluse
2020-01-21 05:04:01 -05:00
Ariel Mashraki
4c89190e8a
dialect/sql: add alter-index for renaming psql indexes ( #301 )
2020-01-20 18:13:55 -05:00
Ariel Mashraki
ba189b5f33
dialect/sql: add rename-index to mysql builder ( #300 )
2020-01-20 12:53:04 -05:00
Christoph Hartmann
46982d2f05
dialect/sql: add predicates for composite where query ( #264 )
...
* add predicates for composite where query
Signed-off-by: Christoph Hartmann <chris@lollyrock.com >
* use existing table.Columns method
* simplify the composite operator methods
2020-01-02 18:42:26 +02:00
Ariel Mashraki
ab732c7654
dialect/sql: add drop-fk command to builder
2019-12-31 21:26:02 +02:00
Ariel Mashraki
6bb834612c
dialect/sql/schema: drop unique constraint on pg migration
...
Fixes #235
2019-12-15 18:52:05 +02:00
Ariel Mashraki
d2fb1b5548
dialect/sql: override RETURNING clause on postgres
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/192
Reviewed By: dlvhdr
Differential Revision: D18685852
fbshipit-source-id: 90ddd1057a7d6cfa00470a7b11fb237862edcc2b
2019-11-25 07:29:52 -08:00
Ariel Mashraki
53cfcb6e8b
dialect/sql: fix predicate builder on join
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/143
Reviewed By: idoshveki
Differential Revision: D18346652
fbshipit-source-id: e8c5d7eb3cefc16f52090de0d121e82cae058fc2
2019-11-06 05:21:26 -08:00
Ariel Mashraki
c259aee24b
entc/gen: generate sql builders with dialect option
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/130
Reviewed By: alexsn
Differential Revision: D18164397
fbshipit-source-id: 2858d69d3ff85c06b51382c01c3d4369ee2c3bdb
2019-10-27 21:53:50 -07:00
Ariel Mashraki
c414cd9a82
dialect/sql/schema: alter column for postgres
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/117
Reviewed By: alexsn
Differential Revision: D18083914
fbshipit-source-id: a5f6993cfe9a260a84c0d4ab868e3e797b3a5776
2019-10-23 05:39:17 -07:00
Ariel Mashraki
6f5f42ab3c
dialect/sql: dialect based builders ( #1550 )
...
Summary:
Pull Request resolved: https://github.com/facebookexternal/fbc/pull/1550
Pull Request resolved: https://github.com/facebookincubator/ent/pull/84
This is still WIP and you should ignore this.
Reviewed By: alexsn
Differential Revision: D17854477
fbshipit-source-id: 2d19713c118adb31164b7a2781327e64c87db8d4
2019-10-13 07:03:11 -07:00
Ariel Mashraki
b067d5d8b4
dialect/sql: increment and decrement columns using "add"
...
Summary:
Use case:
```
query, args := Update("data_packs").
Add("bytes_left", count).
Where(expr...).
Query()
```
Reviewed By: alexsn
Differential Revision: D17257590
fbshipit-source-id: f27b4b388a711a16deb0c3b790e24957e044204d
2019-09-09 05:50:59 -07:00
Ariel Mashraki
9ab0a28ffe
entc/select: add selection api
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/27
Reviewed By: alexsn
Differential Revision: D17164536
fbshipit-source-id: f5caa80b05aff1ef8ec30d7a53256b00380d018c
2019-09-04 07:14:24 -07:00
Alex Snast
373769dfaf
ent/gen: adding EqualFold predicate for string fields
...
Summary: Similar to `ContainsFold` predicate requires `--storage=sql` argument to be passed to entc.
Reviewed By: a8m
Differential Revision: D17074805
fbshipit-source-id: ced299154417fe2c9007cd6a7a504f53c8b2ef98
2019-08-27 10:48:53 -07:00
Ariel Mashraki
bd07c86b60
all: add license header to all go files
...
Summary:
Used addlicense to generate this:
addlicense -c "Facebook Inc" -f license_header .
example was taken from: https://github.com/facebook/litho/blob/master/lib/soloader/BUCK
Reviewed By: alexsn
Differential Revision: D17070152
fbshipit-source-id: e7b91398d7f6181727be3400c1872ad5f28e38ed
2019-08-27 04:48:28 -07:00
Ariel Mashraki
fb56e0c786
ent/dialect/sql: add ContainsFold to builder
...
Reviewed By: alexsn
Differential Revision: D16961184
fbshipit-source-id: f3f0c2bdd4950340ddebca929b8fed79256c7aeb
2019-08-22 04:38:15 -07:00
Ariel Mashraki
e2524ff0ad
ent/dialect/sql: add upper and lower methods
...
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/18
Reviewed By: elys1um
Differential Revision: D16916563
fbshipit-source-id: f758536103356cb5b2bacf707c7c7da931bb4560
2019-08-20 07:52:59 -07:00
Ariel Mashraki
329b5ddf77
ent/sql/migrate: support indexes
...
Reviewed By: alexsn
Differential Revision: D16711184
fbshipit-source-id: 632b02c5c77c6289b242263647d45d9f28752e3f
2019-08-11 05:47:18 -07:00
Ariel Mashraki
25f5a2ef01
entc/predicate: add isnull/notnull predicates for codegen
...
Reviewed By: idoshveki
Differential Revision: D16687226
fbshipit-source-id: 14a39e066447dbf77413e5c7f7318a2d61bddd32
2019-08-07 06:56:32 -07:00