Commit Graph

198 Commits

Author SHA1 Message Date
Ariel Mashraki
13ae2fcea1 entc/integration: add tests for mixim fields (#270) 2020-01-05 17:29:06 +02:00
Jian Li
fc6a9b1a9b fix meta.tmpl code generating incomplete issue. (#268) 2020-01-05 08:12:45 +02:00
Ariel Mashraki
59f172f06a entc/integration/migrate: add integration tests for migrate 2020-01-01 19:12:11 +02:00
Ariel Mashraki
e5c5aec9b5 entc/gen: remove FromRows decoding 2019-12-24 10:29:40 +02:00
Ariel Mashraki
4021d35e5a entc/integration: split generate commands to packages 2019-12-23 11:29:10 +02:00
Ariel Mashraki
7a85c04c32 entc/gen: add edge-fields + minor changes 2019-12-23 10:57:36 +02:00
Ariel Mashraki
91cdd2a087 entc/gen: remove unnecessary subquery on fields selection 2019-12-22 20:24:29 +02:00
Ariel Mashraki
c09028f58b dialect/sql/sqlgraph: consistent scan names 2019-12-22 20:12:00 +02:00
Ariel Mashraki
6f9dade32c entc/gen: move query-all to sqlgraph 2019-12-22 20:00:25 +02:00
Ariel Mashraki
a26b9626a6 entc/gen: move query-count to sqlgraph 2019-12-22 19:42:28 +02:00
Ariel Mashraki
1c54439d40 entc/gen: move scan-assign to node def 2019-12-22 17:15:33 +02:00
Ariel Mashraki
700b3bd04f Merge pull request #257 from facebookincubator/sqlgraph/update
entc/gen: move sql-update to sqlgraph
2019-12-22 16:22:32 +02:00
Ariel Mashraki
7fde9b7642 entc/gen: move sql-update-one to sqlgraph 2019-12-22 13:32:51 +02:00
Alex Snast
f14653be71 entc/gen: fix node out of bounds check
Signed-off-by: Alex Snast <alexsn@fb.com>
2019-12-19 13:07:06 +02:00
Ariel Mashraki
04e9391c25 entc/gen: move sql-delete to sqlgraph 2019-12-18 15:14:53 +02:00
Ariel Mashraki
0a7608f8bd all: change codegen header 2019-12-18 13:00:25 +02:00
Ariel Mashraki
798d58f02b all: use more go-ish error for constraint failures 2019-12-17 23:17:55 +02:00
Ariel Mashraki
c6800a3869 entc/gen: move node creation to sqlgraph 2019-12-17 22:45:04 +02:00
Ariel Mashraki
0cc74b5297 all: move sqlgraph to its own package 2019-12-17 18:26:09 +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
802e3b583a entc/integration: run tests with migrate options 2019-12-15 15:03:24 +02:00
Ariel Mashraki
e85b10be36 entc/gen: remove multi storage support 2019-12-15 14:48:55 +02:00
Ariel Mashraki
0fb33aaa5e dialect/sql/sqlgraph: add update node api
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/222

Reviewed By: alexsn

Differential Revision: D18833733

fbshipit-source-id: e833d84f4e5e5c73b1c85e7387472c9a87b7947e
2019-12-08 21:59:53 -08:00
Ariel Mashraki
1a73b8cf55 entc/gen: change neighbors-with check to use sqlgraph
Reviewed By: alexsn

Differential Revision: D18729648

fbshipit-source-id: 23eb95bdb0c34c811621a819be6581e1e6fcb474
2019-12-01 02:07:55 -08:00
Ariel Mashraki
f7ce61fc3c entc/gen: change neighbors predicate to use sqlgraph
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/204

Reviewed By: alexsn

Differential Revision: D18726911

fbshipit-source-id: 6fe850bb0c0613c3f1c94e8bbcf3f0684dded9a6
2019-11-27 11:28:26 -08:00
Ariel Mashraki
5fe9fcdc1b entc/gen: fix update ids check bug in user-defined-ids
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/203

Reviewed By: alexsn

Differential Revision: D18725824

fbshipit-source-id: 888686bb5fa87649be89ec1926cbd7a3b6cf7932
2019-11-27 06:20:44 -08:00
Ariel Mashraki
ed3747ff82 entc/gen: change neighbors query to use Step builder
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/202

Reviewed By: alexsn

Differential Revision: D18725770

fbshipit-source-id: d7720ac89f55022a7721edc7df15fab1d6e3672c
2019-11-27 06:20:43 -08:00
Ariel Mashraki
0e73d57571 entc/gen: change client neighbors to use Step builder
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/201

Reviewed By: alexsn

Differential Revision: D18725715

fbshipit-source-id: 6292ac659c4d86610e39476a373dee92f2820d8d
2019-11-27 03:13:52 -08:00
Ariel Mashraki
56335d6e12 ent: regenerate assets
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/197

Reviewed By: aharonnovo

Differential Revision: D18706251

fbshipit-source-id: 1603030671f4541f21a6b34d5ea0b8b7ccbea8da
2019-11-26 05:47:56 -08:00
Ariel Mashraki
0b4f707bb9 entc/gen: add support for additional template for type package
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/196

Reviewed By: aharonnovo

Differential Revision: D18706080

fbshipit-source-id: 17293350f628c9bec234fa5ad6a6239617fa6ef3
2019-11-26 03:49:17 -08:00
Ariel Mashraki
67c3fd2db9 entc/gen: initial work for supporting uuid fields in codegen
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/182

Reviewed By: alexsn

Differential Revision: D18638199

fbshipit-source-id: 0de79c78b51e544486c07a004c3c8ea82e5c3398
2019-11-24 07:11:23 -08:00
Ariel Mashraki
d2fe7199e5 entc/load: return packages.Load error when 'go list' fails (#187)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/187

Also, remove the dependency of pkg/errors from load package.

Reviewed By: alexsn

Differential Revision: D18672979

fbshipit-source-id: 88a881a99e93896f8d3a0aefcf61fbd995b7fa08
2019-11-24 07:11:22 -08:00
Ariel Mashraki
c355ed49be entc/gen: move set-neighbors logic from codegen to sqlgraph
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/183

Reviewed By: alexsn

Differential Revision: D18644179

fbshipit-source-id: 2f2b0c03811a09c4c11240e5161187afbb2ac553
2019-11-24 04:16:36 -08:00
Ariel Mashraki
1e49561634 ent: support external uuid types (#181)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/181

The lack of generic typing requires to check the function type in the "loading" phase of the schema.

Reviewed By: alexsn

Differential Revision: D18636969

fbshipit-source-id: d8229779bf3c2490e51f5d0d4c550c70e2cd2550
2019-11-21 08:49:59 -08:00
Ariel Mashraki
e54373f410 ent: allow non-numeric columns as PKs
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/180

Reviewed By: alexsn

Differential Revision: D18636443

fbshipit-source-id: f14b34926817f6d9652f49a640bfb377f3f3cdaf
2019-11-21 08:49:58 -08:00
Ariel Mashraki
bc4284cf2c ent/gen: trim invalid tokens in identifier prefix
Reviewed By: alexsn

Differential Revision: D18636356

fbshipit-source-id: f5ea4b4d003ec09d1351782e7691e9e657d15ed6
2019-11-21 08:49:58 -08:00
Ariel Mashraki
7be1779ad1 entc/gen: add the type name as an index prefix (#171)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/171

Note that this is a non backwards compatible change.

I'll add another change (before this) for setting the storage-key of the index, and only after that we can land this.

Reviewed By: alexsn

Differential Revision: D18570445

fbshipit-source-id: e3ffc7b4baa6bc2fcce9e4553e17817091423b1e
2019-11-20 07:08:47 -08:00
Ariel Mashraki
3c6661fce8 schema/index: add storage-key option for indexes
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/172

Reviewed By: alexsn

Differential Revision: D18571700

fbshipit-source-id: 2b8dbcc7c36be01ba383c48f982f59361a68c621
2019-11-18 07:54:56 -08:00
Ariel Mashraki
829de26c4f entc/load: add the default value for schema fields when possible (#170)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/170

Used to verify enum default values in the genrator

Reviewed By: alexsn

Differential Revision: D18561625

fbshipit-source-id: fde153a042d2e7b6da7f7d2c5b045c93266e276f
2019-11-17 09:06:58 -08:00
Alex Snast
d1089d30a5 ent/node: wrap errors triggered by invalid ids (#68)
Summary:
Pull Request resolved: https://github.com/facebookincubator/symphony/pull/68

Pull Request resolved: https://github.com/facebookincubator/ent/pull/168

Allows masking graphql node query errors caused by invalid ids.
In addition fixing .noder() implementation to return a nil Noder on .Get error.

Reviewed By: a8m

Differential Revision: D18560549

fbshipit-source-id: a480ebacb197071b036cb4f4bee4cd9c71e6d006
2019-11-17 02:28:22 -08:00
Ariel Mashraki
2b2e056f05 entc/gen/sql: support custom-id on create
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/166

Reviewed By: alexsn

Differential Revision: D18514295

fbshipit-source-id: e5988552c5611cbad18476ab2d9c2155df1e6e0c
2019-11-14 14:38:58 -08:00
Ariel Mashraki
38002e6d2e entc/gen: use custom id type in join table (#165)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/165

Only when it's provided by the use explicitly

Reviewed By: alexsn

Differential Revision: D18506319

fbshipit-source-id: 4cc0bb2c3bbb26f8b27b12e4aa01407fb604928d
2019-11-14 09:47:35 -08:00
Ariel Mashraki
d9da7243f9 entc/gen: initial support for user-defined ids
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/162

Reviewed By: alexsn

Differential Revision: D18485086

fbshipit-source-id: 9bb6ccff592bc0cb8b218625161ed492f67bc170
2019-11-14 08:21:31 -08:00
Ariel Mashraki
e161ecc29c cmd/entc: remove graph printing from generator
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/163

Reviewed By: alexsn

Differential Revision: D18503829

fbshipit-source-id: 1269d4c8c30f848c5096258f2328230f5f378f69
2019-11-14 08:21:30 -08:00
Ariel Mashraki
8093ec4127 entc/gen: avoid using Go keywords as variables on scan
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/161

Reviewed By: alexsn

Differential Revision: D18483166

fbshipit-source-id: 7273d284232c1bf515cc84326904b580fb70a0e3
2019-11-13 11:35:58 -08:00
Ariel Mashraki
84fd066e2c entc: return an error if template was not found (#160)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/160

Code was failing due to nil pointer in case of unknown template

Reviewed By: alexsn

Differential Revision: D18477913

fbshipit-source-id: 5c93e9697c5d62cbb9a0a6955231aa133c52f6db
2019-11-13 07:27:28 -08:00
Ariel Mashraki
6ce4cb6803 all: fix minor lint errors
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/159

Reviewed By: dlvhdr

Differential Revision: D18476131

fbshipit-source-id: 9e792f5a35f25233aad73f75f12d13d215a21ad2
2019-11-13 06:01:41 -08:00
Ariel Mashraki
a4f82f2331 ent/gen: add indexes to schema modes
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/158

Reviewed By: dlvhdr

Differential Revision: D18476130

fbshipit-source-id: a2003a9a51df6712f18ec58326569c2de7c42b83
2019-11-13 05:58:32 -08:00
Alex Snast
aa57d732c1 ent/entc: correctly cache type info in node.tmpl
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/156

Reviewed By: a8m

Differential Revision: D18429543

fbshipit-source-id: 11bbd9c426878f819ebb2b89978e10948f0730bd
2019-11-12 00:13:43 -08:00
Ariel Mashraki
514c0ff6d3 entc/gen: add support for adding client fields using template
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/155

Reviewed By: alexsn

Differential Revision: D18421223

fbshipit-source-id: 112d4d26d53a64e2c78640c6d508ba2d1d3a7791
2019-11-10 13:29:38 -08:00