entc/gen: allow users to alter Query initialization using templates (#1453)

* Templating: Allow user to alter Query struct init

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

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

* pr feedback

* renamed template

* changed sql to *

* to tabs

* removed old template

* update bin-data

* Update entc/integration/template/ent/template/query.tmpl

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

* restore newline

* update bindata

Co-authored-by: Ariel Mashraki <7413593+a8m@users.noreply.github.com>
This commit is contained in:
Ciaran Liedeman
2021-04-14 13:04:29 +02:00
committed by GitHub
parent f59e25d228
commit eff6552989
36 changed files with 330 additions and 101 deletions

View File

@@ -206,7 +206,9 @@ func (c *CommentClient) DeleteOneID(id int) *CommentDeleteOne {
// Query returns a query builder for Comment.
func (c *CommentClient) Query() *CommentQuery {
return &CommentQuery{config: c.config}
return &CommentQuery{
config: c.config,
}
}
// Get returns a Comment entity by its id.
@@ -310,7 +312,9 @@ func (c *PostClient) DeleteOneID(id int) *PostDeleteOne {
// Query returns a query builder for Post.
func (c *PostClient) Query() *PostQuery {
return &PostQuery{config: c.config}
return &PostQuery{
config: c.config,
}
}
// Get returns a Post entity by its id.
@@ -430,7 +434,9 @@ func (c *UserClient) DeleteOneID(id int) *UserDeleteOne {
// Query returns a query builder for User.
func (c *UserClient) Query() *UserQuery {
return &UserQuery{config: c.config}
return &UserQuery{
config: c.config,
}
}
// Get returns a User entity by its id.