8000 entc/gen: add default json tag for edge fields by a8m · Pull Request #1204 · ent/ent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

entc/gen: add default json tag for edge fields #1204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions entc/gen/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func (g *Graph) addEdges(schema *load.Schema) {
Owner: t,
Unique: e.Unique,
Optional: !e.Required,
StructTag: e.Tag,
StructTag: structTag(e.Name, e.Tag),
Annotations: e.Annotations,
})
// Inverse only.
Expand All @@ -260,7 +260,7 @@ func (g *Graph) addEdges(schema *load.Schema) {
Inverse: e.RefName,
Unique: e.Unique,
Optional: !e.Required,
StructTag: e.Tag,
StructTag: structTag(e.Name, e.Tag),
Annotations: e.Annotations,
})
// Inverse and assoc.
Expand All @@ -276,7 +276,7 @@ func (g *Graph) addEdges(schema *load.Schema) {
Inverse: ref.Name,
Unique: e.Unique,
Optional: !e.Required,
StructTag: e.Tag,
StructTag: structTag(e.Name, e.Tag),
Annotations: e.Annotations,
}, &Edge{
def: e,
Expand All @@ -285,7 +285,7 @@ func (g *Graph) addEdges(schema *load.Schema) {
Name: ref.Name,
Unique: ref.Unique,
Optional: !ref.Required,
StructTag: ref.Tag,
StructTag: structTag(ref.Name, ref.Tag),
Annotations: ref.Annotations,
})
default:
Expand Down
4 changes: 2 additions & 2 deletions entc/integration/customid/ent/blob.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/customid/ent/car.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/customid/ent/group.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions entc/integration/customid/ent/pet.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions entc/integration/customid/ent/user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions entc/integration/ent/card.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions entc/integration/ent/file.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/ent/filetype.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions entc/integration/ent/group.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/ent/groupinfo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions entc/integration/ent/node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions entc/integration/ent/pet.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions entc/integration/ent/schema/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ func (Node) Fields() []ent.Field {
func (Node) Edges() []ent.Edge {
return []ent.Edge{
edge.To("next", Node.Type).
StructTag("gqlgen:next").
StructTag(`gqlgen:"next"`).
Unique().
From("prev").
StructTag("gqlgen:prev").
StructTag(`gqlgen:"prev"`).
Unique(),
}
}
2 changes: 1 addition & 1 deletion entc/integration/ent/spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions entc/integration/ent/user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions entc/integration/gremlin/ent/card.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions entc/integration/gremlin/ent/file.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/gremlin/ent/filetype.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions entc/integration/gremlin/ent/group.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/gremlin/ent/groupinfo.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions entc/integration/gremlin/ent/node.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions entc/integration/gremlin/ent/pet.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/gremlin/ent/spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions entc/integration/gremlin/ent/user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion entc/integration/hooks/ent/card.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
0