Commit Graph

356 Commits

Author SHA1 Message Date
Ariel Mashraki
26ccecdf6d dialect/sql/sqlgraph: add initial work for nodes-count 2019-12-12 17:14:34 +02:00
Ariel Mashraki
486c540ecc Merge pull request #232 from facebookincubator/sqlgraph/query
dialect/sql/sqlgraph: first work on nodes querying
2019-12-12 17:00:46 +02:00
Ariel Mashraki
4ab244cf93 dialect/sql/sqlgraph: first work on nodes querying 2019-12-12 12:56:31 +02:00
Ariel Mashraki
a23008a983 Merge pull request #231 from facebookincubator/sqlgraph/delete
dialect/sql/sqlgraph: delete nodes in the graph
2019-12-11 15:41:13 +02:00
Ariel Mashraki
9f324ce030 dialect/sql/sqlgraph: delete nodes in the graph 2019-12-11 15:39:20 +02:00
Ariel Mashraki
ddd69ec90a Merge pull request #230 from facebookincubator/sqlgraph/update
sqlgraph/update
2019-12-11 14:59:47 +02:00
Ariel Mashraki
429e331b32 dialect/sql/sqlgraph: add edge tests for nodes update 2019-12-11 14:41:27 +02:00
Jian Li
e84da15b37 fix predicates doc type error (#229) 2019-12-11 07:39:14 +02:00
Ariel Mashraki
876e454d1e dialect/sql/sqlgraph: add rest of edges to update-nodes 2019-12-10 21:22:09 +02:00
Ariel Mashraki
330061fbf1 Merge pull request #228 from facebookincubator/sqlgraph/update
dialect/sql/sqlgraph: update nodes using predicate
2019-12-10 17:29:01 +02:00
Ariel Mashraki
f86e39f179 dialect/sql/sqlgraph: update nodes using predicate
Currently, only fields and own-FK.
Next PR will edge types: M2M, O2M and O2O (non-inverse).
2019-12-10 17:17:35 +02:00
Ariel Mashraki
d2b65749e3 Merge pull request #226 from facebookincubator/doc/edge-examples
doc: fix example link in edges doc
2019-12-09 09:34:08 +02:00
Ariel Mashraki
8f3f496308 doc: fix example link in edges doc 2019-12-09 09:31:18 +02:00
Ariel Mashraki
75c70bac1b Merge pull request #225 from facebookincubator/examples/regen
examples: regenerate assets
2019-12-09 09:14:55 +02:00
Ariel Mashraki
ef7a1ed300 examples: make examples testable 2019-12-09 09:05:05 +02:00
Ariel Mashraki
754a8c9daa examples: regenerate assets 2019-12-09 08:13:34 +02:00
Ariel Mashraki
f65cf5150e dialect/sqlscan: add interface{} scanning support
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/223

Reviewed By: alexsn

Differential Revision: D18878581

fbshipit-source-id: 4a60ceea6c092f065e52e6b3bb625487451a815d
2019-12-08 21:59:53 -08: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
bb051603ac dialect/sqlgraph: add edges in node creation (#216)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/216

WIP - ignore for now

Reviewed By: alexsn

Differential Revision: D18795361

fbshipit-source-id: d3a4ef5562be5faf0837cad6364130ec203a9d37
2019-12-04 09:44:50 -08:00
Ariel Mashraki
a5e4a9cf54 dialect/sqlscan: add ScanInt64 to be used by sqlgraph
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/213

Reviewed By: alexsn

Differential Revision: D18763694

fbshipit-source-id: 890b35fcc2a28914b276ce65477788b4ddaeebf9
2019-12-03 01:44:48 -08:00
Ariel Mashraki
a4fac2db3b dialect/sqlgraph: initial work for create-node api (#211)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/211

Move out the logic from the Go templates to Go code.

Next diff will add the edges of the node.

Reviewed By: alexsn

Differential Revision: D18762049

fbshipit-source-id: c9a93672415a26a6f4a7d466e569b8b0e8b0f9ee
2019-12-02 08:12:13 -08:00
Ariel Mashraki
0f4fc12cc5 dialect/sql: support recursive pointer types
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/210

Reviewed By: alexsn

Differential Revision: D18757642

fbshipit-source-id: 6dec318f68e2f14f1c7ffdf2dcd185be130b2f77
2019-12-01 05:54:52 -08:00
Ariel Mashraki
80dab06a57 dialect/sql: match column scan with sql tag
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/209

Reviewed By: alexsn

Differential Revision: D18757390

fbshipit-source-id: 534a8404a06487d90f1f4f10b1f93c774bac2e97
2019-12-01 03:21:38 -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
f98dbbc440 dialect/sql/schema: remove Go 1.13 string features
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/207

Reviewed By: xjtian

Differential Revision: D18743529

fbshipit-source-id: f6420e9ca233e0ce6f9254b4f85d1711ee4d4bfa
2019-11-28 03:16:55 -08:00
Ariel Mashraki
5610d0ade9 dialect/sqlgraph: fix neighbors check with predicates
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/206

Reviewed By: alexsn

Differential Revision: D18729641

fbshipit-source-id: a5d333132ae276691ac8c1b084bc5d2037112529
2019-11-27 23:50:00 -08:00
Ariel Mashraki
29c7b0a0d8 dialect/sql: remove Go1.13 specific features
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/205

Reviewed By: alexsn

Differential Revision: D18742422

fbshipit-source-id: 1e1996fe26787788e4c0466a58884b4fa0581353
2019-11-27 23:14:24 -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
6fe565f059 dialect/sqlgraph: add builder with functional options for neighbors steps
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/199

Reviewed By: alexsn

Differential Revision: D18707950

fbshipit-source-id: 77e5308dc4f984306c131d8541cbbd60d82a1488
2019-11-26 12:42:47 -08:00
Ariel Mashraki
413bbad8d8 dialect/sqlgraph: fix M2O relation in neighbors-with check
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/198

Reviewed By: alexsn

Differential Revision: D18707741

fbshipit-source-id: 69dd010e27ee07ffe44acc12003b9772220aaa2a
2019-11-26 12:42:47 -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
be307dab3c dialect/sql: type alias txoptions
Reviewed By: alexsn

Differential Revision: D18689199

fbshipit-source-id: 7606a3a24beb286d464b64eb2e51a1257fbffdcd
2019-11-25 10:13:59 -08:00
Ariel Mashraki
1bf83dd65f dialect/sql: add BeginTx for sql driver
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/193

Reviewed By: dlvhdr

Differential Revision: D18685934

fbshipit-source-id: abc4bf0b14ece3827bc20ecb864e7ca0594c2759
2019-11-25 07:29:52 -08: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
038dc2899a dialect/sqlgraph: test and fix M2M neighbors check
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/190

Reviewed By: alexsn

Differential Revision: D18680440

fbshipit-source-id: b2dce0ee3e0a898fab901c4287c6c1c1844e51d6
2019-11-24 22:34:28 -08:00
Ariel Mashraki
0344904a4e cmd/entc: support custom target on codegen (#189)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/189

Fixes #61

Reviewed By: alexsn

Differential Revision: D18676988

fbshipit-source-id: 00d415e14d1278a45edea49c69abe4916303f55d
2019-11-24 08:06:08 -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
e6c6442c84 cmd/entc: load package path for arbitrary file paths (#186)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/186

This is an ongoing work for fixing #61 (Github issue)

Reviewed By: alexsn

Differential Revision: D18672982

fbshipit-source-id: 12051d7b06d87d73d37b68382566732e532193e3
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
7fb6238d18 dialect/sql: add hasneighborswith for predicates
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/185

Reviewed By: alexsn

Differential Revision: D18661688

fbshipit-source-id: 4c60fa5e81372f10bfecf4f166b048784bc515ee
2019-11-24 07:11:22 -08:00
Ariel Mashraki
0fc310e600 sql/dialect/schema: ignore foreign-keys in index dropping
Summary: Pull Request resolved: https://github.com/facebookincubator/ent/pull/188

Reviewed By: alexsn

Differential Revision: D18676877

fbshipit-source-id: 0babe457edadfa46dcbc7c7478d4468c48f84361
2019-11-24 05:32:22 -08:00
Ariel Mashraki
2543d90167 dialect/sql: add hasneigbors for predicates (#184)
Summary:
Pull Request resolved: https://github.com/facebookincubator/ent/pull/184

This diff is part of the ongoing effort for moving the sql logic out from codegen.

Reviewed By: alexsn

Differential Revision: D18656817

fbshipit-source-id: 71001d37eb78032414c2f83f200d3011b50c114b
2019-11-24 04:16:36 -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