From 9677ddee77b17108daf1f1348f5cda988d226d13 Mon Sep 17 00:00:00 2001 From: Michael Adler Date: Fri, 29 Sep 2023 19:55:17 +0200 Subject: [PATCH] chore: bump entgo.io/ent from 0.12.3 to 0.12.4 Signed-off-by: Michael Adler --- generated/ent/client.go | 66 +++++++++++++++++++++++++++++++- generated/ent/history/where.go | 23 ++--------- generated/ent/history_create.go | 4 ++ generated/ent/job/where.go | 23 ++--------- generated/ent/job_create.go | 4 ++ generated/ent/runtime/runtime.go | 4 +- generated/ent/tag/where.go | 23 ++--------- generated/ent/tag_create.go | 4 ++ generated/ent/workflow/where.go | 23 ++--------- generated/ent/workflow_create.go | 4 ++ go.mod | 4 +- go.sum | 8 ++-- 12 files changed, 101 insertions(+), 89 deletions(-) diff --git a/generated/ent/client.go b/generated/ent/client.go index 20a5f9a6..695b87e6 100644 --- a/generated/ent/client.go +++ b/generated/ent/client.go @@ -10,6 +10,7 @@ import ( "errors" "fmt" "log" + "reflect" "github.com/siemens/wfx/generated/ent/migrate" @@ -122,11 +123,14 @@ func Open(driverName, dataSourceName string, options ...Option) (*Client, error) } } +// ErrTxStarted is returned when trying to start a new transaction from a transactional client. +var ErrTxStarted = errors.New("ent: cannot start a transaction within a transaction") + // Tx returns a new transactional client. The provided context // is used until the transaction is committed or rolled back. func (c *Client) Tx(ctx context.Context) (*Tx, error) { if _, ok := c.driver.(*txDriver); ok { - return nil, errors.New("ent: cannot start a transaction within a transaction") + return nil, ErrTxStarted } tx, err := newTx(ctx, c.driver) if err != nil { @@ -256,6 +260,21 @@ func (c *HistoryClient) CreateBulk(builders ...*HistoryCreate) *HistoryCreateBul return &HistoryCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *HistoryClient) MapCreateBulk(slice any, setFunc func(*HistoryCreate, int)) *HistoryCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &HistoryCreateBulk{err: fmt.Errorf("calling to HistoryClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*HistoryCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &HistoryCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for History. func (c *HistoryClient) Update() *HistoryUpdate { mutation := newHistoryMutation(c.config, OpUpdate) @@ -390,6 +409,21 @@ func (c *JobClient) CreateBulk(builders ...*JobCreate) *JobCreateBulk { return &JobCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *JobClient) MapCreateBulk(slice any, setFunc func(*JobCreate, int)) *JobCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &JobCreateBulk{err: fmt.Errorf("calling to JobClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*JobCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &JobCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Job. func (c *JobClient) Update() *JobUpdate { mutation := newJobMutation(c.config, OpUpdate) @@ -556,6 +590,21 @@ func (c *TagClient) CreateBulk(builders ...*TagCreate) *TagCreateBulk { return &TagCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *TagClient) MapCreateBulk(slice any, setFunc func(*TagCreate, int)) *TagCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &TagCreateBulk{err: fmt.Errorf("calling to TagClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*TagCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &TagCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Tag. func (c *TagClient) Update() *TagUpdate { mutation := newTagMutation(c.config, OpUpdate) @@ -690,6 +739,21 @@ func (c *WorkflowClient) CreateBulk(builders ...*WorkflowCreate) *WorkflowCreate return &WorkflowCreateBulk{config: c.config, builders: builders} } +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *WorkflowClient) MapCreateBulk(slice any, setFunc func(*WorkflowCreate, int)) *WorkflowCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &WorkflowCreateBulk{err: fmt.Errorf("calling to WorkflowClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*WorkflowCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &WorkflowCreateBulk{config: c.config, builders: builders} +} + // Update returns an update builder for Workflow. func (c *WorkflowClient) Update() *WorkflowUpdate { mutation := newWorkflowMutation(c.config, OpUpdate) diff --git a/generated/ent/history/where.go b/generated/ent/history/where.go index 3e9d2091..f42a0be5 100644 --- a/generated/ent/history/where.go +++ b/generated/ent/history/where.go @@ -148,32 +148,15 @@ func HasJobWith(preds ...predicate.Job) predicate.History { // And groups predicates with the AND operator between them. func And(predicates ...predicate.History) predicate.History { - return predicate.History(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.History(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.History) predicate.History { - return predicate.History(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.History(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.History) predicate.History { - return predicate.History(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.History(sql.NotPredicates(p)) } diff --git a/generated/ent/history_create.go b/generated/ent/history_create.go index 76ac5ffa..a3aa62e6 100644 --- a/generated/ent/history_create.go +++ b/generated/ent/history_create.go @@ -168,11 +168,15 @@ func (hc *HistoryCreate) createSpec() (*History, *sqlgraph.CreateSpec) { // HistoryCreateBulk is the builder for creating many History entities in bulk. type HistoryCreateBulk struct { config + err error builders []*HistoryCreate } // Save creates the History entities in the database. func (hcb *HistoryCreateBulk) Save(ctx context.Context) ([]*History, error) { + if hcb.err != nil { + return nil, hcb.err + } specs := make([]*sqlgraph.CreateSpec, len(hcb.builders)) nodes := make([]*History, len(hcb.builders)) mutators := make([]Mutator, len(hcb.builders)) diff --git a/generated/ent/job/where.go b/generated/ent/job/where.go index 53d8d0e7..15ea6752 100644 --- a/generated/ent/job/where.go +++ b/generated/ent/job/where.go @@ -389,32 +389,15 @@ func HasTagsWith(preds ...predicate.Tag) predicate.Job { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Job) predicate.Job { - return predicate.Job(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Job(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Job) predicate.Job { - return predicate.Job(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Job(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Job) predicate.Job { - return predicate.Job(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Job(sql.NotPredicates(p)) } diff --git a/generated/ent/job_create.go b/generated/ent/job_create.go index ac642990..4c2f4d9c 100644 --- a/generated/ent/job_create.go +++ b/generated/ent/job_create.go @@ -332,11 +332,15 @@ func (jc *JobCreate) createSpec() (*Job, *sqlgraph.CreateSpec) { // JobCreateBulk is the builder for creating many Job entities in bulk. type JobCreateBulk struct { config + err error builders []*JobCreate } // Save creates the Job entities in the database. func (jcb *JobCreateBulk) Save(ctx context.Context) ([]*Job, error) { + if jcb.err != nil { + return nil, jcb.err + } specs := make([]*sqlgraph.CreateSpec, len(jcb.builders)) nodes := make([]*Job, len(jcb.builders)) mutators := make([]Mutator, len(jcb.builders)) diff --git a/generated/ent/runtime/runtime.go b/generated/ent/runtime/runtime.go index 512343e2..6a3aa78a 100644 --- a/generated/ent/runtime/runtime.go +++ b/generated/ent/runtime/runtime.go @@ -8,6 +8,6 @@ package runtime // The schema-stitching logic is generated in github.com/siemens/wfx/generated/ent/runtime.go const ( - Version = "v0.12.3" // Version of ent codegen. - Sum = "h1:N5lO2EOrHpCH5HYfiMOCHYbo+oh5M8GjT0/cx5x6xkk=" // Sum of ent codegen. + Version = "v0.12.4" // Version of ent codegen. + Sum = "h1:LddPnAyxls/O7DTXZvUGDj0NZIdGSu317+aoNLJWbD8=" // Sum of ent codegen. ) diff --git a/generated/ent/tag/where.go b/generated/ent/tag/where.go index 9e68799f..60488fbd 100644 --- a/generated/ent/tag/where.go +++ b/generated/ent/tag/where.go @@ -151,32 +151,15 @@ func HasJobsWith(preds ...predicate.Job) predicate.Tag { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Tag) predicate.Tag { - return predicate.Tag(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Tag(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Tag) predicate.Tag { - return predicate.Tag(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Tag(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Tag) predicate.Tag { - return predicate.Tag(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Tag(sql.NotPredicates(p)) } diff --git a/generated/ent/tag_create.go b/generated/ent/tag_create.go index 979aa328..776b36f4 100644 --- a/generated/ent/tag_create.go +++ b/generated/ent/tag_create.go @@ -133,11 +133,15 @@ func (tc *TagCreate) createSpec() (*Tag, *sqlgraph.CreateSpec) { // TagCreateBulk is the builder for creating many Tag entities in bulk. type TagCreateBulk struct { config + err error builders []*TagCreate } // Save creates the Tag entities in the database. func (tcb *TagCreateBulk) Save(ctx context.Context) ([]*Tag, error) { + if tcb.err != nil { + return nil, tcb.err + } specs := make([]*sqlgraph.CreateSpec, len(tcb.builders)) nodes := make([]*Tag, len(tcb.builders)) mutators := make([]Mutator, len(tcb.builders)) diff --git a/generated/ent/workflow/where.go b/generated/ent/workflow/where.go index 3030571f..bc92fb8a 100644 --- a/generated/ent/workflow/where.go +++ b/generated/ent/workflow/where.go @@ -151,32 +151,15 @@ func HasJobsWith(preds ...predicate.Job) predicate.Workflow { // And groups predicates with the AND operator between them. func And(predicates ...predicate.Workflow) predicate.Workflow { - return predicate.Workflow(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for _, p := range predicates { - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Workflow(sql.AndPredicates(predicates...)) } // Or groups predicates with the OR operator between them. func Or(predicates ...predicate.Workflow) predicate.Workflow { - return predicate.Workflow(func(s *sql.Selector) { - s1 := s.Clone().SetP(nil) - for i, p := range predicates { - if i > 0 { - s1.Or() - } - p(s1) - } - s.Where(s1.P()) - }) + return predicate.Workflow(sql.OrPredicates(predicates...)) } // Not applies the not operator on the given predicate. func Not(p predicate.Workflow) predicate.Workflow { - return predicate.Workflow(func(s *sql.Selector) { - p(s.Not()) - }) + return predicate.Workflow(sql.NotPredicates(p)) } diff --git a/generated/ent/workflow_create.go b/generated/ent/workflow_create.go index 597f5b10..988949c8 100644 --- a/generated/ent/workflow_create.go +++ b/generated/ent/workflow_create.go @@ -178,11 +178,15 @@ func (wc *WorkflowCreate) createSpec() (*Workflow, *sqlgraph.CreateSpec) { // WorkflowCreateBulk is the builder for creating many Workflow entities in bulk. type WorkflowCreateBulk struct { config + err error builders []*WorkflowCreate } // Save creates the Workflow entities in the database. func (wcb *WorkflowCreateBulk) Save(ctx context.Context) ([]*Workflow, error) { + if wcb.err != nil { + return nil, wcb.err + } specs := make([]*sqlgraph.CreateSpec, len(wcb.builders)) nodes := make([]*Workflow, len(wcb.builders)) mutators := make([]Mutator, len(wcb.builders)) diff --git a/go.mod b/go.mod index 061c9b50..049f7614 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/siemens/wfx go 1.19 require ( - entgo.io/ent v0.12.3 + entgo.io/ent v0.12.4 github.com/OpenPeeDeeP/xdg v1.0.0 github.com/Southclaws/fault v0.6.1 github.com/alexliesenfeld/health v0.7.0 @@ -47,7 +47,7 @@ require ( ) require ( - ariga.io/atlas v0.11.0 // indirect + ariga.io/atlas v0.14.1-0.20230918065911-83ad451a4935 // indirect github.com/PaesslerAG/gval v1.2.0 // indirect github.com/PaesslerAG/jsonpath v0.1.1 // indirect github.com/agext/levenshtein v1.2.3 // indirect diff --git a/go.sum b/go.sum index 14a5688f..e76209b2 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ -ariga.io/atlas v0.11.0 h1:aGR7MzsUfmdlDYCpRErQeY2NSuRlPE0/q6drNE/5buM= -ariga.io/atlas v0.11.0/go.mod h1:+TR129FJZ5Lvzms6dvCeGWh1yR6hMvmXBhug4hrNIGk= -entgo.io/ent v0.12.3 h1:N5lO2EOrHpCH5HYfiMOCHYbo+oh5M8GjT0/cx5x6xkk= -entgo.io/ent v0.12.3/go.mod h1:AigGGx+tbrBBYHAzGOg8ND661E5cxx1Uiu5o/otJ6Yg= +ariga.io/atlas v0.14.1-0.20230918065911-83ad451a4935 h1:JnYs/y8RJ3+MiIUp+3RgyyeO48VHLAZimqiaZYnMKk8= +ariga.io/atlas v0.14.1-0.20230918065911-83ad451a4935/go.mod h1:isZrlzJ5cpoCoKFoY9knZug7Lq4pP1cm8g3XciLZ0Pw= +entgo.io/ent v0.12.4 h1:LddPnAyxls/O7DTXZvUGDj0NZIdGSu317+aoNLJWbD8= +entgo.io/ent v0.12.4/go.mod h1:Y3JVAjtlIk8xVZYSn3t3mf8xlZIn5SAOXZQxD6kKI+Q= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60=