entc/gen: merge ivanvanderbyl:add-json-type-to-entql (#1112)

* Generate JSON types for entql

* Correctly normalize name of json type in generated code

* Override interface types for entql wheres

* Actually call correct method

* Implement better interface name stringer

* Define JsonP in template

* Cleanup and fix tests

* Remove extra json predicates

* Remove JSON predicates and use BytesP

* Regenerate

* Update entc/gen/template/dialect/sql/entql.tmpl

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

* Update entql/internal/gen.go

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

* Fix comment

* all: regenerate assets

Co-authored-by: Ivan Vanderbyl <ivanvanderbyl@gmail.com>
Co-authored-by: Ivan Vanderbyl <ivanvanderbyl@users.noreply.github.com>
This commit is contained in:
Ariel Mashraki
2021-01-01 16:06:10 +02:00
committed by GitHub
parent 4a1ac1eef1
commit 069793dd03
13 changed files with 197 additions and 11 deletions

View File

@@ -35,8 +35,8 @@ func Example_PrivacyTenant() {
// Output:
// Tenant(id=1, name=GitHub)
// Tenant(id=2, name=GitLab)
// User(id=1, name=a8m)
// User(id=2, name=nati)
// User(id=1, name=a8m, foods=[])
// User(id=2, name=nati, foods=[Sushi Burritos])
// Group(id=1, name=entgo.io)
}
@@ -66,7 +66,7 @@ func Do(ctx context.Context, client *ent.Client) error {
// Create 2 users connected to the 2 tenants we created above (a8m->GitHub, nati->GitLab).
a8m := client.User.Create().SetName("a8m").SetTenant(hub).SaveX(admin)
nati := client.User.Create().SetName("nati").SetTenant(lab).SaveX(admin)
nati := client.User.Create().SetName("nati").SetTenant(lab).SetFoods([]string{"Sushi", "Burritos"}).SaveX(admin)
hubView := viewer.NewContext(ctx, viewer.UserViewer{T: hub})
out := client.User.Query().OnlyX(hubView)