mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +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
@@ -105,7 +105,6 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
|
||||
// File.
|
||||
// Query().
|
||||
// Count(ctx)
|
||||
//
|
||||
func (c *Client) Debug() *Client {
|
||||
if c.debug {
|
||||
return c
|
||||
|
||||
@@ -85,7 +85,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)
|
||||
|
||||
@@ -336,7 +336,6 @@ func (fq *FileQuery) WithChildren(opts ...func(*FileQuery)) *FileQuery {
|
||||
// GroupBy(file.FieldName).
|
||||
// Aggregate(ent.Count()).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy {
|
||||
grbuild := &FileGroupBy{config: fq.config}
|
||||
grbuild.fields = append([]string{field}, fields...)
|
||||
@@ -363,7 +362,6 @@ func (fq *FileQuery) GroupBy(field string, fields ...string) *FileGroupBy {
|
||||
// client.File.Query().
|
||||
// Select(file.FieldName).
|
||||
// Scan(ctx, &v)
|
||||
//
|
||||
func (fq *FileQuery) Select(fields ...string) *FileSelect {
|
||||
fq.fields = append(fq.fields, fields...)
|
||||
selbuild := &FileSelect{FileQuery: fq}
|
||||
|
||||
@@ -121,7 +121,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) {
|
||||
@@ -136,7 +135,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))
|
||||
}
|
||||
@@ -144,7 +142,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)))
|
||||
}
|
||||
@@ -165,7 +162,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...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user