Commit Graph

291 Commits

Author SHA1 Message Date
Vojtěch Káně
43ef74b8a8 entc/gen: add support for default annotation to PKs as well (#1492) 2021-04-22 14:16:53 +03:00
Ariel Mashraki
89d1bcd80c dialect/sql/sqlscan: allow scanning optional values to non-pointer fields 2021-04-20 09:29:41 +03:00
Ariel Mashraki
b3041725d2 dialect/sql/sqlscan: allow scanning values to embedded struct fields 2021-04-19 18:40:37 +03:00
Ariel Mashraki
497fca4c96 entc/gen: skip selecting group-by fields if they already selected 2021-04-19 17:20:44 +03:00
Christoph Hartmann
5421d6c628 dialect/sql/schema: handle pg bytea for schema changes (#1462) 2021-04-19 14:46:01 +03:00
Ariel Mashraki
2480b5c0ef entc/gen: wrap nillable fields with custom go-type with sql.nullscanner 2021-04-17 13:13:40 +03:00
Ariel Mashraki
712b6a5f08 dialect/sql/sqlgraph: allow update single node without select 2021-04-14 21:54:27 +03:00
Ariel Mashraki
5bcee6b51c dialect/sql/schema: add postgres tests for array type 2021-04-14 14:25:28 +03:00
Ariel Mashraki
fd1f2df150 dialect/sql/schema: add support for pg arrays in migration 2021-04-14 14:25:28 +03:00
bshihr
d7b683c0d3 dialect/sql/schema: correct wrong error message ("mysql" hard coded in Inspector method) (#1442) 2021-04-09 07:40:31 +03:00
Ariel Mashraki
745afde770 dialect/entsql: add support for column default using annotation
Fixed #1033
2021-04-03 21:53:56 +03:00
Ariel Mashraki
a1ad70c685 dialect/sql/schema: json column migration for mariadb10.3.13
See https://github.com/ent/ent/issues/1395\#issuecomment-809420881
Fixed #1395
2021-03-29 22:34:58 +03:00
Ariel Mashraki
f12ef91829 entc/gen: privatize table columns check 2021-03-29 14:35:38 +03:00
Ariel Mashraki
305edd00e0 dialect/sql/schema: handle index prefix key limit in older versions of mariadb
Fixed #1378
2021-03-23 17:01:38 +02:00
Ariel Mashraki
56a0cf1e8b dialect/sql/sqlgraph: fix incorrect arg-list handling in entql
Fixed #1376
2021-03-22 20:27:12 +02:00
Ariel Mashraki
a3c536402a dialect/sql: add missing godoc comments (#1372) 2021-03-22 18:45:50 +02:00
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
b4ad29f7f3 dialect/sql/schema: fix postgres index migration (#1351)
Fix PostgreSQL index migration when table_name = type_name.
Closed #1344
2021-03-18 22:29:39 +02:00
Ariel Mashraki
14ed353ca9 dialect/sql: minor improvements to sql builder (#1343)
benchmark                                     old ns/op     new ns/op     delta
BenchmarkInsertBuilder_Default/default-16     6210          922           -85.15%

benchmark                                     old allocs     new allocs     delta
BenchmarkInsertBuilder_Default/default-16     86             16             -81.40%

benchmark                                     old bytes     new bytes     delta
BenchmarkInsertBuilder_Default/default-16     4098          1088          -73.45%
2021-03-17 14:36:09 +02:00
Rotem Tamir
36e3492718 dialect/sql/sqlgraph: adding unit tests for IsConstraintError (#1318)
* dialect/sql/sqlgraph: adding unit tests for IsConstraintError group of checks in second phase of #1310

* renaming test for loop variable names

* use backtick strings to improve readability
2021-03-10 18:23:24 +02:00
Rotem Tamir
2a17dba983 dialect/sql/sqlgraph: add constraint error checks (#1316)
Initial work on #1310
2021-03-09 15:56:47 +02:00
Matthew Gabeler-Lee
c53b45ddb0 all: use %w instead of %v to wrap errors (#1275)
* all: use %w instead of %v for nested errors with fmt.Errorf

* all: update generated code to use %w instead of %v for error wrapping
2021-03-03 20:05:33 +02:00
Ariel Mashraki
8a8bfe7de6 dialect/sql/sqlgraph: skip setting last-insert-id if was provided (#1291)
Fixed #1290. Issue in BulkCreate(<T>) for m2m edges
2021-03-02 11:59:20 +02:00
Ariel Mashraki
0d0a93b95f entc/gen: add support for referencing fks to existing fields (#1289) 2021-03-01 22:57:32 +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
a0c3976ee5 dialect/sql/schema: add mysql spatial type for migration (#1271) 2021-02-24 22:24:42 +02:00
Ariel Mashraki
72f8b1281f all: minor comment and style changes 2021-02-23 21:00:20 +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
Ariel Mashraki
95d780e55e dialect/sql/schema: add mysql text for column scan (#1219) 2021-01-31 22:25:38 +02:00
Ariel Mashraki
3930d3c835 schema/field: implement field.Other (#1218)
* Implement Other Field

* Implement Other Field

* Changed dialect types

* run generate

* doc typo

* docs added

* schema/field: additional validation and tests for Other type

Co-authored-by: Ciaran Liedeman <ciaran@stackworx.io>
2021-01-31 17:43:28 +02:00
Ariel Mashraki
2c7228c23f dialect/sql/sqlgraph: add schema for deletion command 2021-01-24 19:57:28 +02:00
Ariel Mashraki
aeb1ccc571 entc/gen: move schemaconfig template to feature-flag 2021-01-24 19:57:28 +02:00
Ariel Mashraki
f315801779 dialect/sql/sqlgraph: apply predicate on update-node 2021-01-22 23:04:09 +02:00
Marwan Sulaiman
3439ca207f dialect/sql/sqlgraph: pass context.Context to *sql.Selector (#1186)
* Ensure sqlgraph passes the context to *sql.Selector

* Update dialect/sql/sqlgraph/graph_test.go

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* Update dialect/sql/sqlgraph/graph_test.go

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>

* gofmt

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
2021-01-18 19:41:59 +02:00
Marwan Sulaiman
ddb25280cd dialect/sql: Add context.Context to sql.Selector (#1185) 2021-01-18 17:32:42 +02:00
Ariel Mashraki
0ac3526d30 dialect/sql/schema: test postgres inspection 2021-01-18 12:38:39 +02:00
Ariel Mashraki
cc8da8fbf7 dialect/sql/schema: schema match from predicate 2021-01-18 12:38:39 +02:00
Ariel Mashraki
7e904f0e1c dialect/sql/schema: add sqlite test for inspector (#1183) 2021-01-18 11:21:39 +02:00
Ariel Mashraki
8b798d2714 dialect/sql/schema: add tables inspection capabilities (#1178) 2021-01-17 16:41:07 +02:00
Ariel Mashraki
91f7e3363a dialect/sql/schema: support providing alternate schema for postgres (#1172) 2021-01-14 16:55:37 +02:00
Ariel Mashraki
601a4ee50d dialect/sql/schema: support alternate schema for drivers (#1167) 2021-01-13 14:21:03 +02:00
Ariel Mashraki
d4d10d3977 dialect/sql: support sql expression in predicate args (#1166) 2021-01-13 14:12:01 +02:00
Marwan Sulaiman
13b61ff455 dialect/sql/sqlgraph: schema options for operations (#1136)
* Add schema options for sql graph

* PR Fixes
2021-01-12 09:29:01 +02:00
Ariel Mashraki
5fc907451f dialect/sql: test order by expression 2021-01-11 17:22:20 +02:00
Ariel Mashraki
ad92b2323b dialect/sql: add option to order by expression 2021-01-11 17:22:20 +02:00
Ariel Mashraki
3f75ffabd8 dialect/sql: add expr querier 2021-01-11 17:22:20 +02:00