mirror of
https://github.com/ent/ent.git
synced 2026-05-28 09:49:08 +03:00
entc/gen: add context.Context to to query builder (#1195)
* Add ctx to dialectQuery * go generate
This commit is contained in:
@@ -67,7 +67,7 @@ func (cq *CityQuery) QueryStreets() *StreetQuery {
|
||||
if err := cq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
selector := cq.sqlQuery()
|
||||
selector := cq.sqlQuery(ctx)
|
||||
if err := selector.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -303,7 +303,7 @@ func (cq *CityQuery) GroupBy(field string, fields ...string) *CityGroupBy {
|
||||
if err := cq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return cq.sqlQuery(), nil
|
||||
return cq.sqlQuery(ctx), nil
|
||||
}
|
||||
return group
|
||||
}
|
||||
@@ -460,7 +460,7 @@ func (cq *CityQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (cq *CityQuery) sqlQuery() *sql.Selector {
|
||||
func (cq *CityQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(cq.driver.Dialect())
|
||||
t1 := builder.Table(city.Table)
|
||||
selector := builder.Select(t1.Columns(city.Columns...)...).From(t1)
|
||||
@@ -755,7 +755,7 @@ func (cs *CitySelect) Scan(ctx context.Context, v interface{}) error {
|
||||
if err := cs.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
cs.sql = cs.CityQuery.sqlQuery()
|
||||
cs.sql = cs.CityQuery.sqlQuery(ctx)
|
||||
return cs.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ func (sq *StreetQuery) QueryCity() *CityQuery {
|
||||
if err := sq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
selector := sq.sqlQuery()
|
||||
selector := sq.sqlQuery(ctx)
|
||||
if err := selector.Err(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -303,7 +303,7 @@ func (sq *StreetQuery) GroupBy(field string, fields ...string) *StreetGroupBy {
|
||||
if err := sq.prepareQuery(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return sq.sqlQuery(), nil
|
||||
return sq.sqlQuery(ctx), nil
|
||||
}
|
||||
return group
|
||||
}
|
||||
@@ -463,7 +463,7 @@ func (sq *StreetQuery) querySpec() *sqlgraph.QuerySpec {
|
||||
return _spec
|
||||
}
|
||||
|
||||
func (sq *StreetQuery) sqlQuery() *sql.Selector {
|
||||
func (sq *StreetQuery) sqlQuery(ctx context.Context) *sql.Selector {
|
||||
builder := sql.Dialect(sq.driver.Dialect())
|
||||
t1 := builder.Table(street.Table)
|
||||
selector := builder.Select(t1.Columns(street.Columns...)...).From(t1)
|
||||
@@ -758,7 +758,7 @@ func (ss *StreetSelect) Scan(ctx context.Context, v interface{}) error {
|
||||
if err := ss.prepareQuery(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
ss.sql = ss.StreetQuery.sqlQuery()
|
||||
ss.sql = ss.StreetQuery.sqlQuery(ctx)
|
||||
return ss.sqlScan(ctx, v)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user