8000 schema/field: correctly extract package names from type identifier by a8m · Pull Request #2765 · ent/ent · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

schema/field: correctly extract package names from type identifier #2765

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
Jul 17, 2022
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
2 changes: 1 addition & 1 deletion entc/gen/template/import.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
{{- range $f := $fields }}
{{- $pkg := $f.Type.PkgPath }}
{{- if and $pkg (not (hasImport (base $pkg ))) }}
{{- $name := trim (index (split $f.Type.RType.Ident ".") 0) "[]*" }}
{{- $name := $f.Type.PkgName }}
{{ if ne $name (base $pkg) }}{{ $name }} {{ end}}"{{ $pkg }}"
{{- end }}
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion entc/integration/edgeschema/ent/internal/schema.go

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion entc/integration/ent/entql.go

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

1 change: 1 addition & 0 deletions entc/integration/ent/migrate/schema.go

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

80 changes: 78 additions & 2 deletions entc/integration/ent/mutation.go

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

2 changes: 2 additions & 0 deletions entc/integration/ent/schema/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ func (Task) Fields() []ent.Field {
Validate(func(i int) error {
return task.Priority(i).Validate()
}),
field.JSON("priorities", map[string]task.Priority{}).
Optional(),
}
}
16 changes: 16 additions & 0 deletions entc/integration/ent/task.go

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

3 changes: 3 additions & 0 deletions entc/integration/ent/task/task.go

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

14 changes: 14 additions & 0 deletions entc/integration/ent/task/where.go

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

74 changes: 74 additions & 0 deletions entc/integration/ent/task_create.go

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

Loading
0