diff --git a/go.mod b/go.mod index a5203032..36d702b4 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/go-faster/oteldb go 1.21.0 require ( - entgo.io/ent v0.13.1 + entgo.io/ent v0.14.0 github.com/ClickHouse/ch-go v0.62.0 github.com/Masterminds/sprig/v3 v3.2.3 github.com/VictoriaMetrics/easyproto v0.1.4 diff --git a/go.sum b/go.sum index 8fb16cbb..78f3cf6c 100644 --- a/go.sum +++ b/go.sum @@ -4,8 +4,8 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9 cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= -entgo.io/ent v0.13.1 h1:uD8QwN1h6SNphdCCzmkMN3feSUzNnVvV/WIkHKMbzOE= -entgo.io/ent v0.13.1/go.mod h1:qCEmo+biw3ccBn9OyL4ZK5dfpwg++l1Gxwac5B1206A= +entgo.io/ent v0.14.0 h1:EO3Z9aZ5bXJatJeGqu/EVdnNr6K4mRq3rWe5owt0MC4= +entgo.io/ent v0.14.0/go.mod h1:qCEmo+biw3ccBn9OyL4ZK5dfpwg++l1Gxwac5B1206A= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 h1:E+OJmp2tPvt1W+amx48v1eqbjDYsgN+RzP4q16yV5eM= diff --git a/internal/otelbench/ent/ent.go b/internal/otelbench/ent/ent.go index b7010368..1b7a48ce 100644 --- a/internal/otelbench/ent/ent.go +++ b/internal/otelbench/ent/ent.go @@ -71,7 +71,7 @@ var ( columnCheck sql.ColumnCheck ) -// columnChecker checks if the column exists in the given table. +// checkColumn checks if the column exists in the given table. func checkColumn(table, column string) error { initCheck.Do(func() { columnCheck = sql.NewColumnCheck(map[string]func(string) bool{ diff --git a/internal/otelbench/ent/gitcommit_query.go b/internal/otelbench/ent/gitcommit_query.go index 8283a1ec..efb0f9ab 100644 --- a/internal/otelbench/ent/gitcommit_query.go +++ b/internal/otelbench/ent/gitcommit_query.go @@ -7,6 +7,7 @@ import ( "fmt" "math" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -85,7 +86,7 @@ func (gcq *GitCommitQuery) QueryRepository() *RepositoryQuery { // First returns the first GitCommit entity from the query. // Returns a *NotFoundError when no GitCommit was found. func (gcq *GitCommitQuery) First(ctx context.Context) (*GitCommit, error) { - nodes, err := gcq.Limit(1).All(setContextOp(ctx, gcq.ctx, "First")) + nodes, err := gcq.Limit(1).All(setContextOp(ctx, gcq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -108,7 +109,7 @@ func (gcq *GitCommitQuery) FirstX(ctx context.Context) *GitCommit { // Returns a *NotFoundError when no GitCommit ID was found. func (gcq *GitCommitQuery) FirstID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = gcq.Limit(1).IDs(setContextOp(ctx, gcq.ctx, "FirstID")); err != nil { + if ids, err = gcq.Limit(1).IDs(setContextOp(ctx, gcq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -131,7 +132,7 @@ func (gcq *GitCommitQuery) FirstIDX(ctx context.Context) string { // Returns a *NotSingularError when more than one GitCommit entity is found. // Returns a *NotFoundError when no GitCommit entities are found. func (gcq *GitCommitQuery) Only(ctx context.Context) (*GitCommit, error) { - nodes, err := gcq.Limit(2).All(setContextOp(ctx, gcq.ctx, "Only")) + nodes, err := gcq.Limit(2).All(setContextOp(ctx, gcq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -159,7 +160,7 @@ func (gcq *GitCommitQuery) OnlyX(ctx context.Context) *GitCommit { // Returns a *NotFoundError when no entities are found. func (gcq *GitCommitQuery) OnlyID(ctx context.Context) (id string, err error) { var ids []string - if ids, err = gcq.Limit(2).IDs(setContextOp(ctx, gcq.ctx, "OnlyID")); err != nil { + if ids, err = gcq.Limit(2).IDs(setContextOp(ctx, gcq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -184,7 +185,7 @@ func (gcq *GitCommitQuery) OnlyIDX(ctx context.Context) string { // All executes the query and returns a list of GitCommits. func (gcq *GitCommitQuery) All(ctx context.Context) ([]*GitCommit, error) { - ctx = setContextOp(ctx, gcq.ctx, "All") + ctx = setContextOp(ctx, gcq.ctx, ent.OpQueryAll) if err := gcq.prepareQuery(ctx); err != nil { return nil, err } @@ -206,7 +207,7 @@ func (gcq *GitCommitQuery) IDs(ctx context.Context) (ids []string, err error) { if gcq.ctx.Unique == nil && gcq.path != nil { gcq.Unique(true) } - ctx = setContextOp(ctx, gcq.ctx, "IDs") + ctx = setContextOp(ctx, gcq.ctx, ent.OpQueryIDs) if err = gcq.Select(gitcommit.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -224,7 +225,7 @@ func (gcq *GitCommitQuery) IDsX(ctx context.Context) []string { // Count returns the count of the given query. func (gcq *GitCommitQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, gcq.ctx, "Count") + ctx = setContextOp(ctx, gcq.ctx, ent.OpQueryCount) if err := gcq.prepareQuery(ctx); err != nil { return 0, err } @@ -242,7 +243,7 @@ func (gcq *GitCommitQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (gcq *GitCommitQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, gcq.ctx, "Exist") + ctx = setContextOp(ctx, gcq.ctx, ent.OpQueryExist) switch _, err := gcq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -536,7 +537,7 @@ func (gcgb *GitCommitGroupBy) Aggregate(fns ...AggregateFunc) *GitCommitGroupBy // Scan applies the selector query and scans the result into the given value. func (gcgb *GitCommitGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gcgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, gcgb.build.ctx, ent.OpQueryGroupBy) if err := gcgb.build.prepareQuery(ctx); err != nil { return err } @@ -584,7 +585,7 @@ func (gcs *GitCommitSelect) Aggregate(fns ...AggregateFunc) *GitCommitSelect { // Scan applies the selector query and scans the result into the given value. func (gcs *GitCommitSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, gcs.ctx, "Select") + ctx = setContextOp(ctx, gcs.ctx, ent.OpQuerySelect) if err := gcs.prepareQuery(ctx); err != nil { return err } diff --git a/internal/otelbench/ent/organization_query.go b/internal/otelbench/ent/organization_query.go index e7236728..6e7c24b0 100644 --- a/internal/otelbench/ent/organization_query.go +++ b/internal/otelbench/ent/organization_query.go @@ -8,6 +8,7 @@ import ( "fmt" "math" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -86,7 +87,7 @@ func (oq *OrganizationQuery) QueryRepositories() *RepositoryQuery { // First returns the first Organization entity from the query. // Returns a *NotFoundError when no Organization was found. func (oq *OrganizationQuery) First(ctx context.Context) (*Organization, error) { - nodes, err := oq.Limit(1).All(setContextOp(ctx, oq.ctx, "First")) + nodes, err := oq.Limit(1).All(setContextOp(ctx, oq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -109,7 +110,7 @@ func (oq *OrganizationQuery) FirstX(ctx context.Context) *Organization { // Returns a *NotFoundError when no Organization ID was found. func (oq *OrganizationQuery) FirstID(ctx context.Context) (id int64, err error) { var ids []int64 - if ids, err = oq.Limit(1).IDs(setContextOp(ctx, oq.ctx, "FirstID")); err != nil { + if ids, err = oq.Limit(1).IDs(setContextOp(ctx, oq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -132,7 +133,7 @@ func (oq *OrganizationQuery) FirstIDX(ctx context.Context) int64 { // Returns a *NotSingularError when more than one Organization entity is found. // Returns a *NotFoundError when no Organization entities are found. func (oq *OrganizationQuery) Only(ctx context.Context) (*Organization, error) { - nodes, err := oq.Limit(2).All(setContextOp(ctx, oq.ctx, "Only")) + nodes, err := oq.Limit(2).All(setContextOp(ctx, oq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -160,7 +161,7 @@ func (oq *OrganizationQuery) OnlyX(ctx context.Context) *Organization { // Returns a *NotFoundError when no entities are found. func (oq *OrganizationQuery) OnlyID(ctx context.Context) (id int64, err error) { var ids []int64 - if ids, err = oq.Limit(2).IDs(setContextOp(ctx, oq.ctx, "OnlyID")); err != nil { + if ids, err = oq.Limit(2).IDs(setContextOp(ctx, oq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -185,7 +186,7 @@ func (oq *OrganizationQuery) OnlyIDX(ctx context.Context) int64 { // All executes the query and returns a list of Organizations. func (oq *OrganizationQuery) All(ctx context.Context) ([]*Organization, error) { - ctx = setContextOp(ctx, oq.ctx, "All") + ctx = setContextOp(ctx, oq.ctx, ent.OpQueryAll) if err := oq.prepareQuery(ctx); err != nil { return nil, err } @@ -207,7 +208,7 @@ func (oq *OrganizationQuery) IDs(ctx context.Context) (ids []int64, err error) { if oq.ctx.Unique == nil && oq.path != nil { oq.Unique(true) } - ctx = setContextOp(ctx, oq.ctx, "IDs") + ctx = setContextOp(ctx, oq.ctx, ent.OpQueryIDs) if err = oq.Select(organization.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -225,7 +226,7 @@ func (oq *OrganizationQuery) IDsX(ctx context.Context) []int64 { // Count returns the count of the given query. func (oq *OrganizationQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, oq.ctx, "Count") + ctx = setContextOp(ctx, oq.ctx, ent.OpQueryCount) if err := oq.prepareQuery(ctx); err != nil { return 0, err } @@ -243,7 +244,7 @@ func (oq *OrganizationQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (oq *OrganizationQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, oq.ctx, "Exist") + ctx = setContextOp(ctx, oq.ctx, ent.OpQueryExist) switch _, err := oq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -551,7 +552,7 @@ func (ogb *OrganizationGroupBy) Aggregate(fns ...AggregateFunc) *OrganizationGro // Scan applies the selector query and scans the result into the given value. func (ogb *OrganizationGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, ogb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, ogb.build.ctx, ent.OpQueryGroupBy) if err := ogb.build.prepareQuery(ctx); err != nil { return err } @@ -599,7 +600,7 @@ func (os *OrganizationSelect) Aggregate(fns ...AggregateFunc) *OrganizationSelec // Scan applies the selector query and scans the result into the given value. func (os *OrganizationSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, os.ctx, "Select") + ctx = setContextOp(ctx, os.ctx, ent.OpQuerySelect) if err := os.prepareQuery(ctx); err != nil { return err } diff --git a/internal/otelbench/ent/repository_query.go b/internal/otelbench/ent/repository_query.go index 01c9f1ca..5c6fb2cf 100644 --- a/internal/otelbench/ent/repository_query.go +++ b/internal/otelbench/ent/repository_query.go @@ -8,6 +8,7 @@ import ( "fmt" "math" + "entgo.io/ent" "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" @@ -111,7 +112,7 @@ func (rq *RepositoryQuery) QueryCommits() *GitCommitQuery { // First returns the first Repository entity from the query. // Returns a *NotFoundError when no Repository was found. func (rq *RepositoryQuery) First(ctx context.Context) (*Repository, error) { - nodes, err := rq.Limit(1).All(setContextOp(ctx, rq.ctx, "First")) + nodes, err := rq.Limit(1).All(setContextOp(ctx, rq.ctx, ent.OpQueryFirst)) if err != nil { return nil, err } @@ -134,7 +135,7 @@ func (rq *RepositoryQuery) FirstX(ctx context.Context) *Repository { // Returns a *NotFoundError when no Repository ID was found. func (rq *RepositoryQuery) FirstID(ctx context.Context) (id int64, err error) { var ids []int64 - if ids, err = rq.Limit(1).IDs(setContextOp(ctx, rq.ctx, "FirstID")); err != nil { + if ids, err = rq.Limit(1).IDs(setContextOp(ctx, rq.ctx, ent.OpQueryFirstID)); err != nil { return } if len(ids) == 0 { @@ -157,7 +158,7 @@ func (rq *RepositoryQuery) FirstIDX(ctx context.Context) int64 { // Returns a *NotSingularError when more than one Repository entity is found. // Returns a *NotFoundError when no Repository entities are found. func (rq *RepositoryQuery) Only(ctx context.Context) (*Repository, error) { - nodes, err := rq.Limit(2).All(setContextOp(ctx, rq.ctx, "Only")) + nodes, err := rq.Limit(2).All(setContextOp(ctx, rq.ctx, ent.OpQueryOnly)) if err != nil { return nil, err } @@ -185,7 +186,7 @@ func (rq *RepositoryQuery) OnlyX(ctx context.Context) *Repository { // Returns a *NotFoundError when no entities are found. func (rq *RepositoryQuery) OnlyID(ctx context.Context) (id int64, err error) { var ids []int64 - if ids, err = rq.Limit(2).IDs(setContextOp(ctx, rq.ctx, "OnlyID")); err != nil { + if ids, err = rq.Limit(2).IDs(setContextOp(ctx, rq.ctx, ent.OpQueryOnlyID)); err != nil { return } switch len(ids) { @@ -210,7 +211,7 @@ func (rq *RepositoryQuery) OnlyIDX(ctx context.Context) int64 { // All executes the query and returns a list of Repositories. func (rq *RepositoryQuery) All(ctx context.Context) ([]*Repository, error) { - ctx = setContextOp(ctx, rq.ctx, "All") + ctx = setContextOp(ctx, rq.ctx, ent.OpQueryAll) if err := rq.prepareQuery(ctx); err != nil { return nil, err } @@ -232,7 +233,7 @@ func (rq *RepositoryQuery) IDs(ctx context.Context) (ids []int64, err error) { if rq.ctx.Unique == nil && rq.path != nil { rq.Unique(true) } - ctx = setContextOp(ctx, rq.ctx, "IDs") + ctx = setContextOp(ctx, rq.ctx, ent.OpQueryIDs) if err = rq.Select(repository.FieldID).Scan(ctx, &ids); err != nil { return nil, err } @@ -250,7 +251,7 @@ func (rq *RepositoryQuery) IDsX(ctx context.Context) []int64 { // Count returns the count of the given query. func (rq *RepositoryQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, rq.ctx, "Count") + ctx = setContextOp(ctx, rq.ctx, ent.OpQueryCount) if err := rq.prepareQuery(ctx); err != nil { return 0, err } @@ -268,7 +269,7 @@ func (rq *RepositoryQuery) CountX(ctx context.Context) int { // Exist returns true if the query has elements in the graph. func (rq *RepositoryQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, rq.ctx, "Exist") + ctx = setContextOp(ctx, rq.ctx, ent.OpQueryExist) switch _, err := rq.FirstID(ctx); { case IsNotFound(err): return false, nil @@ -634,7 +635,7 @@ func (rgb *RepositoryGroupBy) Aggregate(fns ...AggregateFunc) *RepositoryGroupBy // Scan applies the selector query and scans the result into the given value. func (rgb *RepositoryGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rgb.build.ctx, "GroupBy") + ctx = setContextOp(ctx, rgb.build.ctx, ent.OpQueryGroupBy) if err := rgb.build.prepareQuery(ctx); err != nil { return err } @@ -682,7 +683,7 @@ func (rs *RepositorySelect) Aggregate(fns ...AggregateFunc) *RepositorySelect { // Scan applies the selector query and scans the result into the given value. func (rs *RepositorySelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, rs.ctx, "Select") + ctx = setContextOp(ctx, rs.ctx, ent.OpQuerySelect) if err := rs.prepareQuery(ctx); err != nil { return err } diff --git a/internal/otelbench/ent/runtime/runtime.go b/internal/otelbench/ent/runtime/runtime.go index 53836d93..4ff743e8 100644 --- a/internal/otelbench/ent/runtime/runtime.go +++ b/internal/otelbench/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/go-faster/oteldb/internal/otelbench/ent/runtime.go const ( - Version = "v0.13.1" // Version of ent codegen. - Sum = "h1:uD8QwN1h6SNphdCCzmkMN3feSUzNnVvV/WIkHKMbzOE=" // Sum of ent codegen. + Version = "v0.14.0" // Version of ent codegen. + Sum = "h1:EO3Z9aZ5bXJatJeGqu/EVdnNr6K4mRq3rWe5owt0MC4=" // Sum of ent codegen. )