From 26fd8967817b1fa028232daa865d35e32b80b778 Mon Sep 17 00:00:00 2001 From: rs Date: Sun, 30 Apr 2023 18:45:05 +0500 Subject: [PATCH] chore: commit generated files --- example/api/oas_cfg_gen.go | 5 ++-- example/api/oas_client_gen.go | 9 ++++---- example/api/oas_handlers_gen.go | 7 +++--- example/api/oas_json_gen.go | 13 ----------- example/ent/keyboard/keyboard.go | 16 ++++++------- example/ent/keyboard_query.go | 6 ++--- example/ent/keycapmodel/keycapmodel.go | 12 +++++----- example/ent/keycapmodel_query.go | 6 ++--- example/ent/runtime/runtime.go | 4 ++-- example/ent/switchmodel/switchmodel.go | 10 ++++---- example/ent/switchmodel_query.go | 6 ++--- internal/test/api/oas_cfg_gen.go | 5 ++-- internal/test/api/oas_client_gen.go | 9 ++++---- internal/test/api/oas_handlers_gen.go | 7 +++--- internal/test/api/oas_json_gen.go | 10 -------- internal/test/ent/runtime/runtime.go | 4 ++-- internal/test/ent/schemaa/schemaa.go | 32 +++++++++++++------------- internal/test/ent/schemaa_query.go | 10 ++++---- internal/test/ent/schemab/schemab.go | 6 ++--- internal/test/ent/schemab_query.go | 6 ++--- 20 files changed, 83 insertions(+), 100 deletions(-) diff --git a/example/api/oas_cfg_gen.go b/example/api/oas_cfg_gen.go index 200975a..2674bd0 100644 --- a/example/api/oas_cfg_gen.go +++ b/example/api/oas_cfg_gen.go @@ -7,6 +7,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/trace" @@ -40,7 +41,7 @@ func (cfg *otelConfig) initOTEL() { cfg.TracerProvider = otel.GetTracerProvider() } if cfg.MeterProvider == nil { - cfg.MeterProvider = metric.NewNoopMeterProvider() + cfg.MeterProvider = global.MeterProvider() } cfg.Tracer = cfg.TracerProvider.Tracer(otelogen.Name, trace.WithInstrumentationVersion(otelogen.SemVersion()), @@ -200,7 +201,7 @@ func WithTracerProvider(provider trace.TracerProvider) Option { // WithMeterProvider specifies a meter provider to use for creating a meter. // -// If none is specified, the metric.NewNoopMeterProvider is used. +// If none is specified, the global.MeterProvider() is used. func WithMeterProvider(provider metric.MeterProvider) Option { return otelOptionFunc(func(cfg *otelConfig) { if provider != nil { diff --git a/example/api/oas_client_gen.go b/example/api/oas_client_gen.go index ce9e8cc..af7563d 100644 --- a/example/api/oas_client_gen.go +++ b/example/api/oas_client_gen.go @@ -11,6 +11,7 @@ import ( "github.com/go-faster/errors" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/trace" "github.com/ogen-go/ogen/conv" @@ -85,11 +86,11 @@ func (c *Client) sendGetKeyboard(ctx context.Context, params GetKeyboardParams) startTime := time.Now() defer func() { elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + c.duration.Record(ctx, elapsedDuration.Microseconds(), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. - c.requests.Add(ctx, 1, otelAttrs...) + c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) // Start a span for this request. ctx, span := c.cfg.Tracer.Start(ctx, "GetKeyboard", @@ -102,7 +103,7 @@ func (c *Client) sendGetKeyboard(ctx context.Context, params GetKeyboardParams) if err != nil { span.RecordError(err) span.SetStatus(codes.Error, stage) - c.errors.Add(ctx, 1, otelAttrs...) + c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) } span.End() }() @@ -132,7 +133,7 @@ func (c *Client) sendGetKeyboard(ctx context.Context, params GetKeyboardParams) uri.AddPathParts(u, pathParts[:]...) stage = "EncodeRequest" - r, err := ht.NewRequest(ctx, "GET", u, nil) + r, err := ht.NewRequest(ctx, "GET", u) if err != nil { return res, errors.Wrap(err, "create request") } diff --git a/example/api/oas_handlers_gen.go b/example/api/oas_handlers_gen.go index fb7ad97..78f9dcf 100644 --- a/example/api/oas_handlers_gen.go +++ b/example/api/oas_handlers_gen.go @@ -9,6 +9,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" @@ -38,17 +39,17 @@ func (s *Server) handleGetKeyboardRequest(args [1]string, argsEscaped bool, w ht startTime := time.Now() defer func() { elapsedDuration := time.Since(startTime) - s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + s.duration.Record(ctx, elapsedDuration.Microseconds(), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. - s.requests.Add(ctx, 1, otelAttrs...) + s.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) var ( recordError = func(stage string, err error) { span.RecordError(err) span.SetStatus(codes.Error, stage) - s.errors.Add(ctx, 1, otelAttrs...) + s.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) } err error opErrContext = ogenerrors.OperationContext{ diff --git a/example/api/oas_json_gen.go b/example/api/oas_json_gen.go index 3c75ba4..400abf4 100644 --- a/example/api/oas_json_gen.go +++ b/example/api/oas_json_gen.go @@ -22,32 +22,26 @@ func (s *Keyboard) Encode(e *jx.Encoder) { // encodeFields encodes fields. func (s *Keyboard) encodeFields(e *jx.Encoder) { { - e.FieldStart("id") e.Int64(s.ID) } { - e.FieldStart("name") e.Str(s.Name) } { - e.FieldStart("switches") s.Switches.Encode(e) } { - e.FieldStart("keycaps") s.Keycaps.Encode(e) } { - e.FieldStart("price") e.Int64(s.Price) } { - e.FieldStart("discount") s.Discount.Encode(e) } @@ -203,22 +197,18 @@ func (s *Keycaps) Encode(e *jx.Encoder) { // encodeFields encodes fields. func (s *Keycaps) encodeFields(e *jx.Encoder) { { - e.FieldStart("id") e.Int64(s.ID) } { - e.FieldStart("name") e.Str(s.Name) } { - e.FieldStart("profile") e.Str(s.Profile) } { - e.FieldStart("material") s.Material.Encode(e) } @@ -438,17 +428,14 @@ func (s *Switches) Encode(e *jx.Encoder) { // encodeFields encodes fields. func (s *Switches) encodeFields(e *jx.Encoder) { { - e.FieldStart("id") e.Int64(s.ID) } { - e.FieldStart("name") e.Str(s.Name) } { - e.FieldStart("switch_type") s.SwitchType.Encode(e) } diff --git a/example/ent/keyboard/keyboard.go b/example/ent/keyboard/keyboard.go index b281911..ff44d20 100644 --- a/example/ent/keyboard/keyboard.go +++ b/example/ent/keyboard/keyboard.go @@ -75,38 +75,38 @@ var ( NameValidator func(string) error ) -// Order defines the ordering method for the Keyboard queries. -type Order func(*sql.Selector) +// OrderOption defines the ordering options for the Keyboard queries. +type OrderOption func(*sql.Selector) // ByID orders the results by the id field. -func ByID(opts ...sql.OrderTermOption) Order { +func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByName orders the results by the name field. -func ByName(opts ...sql.OrderTermOption) Order { +func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() } // ByPrice orders the results by the price field. -func ByPrice(opts ...sql.OrderTermOption) Order { +func ByPrice(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPrice, opts...).ToFunc() } // ByDiscount orders the results by the discount field. -func ByDiscount(opts ...sql.OrderTermOption) Order { +func ByDiscount(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDiscount, opts...).ToFunc() } // BySwitchesField orders the results by switches field. -func BySwitchesField(field string, opts ...sql.OrderTermOption) Order { +func BySwitchesField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newSwitchesStep(), sql.OrderByField(field, opts...)) } } // ByKeycapsField orders the results by keycaps field. -func ByKeycapsField(field string, opts ...sql.OrderTermOption) Order { +func ByKeycapsField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newKeycapsStep(), sql.OrderByField(field, opts...)) } diff --git a/example/ent/keyboard_query.go b/example/ent/keyboard_query.go index 891b35a..ebfc06b 100644 --- a/example/ent/keyboard_query.go +++ b/example/ent/keyboard_query.go @@ -20,7 +20,7 @@ import ( type KeyboardQuery struct { config ctx *QueryContext - order []keyboard.Order + order []keyboard.OrderOption inters []Interceptor predicates []predicate.Keyboard withSwitches *SwitchModelQuery @@ -57,7 +57,7 @@ func (kq *KeyboardQuery) Unique(unique bool) *KeyboardQuery { } // Order specifies how the records should be ordered. -func (kq *KeyboardQuery) Order(o ...keyboard.Order) *KeyboardQuery { +func (kq *KeyboardQuery) Order(o ...keyboard.OrderOption) *KeyboardQuery { kq.order = append(kq.order, o...) return kq } @@ -295,7 +295,7 @@ func (kq *KeyboardQuery) Clone() *KeyboardQuery { return &KeyboardQuery{ config: kq.config, ctx: kq.ctx.Clone(), - order: append([]keyboard.Order{}, kq.order...), + order: append([]keyboard.OrderOption{}, kq.order...), inters: append([]Interceptor{}, kq.inters...), predicates: append([]predicate.Keyboard{}, kq.predicates...), withSwitches: kq.withSwitches.Clone(), diff --git a/example/ent/keycapmodel/keycapmodel.go b/example/ent/keycapmodel/keycapmodel.go index 6cadc81..bd85d19 100644 --- a/example/ent/keycapmodel/keycapmodel.go +++ b/example/ent/keycapmodel/keycapmodel.go @@ -69,25 +69,25 @@ func MaterialValidator(m Material) error { } } -// Order defines the ordering method for the KeycapModel queries. -type Order func(*sql.Selector) +// OrderOption defines the ordering options for the KeycapModel queries. +type OrderOption func(*sql.Selector) // ByID orders the results by the id field. -func ByID(opts ...sql.OrderTermOption) Order { +func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByName orders the results by the name field. -func ByName(opts ...sql.OrderTermOption) Order { +func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() } // ByProfile orders the results by the profile field. -func ByProfile(opts ...sql.OrderTermOption) Order { +func ByProfile(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldProfile, opts...).ToFunc() } // ByMaterial orders the results by the material field. -func ByMaterial(opts ...sql.OrderTermOption) Order { +func ByMaterial(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldMaterial, opts...).ToFunc() } diff --git a/example/ent/keycapmodel_query.go b/example/ent/keycapmodel_query.go index c85fabe..ad5f076 100644 --- a/example/ent/keycapmodel_query.go +++ b/example/ent/keycapmodel_query.go @@ -18,7 +18,7 @@ import ( type KeycapModelQuery struct { config ctx *QueryContext - order []keycapmodel.Order + order []keycapmodel.OrderOption inters []Interceptor predicates []predicate.KeycapModel // intermediate query (i.e. traversal path). @@ -52,7 +52,7 @@ func (kmq *KeycapModelQuery) Unique(unique bool) *KeycapModelQuery { } // Order specifies how the records should be ordered. -func (kmq *KeycapModelQuery) Order(o ...keycapmodel.Order) *KeycapModelQuery { +func (kmq *KeycapModelQuery) Order(o ...keycapmodel.OrderOption) *KeycapModelQuery { kmq.order = append(kmq.order, o...) return kmq } @@ -246,7 +246,7 @@ func (kmq *KeycapModelQuery) Clone() *KeycapModelQuery { return &KeycapModelQuery{ config: kmq.config, ctx: kmq.ctx.Clone(), - order: append([]keycapmodel.Order{}, kmq.order...), + order: append([]keycapmodel.OrderOption{}, kmq.order...), inters: append([]Interceptor{}, kmq.inters...), predicates: append([]predicate.KeycapModel{}, kmq.predicates...), // clone intermediate query. diff --git a/example/ent/runtime/runtime.go b/example/ent/runtime/runtime.go index 109ee11..06349ef 100644 --- a/example/ent/runtime/runtime.go +++ b/example/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/ogen-go/ent2ogen/example/ent/runtime.go const ( - Version = "v0.12.0" // Version of ent codegen. - Sum = "h1:DTub/yd0pMK9s0ONfZps2cYkyD2VPIuknVBv10BESc0=" // Sum of ent codegen. + Version = "v0.12.2" // Version of ent codegen. + Sum = "h1:Ndl/JvCX76xCtUDlrUfMnOKBRodAtxE5yfGYxjbOxmM=" // Sum of ent codegen. ) diff --git a/example/ent/switchmodel/switchmodel.go b/example/ent/switchmodel/switchmodel.go index 9934198..d2066b6 100644 --- a/example/ent/switchmodel/switchmodel.go +++ b/example/ent/switchmodel/switchmodel.go @@ -67,20 +67,20 @@ func SwitchTypeValidator(st SwitchType) error { } } -// Order defines the ordering method for the SwitchModel queries. -type Order func(*sql.Selector) +// OrderOption defines the ordering options for the SwitchModel queries. +type OrderOption func(*sql.Selector) // ByID orders the results by the id field. -func ByID(opts ...sql.OrderTermOption) Order { +func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByName orders the results by the name field. -func ByName(opts ...sql.OrderTermOption) Order { +func ByName(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldName, opts...).ToFunc() } // BySwitchType orders the results by the switch_type field. -func BySwitchType(opts ...sql.OrderTermOption) Order { +func BySwitchType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldSwitchType, opts...).ToFunc() } diff --git a/example/ent/switchmodel_query.go b/example/ent/switchmodel_query.go index 9086c25..826728f 100644 --- a/example/ent/switchmodel_query.go +++ b/example/ent/switchmodel_query.go @@ -18,7 +18,7 @@ import ( type SwitchModelQuery struct { config ctx *QueryContext - order []switchmodel.Order + order []switchmodel.OrderOption inters []Interceptor predicates []predicate.SwitchModel // intermediate query (i.e. traversal path). @@ -52,7 +52,7 @@ func (smq *SwitchModelQuery) Unique(unique bool) *SwitchModelQuery { } // Order specifies how the records should be ordered. -func (smq *SwitchModelQuery) Order(o ...switchmodel.Order) *SwitchModelQuery { +func (smq *SwitchModelQuery) Order(o ...switchmodel.OrderOption) *SwitchModelQuery { smq.order = append(smq.order, o...) return smq } @@ -246,7 +246,7 @@ func (smq *SwitchModelQuery) Clone() *SwitchModelQuery { return &SwitchModelQuery{ config: smq.config, ctx: smq.ctx.Clone(), - order: append([]switchmodel.Order{}, smq.order...), + order: append([]switchmodel.OrderOption{}, smq.order...), inters: append([]Interceptor{}, smq.inters...), predicates: append([]predicate.SwitchModel{}, smq.predicates...), // clone intermediate query. diff --git a/internal/test/api/oas_cfg_gen.go b/internal/test/api/oas_cfg_gen.go index 3bbddd8..d702c94 100644 --- a/internal/test/api/oas_cfg_gen.go +++ b/internal/test/api/oas_cfg_gen.go @@ -7,6 +7,7 @@ import ( "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/metric" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/metric/instrument" "go.opentelemetry.io/otel/trace" @@ -40,7 +41,7 @@ func (cfg *otelConfig) initOTEL() { cfg.TracerProvider = otel.GetTracerProvider() } if cfg.MeterProvider == nil { - cfg.MeterProvider = metric.NewNoopMeterProvider() + cfg.MeterProvider = global.MeterProvider() } cfg.Tracer = cfg.TracerProvider.Tracer(otelogen.Name, trace.WithInstrumentationVersion(otelogen.SemVersion()), @@ -200,7 +201,7 @@ func WithTracerProvider(provider trace.TracerProvider) Option { // WithMeterProvider specifies a meter provider to use for creating a meter. // -// If none is specified, the metric.NewNoopMeterProvider is used. +// If none is specified, the global.MeterProvider() is used. func WithMeterProvider(provider metric.MeterProvider) Option { return otelOptionFunc(func(cfg *otelConfig) { if provider != nil { diff --git a/internal/test/api/oas_client_gen.go b/internal/test/api/oas_client_gen.go index 2e950da..90dfbb5 100644 --- a/internal/test/api/oas_client_gen.go +++ b/internal/test/api/oas_client_gen.go @@ -11,6 +11,7 @@ import ( "github.com/go-faster/errors" "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" "go.opentelemetry.io/otel/trace" ht "github.com/ogen-go/ogen/http" @@ -84,11 +85,11 @@ func (c *Client) sendTest(ctx context.Context) (res *SchemaA, err error) { startTime := time.Now() defer func() { elapsedDuration := time.Since(startTime) - c.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + c.duration.Record(ctx, elapsedDuration.Microseconds(), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. - c.requests.Add(ctx, 1, otelAttrs...) + c.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) // Start a span for this request. ctx, span := c.cfg.Tracer.Start(ctx, "Test", @@ -101,7 +102,7 @@ func (c *Client) sendTest(ctx context.Context) (res *SchemaA, err error) { if err != nil { span.RecordError(err) span.SetStatus(codes.Error, stage) - c.errors.Add(ctx, 1, otelAttrs...) + c.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) } span.End() }() @@ -113,7 +114,7 @@ func (c *Client) sendTest(ctx context.Context) (res *SchemaA, err error) { uri.AddPathParts(u, pathParts[:]...) stage = "EncodeRequest" - r, err := ht.NewRequest(ctx, "GET", u, nil) + r, err := ht.NewRequest(ctx, "GET", u) if err != nil { return res, errors.Wrap(err, "create request") } diff --git a/internal/test/api/oas_handlers_gen.go b/internal/test/api/oas_handlers_gen.go index 17ddc27..9cb91eb 100644 --- a/internal/test/api/oas_handlers_gen.go +++ b/internal/test/api/oas_handlers_gen.go @@ -9,6 +9,7 @@ import ( "go.opentelemetry.io/otel/attribute" "go.opentelemetry.io/otel/codes" + "go.opentelemetry.io/otel/metric" semconv "go.opentelemetry.io/otel/semconv/v1.17.0" "go.opentelemetry.io/otel/trace" @@ -37,17 +38,17 @@ func (s *Server) handleTestRequest(args [0]string, argsEscaped bool, w http.Resp startTime := time.Now() defer func() { elapsedDuration := time.Since(startTime) - s.duration.Record(ctx, elapsedDuration.Microseconds(), otelAttrs...) + s.duration.Record(ctx, elapsedDuration.Microseconds(), metric.WithAttributes(otelAttrs...)) }() // Increment request counter. - s.requests.Add(ctx, 1, otelAttrs...) + s.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) var ( recordError = func(stage string, err error) { span.RecordError(err) span.SetStatus(codes.Error, stage) - s.errors.Add(ctx, 1, otelAttrs...) + s.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) } err error ) diff --git a/internal/test/api/oas_json_gen.go b/internal/test/api/oas_json_gen.go index 804cd77..d98008c 100644 --- a/internal/test/api/oas_json_gen.go +++ b/internal/test/api/oas_json_gen.go @@ -201,17 +201,14 @@ func (s *SchemaA) Encode(e *jx.Encoder) { // encodeFields encodes fields. func (s *SchemaA) encodeFields(e *jx.Encoder) { { - e.FieldStart("int64") e.Int64(s.Int64) } { - e.FieldStart("string_foobar_bind") e.Str(s.StringFoobarBind) } { - e.FieldStart("string_optional_nullable") s.StringOptionalNullable.Encode(e) } @@ -222,7 +219,6 @@ func (s *SchemaA) encodeFields(e *jx.Encoder) { } } { - e.FieldStart("jsontype_strings") e.ArrStart() for _, elem := range s.JsontypeStrings { @@ -241,7 +237,6 @@ func (s *SchemaA) encodeFields(e *jx.Encoder) { } } { - e.FieldStart("jsontype_ints") e.ArrStart() for _, elem := range s.JsontypeInts { @@ -260,7 +255,6 @@ func (s *SchemaA) encodeFields(e *jx.Encoder) { } } { - e.FieldStart("required_enum") s.RequiredEnum.Encode(e) } @@ -271,17 +265,14 @@ func (s *SchemaA) encodeFields(e *jx.Encoder) { } } { - e.FieldStart("bytes") e.Base64(s.Bytes) } { - e.FieldStart("edge_schemab_unique_required") s.EdgeSchemabUniqueRequired.Encode(e) } { - e.FieldStart("edge_schemab_unique_required_bs_bind") s.EdgeSchemabUniqueRequiredBsBind.Encode(e) } @@ -706,7 +697,6 @@ func (s *SchemaB) Encode(e *jx.Encoder) { // encodeFields encodes fields. func (s *SchemaB) encodeFields(e *jx.Encoder) { { - e.FieldStart("id") e.Int64(s.ID) } diff --git a/internal/test/ent/runtime/runtime.go b/internal/test/ent/runtime/runtime.go index 19608ad..6ba3085 100644 --- a/internal/test/ent/runtime/runtime.go +++ b/internal/test/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/ogen-go/ent2ogen/internal/test/ent/runtime.go const ( - Version = "v0.12.0" // Version of ent codegen. - Sum = "h1:DTub/yd0pMK9s0ONfZps2cYkyD2VPIuknVBv10BESc0=" // Sum of ent codegen. + Version = "v0.12.2" // Version of ent codegen. + Sum = "h1:Ndl/JvCX76xCtUDlrUfMnOKBRodAtxE5yfGYxjbOxmM=" // Sum of ent codegen. ) diff --git a/internal/test/ent/schemaa/schemaa.go b/internal/test/ent/schemaa/schemaa.go index 5df44ab..80cec5f 100644 --- a/internal/test/ent/schemaa/schemaa.go +++ b/internal/test/ent/schemaa/schemaa.go @@ -171,88 +171,88 @@ func OptionalNullableEnumValidator(one OptionalNullableEnum) error { } } -// Order defines the ordering method for the SchemaA queries. -type Order func(*sql.Selector) +// OrderOption defines the ordering options for the SchemaA queries. +type OrderOption func(*sql.Selector) // ByID orders the results by the id field. -func ByID(opts ...sql.OrderTermOption) Order { +func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } // ByInt64 orders the results by the int64 field. -func ByInt64(opts ...sql.OrderTermOption) Order { +func ByInt64(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldInt64, opts...).ToFunc() } // ByStringBindtoFoobar orders the results by the string_bindto_foobar field. -func ByStringBindtoFoobar(opts ...sql.OrderTermOption) Order { +func ByStringBindtoFoobar(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStringBindtoFoobar, opts...).ToFunc() } // ByStringOptionalNullable orders the results by the string_optional_nullable field. -func ByStringOptionalNullable(opts ...sql.OrderTermOption) Order { +func ByStringOptionalNullable(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldStringOptionalNullable, opts...).ToFunc() } // ByOptionalNullableBool orders the results by the optional_nullable_bool field. -func ByOptionalNullableBool(opts ...sql.OrderTermOption) Order { +func ByOptionalNullableBool(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldOptionalNullableBool, opts...).ToFunc() } // ByRequiredEnum orders the results by the required_enum field. -func ByRequiredEnum(opts ...sql.OrderTermOption) Order { +func ByRequiredEnum(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldRequiredEnum, opts...).ToFunc() } // ByOptionalNullableEnum orders the results by the optional_nullable_enum field. -func ByOptionalNullableEnum(opts ...sql.OrderTermOption) Order { +func ByOptionalNullableEnum(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldOptionalNullableEnum, opts...).ToFunc() } // ByEdgeSchemabUniqueRequiredField orders the results by edge_schemab_unique_required field. -func ByEdgeSchemabUniqueRequiredField(field string, opts ...sql.OrderTermOption) Order { +func ByEdgeSchemabUniqueRequiredField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newEdgeSchemabUniqueRequiredStep(), sql.OrderByField(field, opts...)) } } // ByEdgeSchemabUniqueRequiredBindtoBsField orders the results by edge_schemab_unique_required_bindto_bs field. -func ByEdgeSchemabUniqueRequiredBindtoBsField(field string, opts ...sql.OrderTermOption) Order { +func ByEdgeSchemabUniqueRequiredBindtoBsField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newEdgeSchemabUniqueRequiredBindtoBsStep(), sql.OrderByField(field, opts...)) } } // ByEdgeSchemabUniqueOptionalField orders the results by edge_schemab_unique_optional field. -func ByEdgeSchemabUniqueOptionalField(field string, opts ...sql.OrderTermOption) Order { +func ByEdgeSchemabUniqueOptionalField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newEdgeSchemabUniqueOptionalStep(), sql.OrderByField(field, opts...)) } } // ByEdgeSchemabCount orders the results by edge_schemab count. -func ByEdgeSchemabCount(opts ...sql.OrderTermOption) Order { +func ByEdgeSchemabCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newEdgeSchemabStep(), opts...) } } // ByEdgeSchemab orders the results by edge_schemab terms. -func ByEdgeSchemab(term sql.OrderTerm, terms ...sql.OrderTerm) Order { +func ByEdgeSchemab(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newEdgeSchemabStep(), append([]sql.OrderTerm{term}, terms...)...) } } // ByEdgeSchemaaRecursiveCount orders the results by edge_schemaa_recursive count. -func ByEdgeSchemaaRecursiveCount(opts ...sql.OrderTermOption) Order { +func ByEdgeSchemaaRecursiveCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborsCount(s, newEdgeSchemaaRecursiveStep(), opts...) } } // ByEdgeSchemaaRecursive orders the results by edge_schemaa_recursive terms. -func ByEdgeSchemaaRecursive(term sql.OrderTerm, terms ...sql.OrderTerm) Order { +func ByEdgeSchemaaRecursive(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newEdgeSchemaaRecursiveStep(), append([]sql.OrderTerm{term}, terms...)...) } diff --git a/internal/test/ent/schemaa_query.go b/internal/test/ent/schemaa_query.go index 2fa92b9..58983d3 100644 --- a/internal/test/ent/schemaa_query.go +++ b/internal/test/ent/schemaa_query.go @@ -20,7 +20,7 @@ import ( type SchemaAQuery struct { config ctx *QueryContext - order []schemaa.Order + order []schemaa.OrderOption inters []Interceptor predicates []predicate.SchemaA withEdgeSchemabUniqueRequired *SchemaBQuery @@ -60,7 +60,7 @@ func (sa *SchemaAQuery) Unique(unique bool) *SchemaAQuery { } // Order specifies how the records should be ordered. -func (sa *SchemaAQuery) Order(o ...schemaa.Order) *SchemaAQuery { +func (sa *SchemaAQuery) Order(o ...schemaa.OrderOption) *SchemaAQuery { sa.order = append(sa.order, o...) return sa } @@ -364,7 +364,7 @@ func (sa *SchemaAQuery) Clone() *SchemaAQuery { return &SchemaAQuery{ config: sa.config, ctx: sa.ctx.Clone(), - order: append([]schemaa.Order{}, sa.order...), + order: append([]schemaa.OrderOption{}, sa.order...), inters: append([]Interceptor{}, sa.inters...), predicates: append([]predicate.SchemaA{}, sa.predicates...), withEdgeSchemabUniqueRequired: sa.withEdgeSchemabUniqueRequired.Clone(), @@ -687,7 +687,7 @@ func (sa *SchemaAQuery) loadEdgeSchemab(ctx context.Context, query *SchemaBQuery } query.withFKs = true query.Where(predicate.SchemaB(func(s *sql.Selector) { - s.Where(sql.InValues(schemaa.EdgeSchemabColumn, fks...)) + s.Where(sql.InValues(s.C(schemaa.EdgeSchemabColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { @@ -700,7 +700,7 @@ func (sa *SchemaAQuery) loadEdgeSchemab(ctx context.Context, query *SchemaBQuery } node, ok := nodeids[*fk] if !ok { - return fmt.Errorf(`unexpected foreign-key "schemaa_edge_schemab" returned %v for node %v`, *fk, n.ID) + return fmt.Errorf(`unexpected referenced foreign-key "schemaa_edge_schemab" returned %v for node %v`, *fk, n.ID) } assign(node, n) } diff --git a/internal/test/ent/schemab/schemab.go b/internal/test/ent/schemab/schemab.go index 5d14508..581f7a3 100644 --- a/internal/test/ent/schemab/schemab.go +++ b/internal/test/ent/schemab/schemab.go @@ -41,10 +41,10 @@ func ValidColumn(column string) bool { return false } -// Order defines the ordering method for the SchemaB queries. -type Order func(*sql.Selector) +// OrderOption defines the ordering options for the SchemaB queries. +type OrderOption func(*sql.Selector) // ByID orders the results by the id field. -func ByID(opts ...sql.OrderTermOption) Order { +func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } diff --git a/internal/test/ent/schemab_query.go b/internal/test/ent/schemab_query.go index 7797796..8fa8001 100644 --- a/internal/test/ent/schemab_query.go +++ b/internal/test/ent/schemab_query.go @@ -18,7 +18,7 @@ import ( type SchemaBQuery struct { config ctx *QueryContext - order []schemab.Order + order []schemab.OrderOption inters []Interceptor predicates []predicate.SchemaB withFKs bool @@ -53,7 +53,7 @@ func (sb *SchemaBQuery) Unique(unique bool) *SchemaBQuery { } // Order specifies how the records should be ordered. -func (sb *SchemaBQuery) Order(o ...schemab.Order) *SchemaBQuery { +func (sb *SchemaBQuery) Order(o ...schemab.OrderOption) *SchemaBQuery { sb.order = append(sb.order, o...) return sb } @@ -247,7 +247,7 @@ func (sb *SchemaBQuery) Clone() *SchemaBQuery { return &SchemaBQuery{ config: sb.config, ctx: sb.ctx.Clone(), - order: append([]schemab.Order{}, sb.order...), + order: append([]schemab.OrderOption{}, sb.order...), inters: append([]Interceptor{}, sb.inters...), predicates: append([]predicate.SchemaB{}, sb.predicates...), // clone intermediate query.