mirror of
https://github.com/ent/ent.git
synced 2026-05-05 00:50:54 +03:00
go: bump go/packages version ci to 1.18+1.19 (#2832)
* bumped pkg golang.org/x/tools version to address issue #2826 * .github: update go1.19 in go generate Co-authored-by: Ankit Patial <ankitpatial@gmail.com>
This commit is contained in:
committed by
Ariel Mashraki
parent
89007ec983
commit
47972774c5
@@ -111,7 +111,6 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
|
||||
// Group.
|
||||
// Query().
|
||||
// Count(ctx)
|
||||
//
|
||||
func (c *Client) Debug() *Client {
|
||||
if c.debug {
|
||||
return c
|
||||
|
||||
@@ -87,7 +87,6 @@ type AggregateFunc func(*sql.Selector) string
|
||||
// GroupBy(field1, field2).
|
||||
// Aggregate(ent.As(ent.Sum(field1), "sum_field1"), (ent.As(ent.Sum(field2), "sum_field2")).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func As(fn AggregateFunc, end string) AggregateFunc {
|
||||
return func(s *sql.Selector) string {
|
||||
return sql.As(fn(s), end)
|
||||
|
||||
@@ -302,7 +302,6 @@ func (gq *GroupQuery) WithUsers(opts ...func(*UserQuery)) *GroupQuery {
|
||||
// GroupBy(group.FieldName).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (gq *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy {
|
||||
grbuild := &GroupGroupBy{config: gq.config}
|
||||
grbuild.fields = append([]string{field}, fields...)
|
||||
@@ -329,7 +328,6 @@ func (gq *GroupQuery) GroupBy(field string, fields ...string) *GroupGroupBy {
|
||||
// client.Group.Query().
|
||||
// Select(group.FieldName).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (gq *GroupQuery) Select(fields ...string) *GroupSelect {
|
||||
gq.fields = append(gq.fields, fields...)
|
||||
selbuild := &GroupSelect{GroupQuery: gq}
|
||||
|
||||
@@ -134,7 +134,6 @@ func HasFields(field string, fields ...string) Condition {
|
||||
// If executes the given hook under condition.
|
||||
//
|
||||
// hook.If(ComputeAverage, And(HasFields(...), HasAddedFields(...)))
|
||||
//
|
||||
func If(hk ent.Hook, cond Condition) ent.Hook {
|
||||
return func(next ent.Mutator) ent.Mutator {
|
||||
return ent.MutateFunc(func(ctx context.Context, m ent.Mutation) (ent.Value, error) {
|
||||
@@ -149,7 +148,6 @@ func If(hk ent.Hook, cond Condition) ent.Hook {
|
||||
// On executes the given hook only for the given operation.
|
||||
//
|
||||
// hook.On(Log, ent.Delete|ent.Create)
|
||||
//
|
||||
func On(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
return If(hk, HasOp(op))
|
||||
}
|
||||
@@ -157,7 +155,6 @@ func On(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
// Unless skips the given hook only for the given operation.
|
||||
//
|
||||
// hook.Unless(Log, ent.Update|ent.UpdateOne)
|
||||
//
|
||||
func Unless(hk ent.Hook, op ent.Op) ent.Hook {
|
||||
return If(hk, Not(HasOp(op)))
|
||||
}
|
||||
@@ -178,7 +175,6 @@ func FixedError(err error) ent.Hook {
|
||||
// Reject(ent.Delete|ent.Update),
|
||||
// }
|
||||
// }
|
||||
//
|
||||
func Reject(op ent.Op) ent.Hook {
|
||||
hk := FixedError(fmt.Errorf("%s operation is not allowed", op))
|
||||
return On(hk, op)
|
||||
|
||||
@@ -60,10 +60,9 @@ func Create(ctx context.Context, s *Schema, tables []*schema.Table, opts ...sche
|
||||
|
||||
// WriteTo writes the schema changes to w instead of running them against the database.
|
||||
//
|
||||
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
|
||||
// if err := client.Schema.WriteTo(context.Background(), os.Stdout); err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
//
|
||||
// }
|
||||
func (s *Schema) WriteTo(ctx context.Context, w io.Writer, opts ...schema.MigrateOption) error {
|
||||
return Create(ctx, &Schema{drv: &schema.WriteDriver{Writer: w, Driver: s.drv}}, Tables, opts...)
|
||||
}
|
||||
|
||||
@@ -302,7 +302,6 @@ func (uq *UserQuery) WithGroups(opts ...func(*GroupQuery)) *UserQuery {
|
||||
// GroupBy(user.FieldAge).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy {
|
||||
grbuild := &UserGroupBy{config: uq.config}
|
||||
grbuild.fields = append([]string{field}, fields...)
|
||||
@@ -329,7 +328,6 @@ func (uq *UserQuery) GroupBy(field string, fields ...string) *UserGroupBy {
|
||||
// client.User.Query().
|
||||
// Select(user.FieldAge).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (uq *UserQuery) Select(fields ...string) *UserSelect {
|
||||
uq.fields = append(uq.fields, fields...)
|
||||
selbuild := &UserSelect{UserQuery: uq}
|
||||
|
||||
Reference in New Issue
Block a user