From af3b34a4ba9ad2fb6e16130060384200d6619bd6 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Fri, 17 Feb 2023 18:51:37 -0900 Subject: [PATCH] generate db models --- backend/internal/data/ent/attachment.go | 6 ---- .../internal/data/ent/attachment_create.go | 8 +----- .../internal/data/ent/attachment_delete.go | 10 +------ backend/internal/data/ent/attachment_query.go | 24 ++++++---------- .../internal/data/ent/attachment_update.go | 28 ++++++------------- backend/internal/data/ent/authroles.go | 6 ---- backend/internal/data/ent/authroles_create.go | 8 +----- backend/internal/data/ent/authroles_delete.go | 10 +------ backend/internal/data/ent/authroles_query.go | 24 ++++++---------- backend/internal/data/ent/authroles_update.go | 28 ++++++------------- backend/internal/data/ent/authtokens.go | 6 ---- .../internal/data/ent/authtokens_create.go | 8 +----- .../internal/data/ent/authtokens_delete.go | 10 +------ backend/internal/data/ent/authtokens_query.go | 24 ++++++---------- .../internal/data/ent/authtokens_update.go | 28 ++++++------------- backend/internal/data/ent/client.go | 24 ++++++++-------- backend/internal/data/ent/document.go | 6 ---- backend/internal/data/ent/document_create.go | 8 +----- backend/internal/data/ent/document_delete.go | 10 +------ backend/internal/data/ent/document_query.go | 24 ++++++---------- backend/internal/data/ent/document_update.go | 28 ++++++------------- backend/internal/data/ent/group.go | 6 ---- backend/internal/data/ent/group_create.go | 8 +----- backend/internal/data/ent/group_delete.go | 10 +------ backend/internal/data/ent/group_query.go | 24 ++++++---------- backend/internal/data/ent/group_update.go | 28 ++++++------------- .../internal/data/ent/groupinvitationtoken.go | 6 ---- .../data/ent/groupinvitationtoken_create.go | 8 +----- .../data/ent/groupinvitationtoken_delete.go | 10 +------ .../data/ent/groupinvitationtoken_query.go | 24 ++++++---------- .../data/ent/groupinvitationtoken_update.go | 28 ++++++------------- backend/internal/data/ent/item.go | 6 ---- backend/internal/data/ent/item_create.go | 8 +----- backend/internal/data/ent/item_delete.go | 10 +------ backend/internal/data/ent/item_query.go | 24 ++++++---------- backend/internal/data/ent/item_update.go | 28 ++++++------------- backend/internal/data/ent/itemfield.go | 6 ---- backend/internal/data/ent/itemfield_create.go | 8 +----- backend/internal/data/ent/itemfield_delete.go | 10 +------ backend/internal/data/ent/itemfield_query.go | 24 ++++++---------- backend/internal/data/ent/itemfield_update.go | 28 ++++++------------- backend/internal/data/ent/label.go | 6 ---- backend/internal/data/ent/label_create.go | 8 +----- backend/internal/data/ent/label_delete.go | 10 +------ backend/internal/data/ent/label_query.go | 24 ++++++---------- backend/internal/data/ent/label_update.go | 28 ++++++------------- backend/internal/data/ent/location.go | 6 ---- backend/internal/data/ent/location_create.go | 8 +----- backend/internal/data/ent/location_delete.go | 10 +------ backend/internal/data/ent/location_query.go | 24 ++++++---------- backend/internal/data/ent/location_update.go | 28 ++++++------------- backend/internal/data/ent/maintenanceentry.go | 6 ---- .../data/ent/maintenanceentry_create.go | 8 +----- .../data/ent/maintenanceentry_delete.go | 10 +------ .../data/ent/maintenanceentry_query.go | 24 ++++++---------- .../data/ent/maintenanceentry_update.go | 28 ++++++------------- backend/internal/data/ent/runtime/runtime.go | 4 +-- backend/internal/data/ent/user.go | 6 ---- backend/internal/data/ent/user_create.go | 8 +----- backend/internal/data/ent/user_delete.go | 10 +------ backend/internal/data/ent/user_query.go | 24 ++++++---------- backend/internal/data/ent/user_update.go | 28 ++++++------------- 62 files changed, 242 insertions(+), 698 deletions(-) diff --git a/backend/internal/data/ent/attachment.go b/backend/internal/data/ent/attachment.go index 897a0a3..25d2df4 100644 --- a/backend/internal/data/ent/attachment.go +++ b/backend/internal/data/ent/attachment.go @@ -189,9 +189,3 @@ func (a *Attachment) String() string { // Attachments is a parsable slice of Attachment. type Attachments []*Attachment - -func (a Attachments) config(cfg config) { - for _i := range a { - a[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/attachment_create.go b/backend/internal/data/ent/attachment_create.go index 2be195e..5ce7ef3 100644 --- a/backend/internal/data/ent/attachment_create.go +++ b/backend/internal/data/ent/attachment_create.go @@ -205,13 +205,7 @@ func (ac *AttachmentCreate) sqlSave(ctx context.Context) (*Attachment, error) { func (ac *AttachmentCreate) createSpec() (*Attachment, *sqlgraph.CreateSpec) { var ( _node = &Attachment{config: ac.config} - _spec = &sqlgraph.CreateSpec{ - Table: attachment.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(attachment.Table, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID)) ) if id, ok := ac.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/attachment_delete.go b/backend/internal/data/ent/attachment_delete.go index 5b45801..8185ac1 100644 --- a/backend/internal/data/ent/attachment_delete.go +++ b/backend/internal/data/ent/attachment_delete.go @@ -40,15 +40,7 @@ func (ad *AttachmentDelete) ExecX(ctx context.Context) int { } func (ad *AttachmentDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: attachment.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(attachment.Table, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID)) if ps := ad.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/attachment_query.go b/backend/internal/data/ent/attachment_query.go index d631f7e..de5821a 100644 --- a/backend/internal/data/ent/attachment_query.go +++ b/backend/internal/data/ent/attachment_query.go @@ -227,10 +227,12 @@ func (aq *AttachmentQuery) AllX(ctx context.Context) []*Attachment { } // IDs executes the query and returns a list of Attachment IDs. -func (aq *AttachmentQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (aq *AttachmentQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if aq.ctx.Unique == nil && aq.path != nil { + aq.Unique(true) + } ctx = setContextOp(ctx, aq.ctx, "IDs") - if err := aq.Select(attachment.FieldID).Scan(ctx, &ids); err != nil { + if err = aq.Select(attachment.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -525,20 +527,12 @@ func (aq *AttachmentQuery) sqlCount(ctx context.Context) (int, error) { } func (aq *AttachmentQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: attachment.Table, - Columns: attachment.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, - }, - From: aq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(attachment.Table, attachment.Columns, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID)) + _spec.From = aq.sql if unique := aq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if aq.path != nil { + _spec.Unique = true } if fields := aq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/attachment_update.go b/backend/internal/data/ent/attachment_update.go index a54ad5a..e4b747d 100644 --- a/backend/internal/data/ent/attachment_update.go +++ b/backend/internal/data/ent/attachment_update.go @@ -146,16 +146,7 @@ func (au *AttachmentUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := au.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: attachment.Table, - Columns: attachment.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(attachment.Table, attachment.Columns, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID)) if ps := au.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -318,6 +309,12 @@ func (auo *AttachmentUpdateOne) ClearDocument() *AttachmentUpdateOne { return auo } +// Where appends a list predicates to the AttachmentUpdate builder. +func (auo *AttachmentUpdateOne) Where(ps ...predicate.Attachment) *AttachmentUpdateOne { + auo.mutation.Where(ps...) + return auo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (auo *AttachmentUpdateOne) Select(field string, fields ...string) *AttachmentUpdateOne { @@ -381,16 +378,7 @@ func (auo *AttachmentUpdateOne) sqlSave(ctx context.Context) (_node *Attachment, if err := auo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: attachment.Table, - Columns: attachment.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: attachment.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(attachment.Table, attachment.Columns, sqlgraph.NewFieldSpec(attachment.FieldID, field.TypeUUID)) id, ok := auo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Attachment.id" for update`)} diff --git a/backend/internal/data/ent/authroles.go b/backend/internal/data/ent/authroles.go index 5e8ed40..4dcd733 100644 --- a/backend/internal/data/ent/authroles.go +++ b/backend/internal/data/ent/authroles.go @@ -133,9 +133,3 @@ func (ar *AuthRoles) String() string { // AuthRolesSlice is a parsable slice of AuthRoles. type AuthRolesSlice []*AuthRoles - -func (ar AuthRolesSlice) config(cfg config) { - for _i := range ar { - ar[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/authroles_create.go b/backend/internal/data/ent/authroles_create.go index 383b8c3..566d107 100644 --- a/backend/internal/data/ent/authroles_create.go +++ b/backend/internal/data/ent/authroles_create.go @@ -129,13 +129,7 @@ func (arc *AuthRolesCreate) sqlSave(ctx context.Context) (*AuthRoles, error) { func (arc *AuthRolesCreate) createSpec() (*AuthRoles, *sqlgraph.CreateSpec) { var ( _node = &AuthRoles{config: arc.config} - _spec = &sqlgraph.CreateSpec{ - Table: authroles.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(authroles.Table, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt)) ) if value, ok := arc.mutation.Role(); ok { _spec.SetField(authroles.FieldRole, field.TypeEnum, value) diff --git a/backend/internal/data/ent/authroles_delete.go b/backend/internal/data/ent/authroles_delete.go index 3cc1faa..13a2518 100644 --- a/backend/internal/data/ent/authroles_delete.go +++ b/backend/internal/data/ent/authroles_delete.go @@ -40,15 +40,7 @@ func (ard *AuthRolesDelete) ExecX(ctx context.Context) int { } func (ard *AuthRolesDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: authroles.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(authroles.Table, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt)) if ps := ard.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/authroles_query.go b/backend/internal/data/ent/authroles_query.go index ed44fa9..14042ff 100644 --- a/backend/internal/data/ent/authroles_query.go +++ b/backend/internal/data/ent/authroles_query.go @@ -203,10 +203,12 @@ func (arq *AuthRolesQuery) AllX(ctx context.Context) []*AuthRoles { } // IDs executes the query and returns a list of AuthRoles IDs. -func (arq *AuthRolesQuery) IDs(ctx context.Context) ([]int, error) { - var ids []int +func (arq *AuthRolesQuery) IDs(ctx context.Context) (ids []int, err error) { + if arq.ctx.Unique == nil && arq.path != nil { + arq.Unique(true) + } ctx = setContextOp(ctx, arq.ctx, "IDs") - if err := arq.Select(authroles.FieldID).Scan(ctx, &ids); err != nil { + if err = arq.Select(authroles.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -450,20 +452,12 @@ func (arq *AuthRolesQuery) sqlCount(ctx context.Context) (int, error) { } func (arq *AuthRolesQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: authroles.Table, - Columns: authroles.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, - }, - From: arq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(authroles.Table, authroles.Columns, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt)) + _spec.From = arq.sql if unique := arq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if arq.path != nil { + _spec.Unique = true } if fields := arq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/authroles_update.go b/backend/internal/data/ent/authroles_update.go index dea7b76..ca222e4 100644 --- a/backend/internal/data/ent/authroles_update.go +++ b/backend/internal/data/ent/authroles_update.go @@ -114,16 +114,7 @@ func (aru *AuthRolesUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := aru.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: authroles.Table, - Columns: authroles.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(authroles.Table, authroles.Columns, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt)) if ps := aru.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -233,6 +224,12 @@ func (aruo *AuthRolesUpdateOne) ClearToken() *AuthRolesUpdateOne { return aruo } +// Where appends a list predicates to the AuthRolesUpdate builder. +func (aruo *AuthRolesUpdateOne) Where(ps ...predicate.AuthRoles) *AuthRolesUpdateOne { + aruo.mutation.Where(ps...) + return aruo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (aruo *AuthRolesUpdateOne) Select(field string, fields ...string) *AuthRolesUpdateOne { @@ -281,16 +278,7 @@ func (aruo *AuthRolesUpdateOne) sqlSave(ctx context.Context) (_node *AuthRoles, if err := aruo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: authroles.Table, - Columns: authroles.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeInt, - Column: authroles.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(authroles.Table, authroles.Columns, sqlgraph.NewFieldSpec(authroles.FieldID, field.TypeInt)) id, ok := aruo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AuthRoles.id" for update`)} diff --git a/backend/internal/data/ent/authtokens.go b/backend/internal/data/ent/authtokens.go index 1418838..a2b6589 100644 --- a/backend/internal/data/ent/authtokens.go +++ b/backend/internal/data/ent/authtokens.go @@ -190,9 +190,3 @@ func (at *AuthTokens) String() string { // AuthTokensSlice is a parsable slice of AuthTokens. type AuthTokensSlice []*AuthTokens - -func (at AuthTokensSlice) config(cfg config) { - for _i := range at { - at[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/authtokens_create.go b/backend/internal/data/ent/authtokens_create.go index d6632bb..a8f2971 100644 --- a/backend/internal/data/ent/authtokens_create.go +++ b/backend/internal/data/ent/authtokens_create.go @@ -219,13 +219,7 @@ func (atc *AuthTokensCreate) sqlSave(ctx context.Context) (*AuthTokens, error) { func (atc *AuthTokensCreate) createSpec() (*AuthTokens, *sqlgraph.CreateSpec) { var ( _node = &AuthTokens{config: atc.config} - _spec = &sqlgraph.CreateSpec{ - Table: authtokens.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(authtokens.Table, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID)) ) if id, ok := atc.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/authtokens_delete.go b/backend/internal/data/ent/authtokens_delete.go index 79c1a0c..1d46fe3 100644 --- a/backend/internal/data/ent/authtokens_delete.go +++ b/backend/internal/data/ent/authtokens_delete.go @@ -40,15 +40,7 @@ func (atd *AuthTokensDelete) ExecX(ctx context.Context) int { } func (atd *AuthTokensDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: authtokens.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(authtokens.Table, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID)) if ps := atd.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/authtokens_query.go b/backend/internal/data/ent/authtokens_query.go index 5695942..5b4302a 100644 --- a/backend/internal/data/ent/authtokens_query.go +++ b/backend/internal/data/ent/authtokens_query.go @@ -228,10 +228,12 @@ func (atq *AuthTokensQuery) AllX(ctx context.Context) []*AuthTokens { } // IDs executes the query and returns a list of AuthTokens IDs. -func (atq *AuthTokensQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (atq *AuthTokensQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if atq.ctx.Unique == nil && atq.path != nil { + atq.Unique(true) + } ctx = setContextOp(ctx, atq.ctx, "IDs") - if err := atq.Select(authtokens.FieldID).Scan(ctx, &ids); err != nil { + if err = atq.Select(authtokens.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -522,20 +524,12 @@ func (atq *AuthTokensQuery) sqlCount(ctx context.Context) (int, error) { } func (atq *AuthTokensQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: authtokens.Table, - Columns: authtokens.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, - }, - From: atq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(authtokens.Table, authtokens.Columns, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID)) + _spec.From = atq.sql if unique := atq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if atq.path != nil { + _spec.Unique = true } if fields := atq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/authtokens_update.go b/backend/internal/data/ent/authtokens_update.go index c058ee3..11f34db 100644 --- a/backend/internal/data/ent/authtokens_update.go +++ b/backend/internal/data/ent/authtokens_update.go @@ -149,16 +149,7 @@ func (atu *AuthTokensUpdate) defaults() { } func (atu *AuthTokensUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: authtokens.Table, - Columns: authtokens.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(authtokens.Table, authtokens.Columns, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID)) if ps := atu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -346,6 +337,12 @@ func (atuo *AuthTokensUpdateOne) ClearRoles() *AuthTokensUpdateOne { return atuo } +// Where appends a list predicates to the AuthTokensUpdate builder. +func (atuo *AuthTokensUpdateOne) Where(ps ...predicate.AuthTokens) *AuthTokensUpdateOne { + atuo.mutation.Where(ps...) + return atuo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (atuo *AuthTokensUpdateOne) Select(field string, fields ...string) *AuthTokensUpdateOne { @@ -390,16 +387,7 @@ func (atuo *AuthTokensUpdateOne) defaults() { } func (atuo *AuthTokensUpdateOne) sqlSave(ctx context.Context) (_node *AuthTokens, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: authtokens.Table, - Columns: authtokens.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: authtokens.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(authtokens.Table, authtokens.Columns, sqlgraph.NewFieldSpec(authtokens.FieldID, field.TypeUUID)) id, ok := atuo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "AuthTokens.id" for update`)} diff --git a/backend/internal/data/ent/client.go b/backend/internal/data/ent/client.go index f021598..44755c8 100644 --- a/backend/internal/data/ent/client.go +++ b/backend/internal/data/ent/client.go @@ -266,7 +266,7 @@ func (c *AttachmentClient) Use(hooks ...Hook) { c.hooks.Attachment = append(c.hooks.Attachment, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `attachment.Intercept(f(g(h())))`. func (c *AttachmentClient) Intercept(interceptors ...Interceptor) { c.inters.Attachment = append(c.inters.Attachment, interceptors...) @@ -416,7 +416,7 @@ func (c *AuthRolesClient) Use(hooks ...Hook) { c.hooks.AuthRoles = append(c.hooks.AuthRoles, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `authroles.Intercept(f(g(h())))`. func (c *AuthRolesClient) Intercept(interceptors ...Interceptor) { c.inters.AuthRoles = append(c.inters.AuthRoles, interceptors...) @@ -550,7 +550,7 @@ func (c *AuthTokensClient) Use(hooks ...Hook) { c.hooks.AuthTokens = append(c.hooks.AuthTokens, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `authtokens.Intercept(f(g(h())))`. func (c *AuthTokensClient) Intercept(interceptors ...Interceptor) { c.inters.AuthTokens = append(c.inters.AuthTokens, interceptors...) @@ -700,7 +700,7 @@ func (c *DocumentClient) Use(hooks ...Hook) { c.hooks.Document = append(c.hooks.Document, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `document.Intercept(f(g(h())))`. func (c *DocumentClient) Intercept(interceptors ...Interceptor) { c.inters.Document = append(c.inters.Document, interceptors...) @@ -850,7 +850,7 @@ func (c *GroupClient) Use(hooks ...Hook) { c.hooks.Group = append(c.hooks.Group, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `group.Intercept(f(g(h())))`. func (c *GroupClient) Intercept(interceptors ...Interceptor) { c.inters.Group = append(c.inters.Group, interceptors...) @@ -1064,7 +1064,7 @@ func (c *GroupInvitationTokenClient) Use(hooks ...Hook) { c.hooks.GroupInvitationToken = append(c.hooks.GroupInvitationToken, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `groupinvitationtoken.Intercept(f(g(h())))`. func (c *GroupInvitationTokenClient) Intercept(interceptors ...Interceptor) { c.inters.GroupInvitationToken = append(c.inters.GroupInvitationToken, interceptors...) @@ -1198,7 +1198,7 @@ func (c *ItemClient) Use(hooks ...Hook) { c.hooks.Item = append(c.hooks.Item, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `item.Intercept(f(g(h())))`. func (c *ItemClient) Intercept(interceptors ...Interceptor) { c.inters.Item = append(c.inters.Item, interceptors...) @@ -1444,7 +1444,7 @@ func (c *ItemFieldClient) Use(hooks ...Hook) { c.hooks.ItemField = append(c.hooks.ItemField, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `itemfield.Intercept(f(g(h())))`. func (c *ItemFieldClient) Intercept(interceptors ...Interceptor) { c.inters.ItemField = append(c.inters.ItemField, interceptors...) @@ -1578,7 +1578,7 @@ func (c *LabelClient) Use(hooks ...Hook) { c.hooks.Label = append(c.hooks.Label, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `label.Intercept(f(g(h())))`. func (c *LabelClient) Intercept(interceptors ...Interceptor) { c.inters.Label = append(c.inters.Label, interceptors...) @@ -1728,7 +1728,7 @@ func (c *LocationClient) Use(hooks ...Hook) { c.hooks.Location = append(c.hooks.Location, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `location.Intercept(f(g(h())))`. func (c *LocationClient) Intercept(interceptors ...Interceptor) { c.inters.Location = append(c.inters.Location, interceptors...) @@ -1910,7 +1910,7 @@ func (c *MaintenanceEntryClient) Use(hooks ...Hook) { c.hooks.MaintenanceEntry = append(c.hooks.MaintenanceEntry, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `maintenanceentry.Intercept(f(g(h())))`. func (c *MaintenanceEntryClient) Intercept(interceptors ...Interceptor) { c.inters.MaintenanceEntry = append(c.inters.MaintenanceEntry, interceptors...) @@ -2044,7 +2044,7 @@ func (c *UserClient) Use(hooks ...Hook) { c.hooks.User = append(c.hooks.User, hooks...) } -// Use adds a list of query interceptors to the interceptors stack. +// Intercept adds a list of query interceptors to the interceptors stack. // A call to `Intercept(f, g, h)` equals to `user.Intercept(f(g(h())))`. func (c *UserClient) Intercept(interceptors ...Interceptor) { c.inters.User = append(c.inters.User, interceptors...) diff --git a/backend/internal/data/ent/document.go b/backend/internal/data/ent/document.go index 661a37e..bcaae9a 100644 --- a/backend/internal/data/ent/document.go +++ b/backend/internal/data/ent/document.go @@ -185,9 +185,3 @@ func (d *Document) String() string { // Documents is a parsable slice of Document. type Documents []*Document - -func (d Documents) config(cfg config) { - for _i := range d { - d[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/document_create.go b/backend/internal/data/ent/document_create.go index 81f5e8c..eabfc0f 100644 --- a/backend/internal/data/ent/document_create.go +++ b/backend/internal/data/ent/document_create.go @@ -208,13 +208,7 @@ func (dc *DocumentCreate) sqlSave(ctx context.Context) (*Document, error) { func (dc *DocumentCreate) createSpec() (*Document, *sqlgraph.CreateSpec) { var ( _node = &Document{config: dc.config} - _spec = &sqlgraph.CreateSpec{ - Table: document.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(document.Table, sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID)) ) if id, ok := dc.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/document_delete.go b/backend/internal/data/ent/document_delete.go index 0096d8e..d0481d3 100644 --- a/backend/internal/data/ent/document_delete.go +++ b/backend/internal/data/ent/document_delete.go @@ -40,15 +40,7 @@ func (dd *DocumentDelete) ExecX(ctx context.Context) int { } func (dd *DocumentDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: document.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(document.Table, sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID)) if ps := dd.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/document_query.go b/backend/internal/data/ent/document_query.go index d2bde65..e22abe2 100644 --- a/backend/internal/data/ent/document_query.go +++ b/backend/internal/data/ent/document_query.go @@ -228,10 +228,12 @@ func (dq *DocumentQuery) AllX(ctx context.Context) []*Document { } // IDs executes the query and returns a list of Document IDs. -func (dq *DocumentQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (dq *DocumentQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if dq.ctx.Unique == nil && dq.path != nil { + dq.Unique(true) + } ctx = setContextOp(ctx, dq.ctx, "IDs") - if err := dq.Select(document.FieldID).Scan(ctx, &ids); err != nil { + if err = dq.Select(document.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -526,20 +528,12 @@ func (dq *DocumentQuery) sqlCount(ctx context.Context) (int, error) { } func (dq *DocumentQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: document.Table, - Columns: document.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, - }, - From: dq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(document.Table, document.Columns, sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID)) + _spec.From = dq.sql if unique := dq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if dq.path != nil { + _spec.Unique = true } if fields := dq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/document_update.go b/backend/internal/data/ent/document_update.go index e685bda..a172e5f 100644 --- a/backend/internal/data/ent/document_update.go +++ b/backend/internal/data/ent/document_update.go @@ -165,16 +165,7 @@ func (du *DocumentUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := du.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: document.Table, - Columns: document.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(document.Table, document.Columns, sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID)) if ps := du.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -376,6 +367,12 @@ func (duo *DocumentUpdateOne) RemoveAttachments(a ...*Attachment) *DocumentUpdat return duo.RemoveAttachmentIDs(ids...) } +// Where appends a list predicates to the DocumentUpdate builder. +func (duo *DocumentUpdateOne) Where(ps ...predicate.Document) *DocumentUpdateOne { + duo.mutation.Where(ps...) + return duo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (duo *DocumentUpdateOne) Select(field string, fields ...string) *DocumentUpdateOne { @@ -441,16 +438,7 @@ func (duo *DocumentUpdateOne) sqlSave(ctx context.Context) (_node *Document, err if err := duo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: document.Table, - Columns: document.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: document.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(document.Table, document.Columns, sqlgraph.NewFieldSpec(document.FieldID, field.TypeUUID)) id, ok := duo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Document.id" for update`)} diff --git a/backend/internal/data/ent/group.go b/backend/internal/data/ent/group.go index 16dc988..25e1ce4 100644 --- a/backend/internal/data/ent/group.go +++ b/backend/internal/data/ent/group.go @@ -234,9 +234,3 @@ func (gr *Group) String() string { // Groups is a parsable slice of Group. type Groups []*Group - -func (gr Groups) config(cfg config) { - for _i := range gr { - gr[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/group_create.go b/backend/internal/data/ent/group_create.go index b13c358..9f0e90a 100644 --- a/backend/internal/data/ent/group_create.go +++ b/backend/internal/data/ent/group_create.go @@ -285,13 +285,7 @@ func (gc *GroupCreate) sqlSave(ctx context.Context) (*Group, error) { func (gc *GroupCreate) createSpec() (*Group, *sqlgraph.CreateSpec) { var ( _node = &Group{config: gc.config} - _spec = &sqlgraph.CreateSpec{ - Table: group.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(group.Table, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID)) ) if id, ok := gc.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/group_delete.go b/backend/internal/data/ent/group_delete.go index eae02e2..29e0ffc 100644 --- a/backend/internal/data/ent/group_delete.go +++ b/backend/internal/data/ent/group_delete.go @@ -40,15 +40,7 @@ func (gd *GroupDelete) ExecX(ctx context.Context) int { } func (gd *GroupDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: group.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(group.Table, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID)) if ps := gd.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/group_query.go b/backend/internal/data/ent/group_query.go index a0f6d61..c9bef5f 100644 --- a/backend/internal/data/ent/group_query.go +++ b/backend/internal/data/ent/group_query.go @@ -323,10 +323,12 @@ func (gq *GroupQuery) AllX(ctx context.Context) []*Group { } // IDs executes the query and returns a list of Group IDs. -func (gq *GroupQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (gq *GroupQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if gq.ctx.Unique == nil && gq.path != nil { + gq.Unique(true) + } ctx = setContextOp(ctx, gq.ctx, "IDs") - if err := gq.Select(group.FieldID).Scan(ctx, &ids); err != nil { + if err = gq.Select(group.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -820,20 +822,12 @@ func (gq *GroupQuery) sqlCount(ctx context.Context) (int, error) { } func (gq *GroupQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: group.Table, - Columns: group.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, - }, - From: gq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID)) + _spec.From = gq.sql if unique := gq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if gq.path != nil { + _spec.Unique = true } if fields := gq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/group_update.go b/backend/internal/data/ent/group_update.go index e4263bf..1ff9cd6 100644 --- a/backend/internal/data/ent/group_update.go +++ b/backend/internal/data/ent/group_update.go @@ -337,16 +337,7 @@ func (gu *GroupUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := gu.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: group.Table, - Columns: group.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID)) if ps := gu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -954,6 +945,12 @@ func (guo *GroupUpdateOne) RemoveInvitationTokens(g ...*GroupInvitationToken) *G return guo.RemoveInvitationTokenIDs(ids...) } +// Where appends a list predicates to the GroupUpdate builder. +func (guo *GroupUpdateOne) Where(ps ...predicate.Group) *GroupUpdateOne { + guo.mutation.Where(ps...) + return guo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (guo *GroupUpdateOne) Select(field string, fields ...string) *GroupUpdateOne { @@ -1016,16 +1013,7 @@ func (guo *GroupUpdateOne) sqlSave(ctx context.Context) (_node *Group, err error if err := guo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: group.Table, - Columns: group.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: group.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(group.Table, group.Columns, sqlgraph.NewFieldSpec(group.FieldID, field.TypeUUID)) id, ok := guo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Group.id" for update`)} diff --git a/backend/internal/data/ent/groupinvitationtoken.go b/backend/internal/data/ent/groupinvitationtoken.go index 8f145d4..f8c2bb3 100644 --- a/backend/internal/data/ent/groupinvitationtoken.go +++ b/backend/internal/data/ent/groupinvitationtoken.go @@ -182,9 +182,3 @@ func (git *GroupInvitationToken) String() string { // GroupInvitationTokens is a parsable slice of GroupInvitationToken. type GroupInvitationTokens []*GroupInvitationToken - -func (git GroupInvitationTokens) config(cfg config) { - for _i := range git { - git[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/groupinvitationtoken_create.go b/backend/internal/data/ent/groupinvitationtoken_create.go index 01cd1c8..e45fb27 100644 --- a/backend/internal/data/ent/groupinvitationtoken_create.go +++ b/backend/internal/data/ent/groupinvitationtoken_create.go @@ -220,13 +220,7 @@ func (gitc *GroupInvitationTokenCreate) sqlSave(ctx context.Context) (*GroupInvi func (gitc *GroupInvitationTokenCreate) createSpec() (*GroupInvitationToken, *sqlgraph.CreateSpec) { var ( _node = &GroupInvitationToken{config: gitc.config} - _spec = &sqlgraph.CreateSpec{ - Table: groupinvitationtoken.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(groupinvitationtoken.Table, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID)) ) if id, ok := gitc.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/groupinvitationtoken_delete.go b/backend/internal/data/ent/groupinvitationtoken_delete.go index 1896841..1720383 100644 --- a/backend/internal/data/ent/groupinvitationtoken_delete.go +++ b/backend/internal/data/ent/groupinvitationtoken_delete.go @@ -40,15 +40,7 @@ func (gitd *GroupInvitationTokenDelete) ExecX(ctx context.Context) int { } func (gitd *GroupInvitationTokenDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: groupinvitationtoken.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(groupinvitationtoken.Table, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID)) if ps := gitd.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/groupinvitationtoken_query.go b/backend/internal/data/ent/groupinvitationtoken_query.go index ac1fc92..287b509 100644 --- a/backend/internal/data/ent/groupinvitationtoken_query.go +++ b/backend/internal/data/ent/groupinvitationtoken_query.go @@ -203,10 +203,12 @@ func (gitq *GroupInvitationTokenQuery) AllX(ctx context.Context) []*GroupInvitat } // IDs executes the query and returns a list of GroupInvitationToken IDs. -func (gitq *GroupInvitationTokenQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (gitq *GroupInvitationTokenQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if gitq.ctx.Unique == nil && gitq.path != nil { + gitq.Unique(true) + } ctx = setContextOp(ctx, gitq.ctx, "IDs") - if err := gitq.Select(groupinvitationtoken.FieldID).Scan(ctx, &ids); err != nil { + if err = gitq.Select(groupinvitationtoken.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -450,20 +452,12 @@ func (gitq *GroupInvitationTokenQuery) sqlCount(ctx context.Context) (int, error } func (gitq *GroupInvitationTokenQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: groupinvitationtoken.Table, - Columns: groupinvitationtoken.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, - }, - From: gitq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(groupinvitationtoken.Table, groupinvitationtoken.Columns, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID)) + _spec.From = gitq.sql if unique := gitq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if gitq.path != nil { + _spec.Unique = true } if fields := gitq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/groupinvitationtoken_update.go b/backend/internal/data/ent/groupinvitationtoken_update.go index ac7cfd2..7a4caaa 100644 --- a/backend/internal/data/ent/groupinvitationtoken_update.go +++ b/backend/internal/data/ent/groupinvitationtoken_update.go @@ -144,16 +144,7 @@ func (gitu *GroupInvitationTokenUpdate) defaults() { } func (gitu *GroupInvitationTokenUpdate) sqlSave(ctx context.Context) (n int, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: groupinvitationtoken.Table, - Columns: groupinvitationtoken.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(groupinvitationtoken.Table, groupinvitationtoken.Columns, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID)) if ps := gitu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -308,6 +299,12 @@ func (gituo *GroupInvitationTokenUpdateOne) ClearGroup() *GroupInvitationTokenUp return gituo } +// Where appends a list predicates to the GroupInvitationTokenUpdate builder. +func (gituo *GroupInvitationTokenUpdateOne) Where(ps ...predicate.GroupInvitationToken) *GroupInvitationTokenUpdateOne { + gituo.mutation.Where(ps...) + return gituo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (gituo *GroupInvitationTokenUpdateOne) Select(field string, fields ...string) *GroupInvitationTokenUpdateOne { @@ -352,16 +349,7 @@ func (gituo *GroupInvitationTokenUpdateOne) defaults() { } func (gituo *GroupInvitationTokenUpdateOne) sqlSave(ctx context.Context) (_node *GroupInvitationToken, err error) { - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: groupinvitationtoken.Table, - Columns: groupinvitationtoken.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: groupinvitationtoken.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(groupinvitationtoken.Table, groupinvitationtoken.Columns, sqlgraph.NewFieldSpec(groupinvitationtoken.FieldID, field.TypeUUID)) id, ok := gituo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "GroupInvitationToken.id" for update`)} diff --git a/backend/internal/data/ent/item.go b/backend/internal/data/ent/item.go index 415b8b9..3ad36f3 100644 --- a/backend/internal/data/ent/item.go +++ b/backend/internal/data/ent/item.go @@ -525,9 +525,3 @@ func (i *Item) String() string { // Items is a parsable slice of Item. type Items []*Item - -func (i Items) config(cfg config) { - for _i := range i { - i[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/item_create.go b/backend/internal/data/ent/item_create.go index da36e66..d1a446e 100644 --- a/backend/internal/data/ent/item_create.go +++ b/backend/internal/data/ent/item_create.go @@ -665,13 +665,7 @@ func (ic *ItemCreate) sqlSave(ctx context.Context) (*Item, error) { func (ic *ItemCreate) createSpec() (*Item, *sqlgraph.CreateSpec) { var ( _node = &Item{config: ic.config} - _spec = &sqlgraph.CreateSpec{ - Table: item.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(item.Table, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID)) ) if id, ok := ic.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/item_delete.go b/backend/internal/data/ent/item_delete.go index b6f0d47..c2d00ff 100644 --- a/backend/internal/data/ent/item_delete.go +++ b/backend/internal/data/ent/item_delete.go @@ -40,15 +40,7 @@ func (id *ItemDelete) ExecX(ctx context.Context) int { } func (id *ItemDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: item.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(item.Table, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID)) if ps := id.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/item_query.go b/backend/internal/data/ent/item_query.go index 045c31f..c6af553 100644 --- a/backend/internal/data/ent/item_query.go +++ b/backend/internal/data/ent/item_query.go @@ -370,10 +370,12 @@ func (iq *ItemQuery) AllX(ctx context.Context) []*Item { } // IDs executes the query and returns a list of Item IDs. -func (iq *ItemQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (iq *ItemQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if iq.ctx.Unique == nil && iq.path != nil { + iq.Unique(true) + } ctx = setContextOp(ctx, iq.ctx, "IDs") - if err := iq.Select(item.FieldID).Scan(ctx, &ids); err != nil { + if err = iq.Select(item.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -1000,20 +1002,12 @@ func (iq *ItemQuery) sqlCount(ctx context.Context) (int, error) { } func (iq *ItemQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: item.Table, - Columns: item.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, - }, - From: iq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(item.Table, item.Columns, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID)) + _spec.From = iq.sql if unique := iq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if iq.path != nil { + _spec.Unique = true } if fields := iq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/item_update.go b/backend/internal/data/ent/item_update.go index 1d5ec90..88796e4 100644 --- a/backend/internal/data/ent/item_update.go +++ b/backend/internal/data/ent/item_update.go @@ -753,16 +753,7 @@ func (iu *ItemUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := iu.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: item.Table, - Columns: item.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(item.Table, item.Columns, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID)) if ps := iu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -1909,6 +1900,12 @@ func (iuo *ItemUpdateOne) RemoveAttachments(a ...*Attachment) *ItemUpdateOne { return iuo.RemoveAttachmentIDs(ids...) } +// Where appends a list predicates to the ItemUpdate builder. +func (iuo *ItemUpdateOne) Where(ps ...predicate.Item) *ItemUpdateOne { + iuo.mutation.Where(ps...) + return iuo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (iuo *ItemUpdateOne) Select(field string, fields ...string) *ItemUpdateOne { @@ -2004,16 +2001,7 @@ func (iuo *ItemUpdateOne) sqlSave(ctx context.Context) (_node *Item, err error) if err := iuo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: item.Table, - Columns: item.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: item.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(item.Table, item.Columns, sqlgraph.NewFieldSpec(item.FieldID, field.TypeUUID)) id, ok := iuo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Item.id" for update`)} diff --git a/backend/internal/data/ent/itemfield.go b/backend/internal/data/ent/itemfield.go index 91b1195..cff6751 100644 --- a/backend/internal/data/ent/itemfield.go +++ b/backend/internal/data/ent/itemfield.go @@ -228,9 +228,3 @@ func (_if *ItemField) String() string { // ItemFields is a parsable slice of ItemField. type ItemFields []*ItemField - -func (_if ItemFields) config(cfg config) { - for _i := range _if { - _if[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/itemfield_create.go b/backend/internal/data/ent/itemfield_create.go index 32c5578..c124c0e 100644 --- a/backend/internal/data/ent/itemfield_create.go +++ b/backend/internal/data/ent/itemfield_create.go @@ -291,13 +291,7 @@ func (ifc *ItemFieldCreate) sqlSave(ctx context.Context) (*ItemField, error) { func (ifc *ItemFieldCreate) createSpec() (*ItemField, *sqlgraph.CreateSpec) { var ( _node = &ItemField{config: ifc.config} - _spec = &sqlgraph.CreateSpec{ - Table: itemfield.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(itemfield.Table, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID)) ) if id, ok := ifc.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/itemfield_delete.go b/backend/internal/data/ent/itemfield_delete.go index 5b9c139..181b736 100644 --- a/backend/internal/data/ent/itemfield_delete.go +++ b/backend/internal/data/ent/itemfield_delete.go @@ -40,15 +40,7 @@ func (ifd *ItemFieldDelete) ExecX(ctx context.Context) int { } func (ifd *ItemFieldDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: itemfield.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(itemfield.Table, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID)) if ps := ifd.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/itemfield_query.go b/backend/internal/data/ent/itemfield_query.go index ef8ca94..c00e422 100644 --- a/backend/internal/data/ent/itemfield_query.go +++ b/backend/internal/data/ent/itemfield_query.go @@ -203,10 +203,12 @@ func (ifq *ItemFieldQuery) AllX(ctx context.Context) []*ItemField { } // IDs executes the query and returns a list of ItemField IDs. -func (ifq *ItemFieldQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (ifq *ItemFieldQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if ifq.ctx.Unique == nil && ifq.path != nil { + ifq.Unique(true) + } ctx = setContextOp(ctx, ifq.ctx, "IDs") - if err := ifq.Select(itemfield.FieldID).Scan(ctx, &ids); err != nil { + if err = ifq.Select(itemfield.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -450,20 +452,12 @@ func (ifq *ItemFieldQuery) sqlCount(ctx context.Context) (int, error) { } func (ifq *ItemFieldQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: itemfield.Table, - Columns: itemfield.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, - }, - From: ifq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(itemfield.Table, itemfield.Columns, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID)) + _spec.From = ifq.sql if unique := ifq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if ifq.path != nil { + _spec.Unique = true } if fields := ifq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/itemfield_update.go b/backend/internal/data/ent/itemfield_update.go index ec93a55..b7ff379 100644 --- a/backend/internal/data/ent/itemfield_update.go +++ b/backend/internal/data/ent/itemfield_update.go @@ -238,16 +238,7 @@ func (ifu *ItemFieldUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := ifu.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: itemfield.Table, - Columns: itemfield.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(itemfield.Table, itemfield.Columns, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID)) if ps := ifu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -489,6 +480,12 @@ func (ifuo *ItemFieldUpdateOne) ClearItem() *ItemFieldUpdateOne { return ifuo } +// Where appends a list predicates to the ItemFieldUpdate builder. +func (ifuo *ItemFieldUpdateOne) Where(ps ...predicate.ItemField) *ItemFieldUpdateOne { + ifuo.mutation.Where(ps...) + return ifuo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (ifuo *ItemFieldUpdateOne) Select(field string, fields ...string) *ItemFieldUpdateOne { @@ -561,16 +558,7 @@ func (ifuo *ItemFieldUpdateOne) sqlSave(ctx context.Context) (_node *ItemField, if err := ifuo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: itemfield.Table, - Columns: itemfield.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: itemfield.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(itemfield.Table, itemfield.Columns, sqlgraph.NewFieldSpec(itemfield.FieldID, field.TypeUUID)) id, ok := ifuo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "ItemField.id" for update`)} diff --git a/backend/internal/data/ent/label.go b/backend/internal/data/ent/label.go index 22d5370..945b597 100644 --- a/backend/internal/data/ent/label.go +++ b/backend/internal/data/ent/label.go @@ -196,9 +196,3 @@ func (l *Label) String() string { // Labels is a parsable slice of Label. type Labels []*Label - -func (l Labels) config(cfg config) { - for _i := range l { - l[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/label_create.go b/backend/internal/data/ent/label_create.go index a9d8649..8df2903 100644 --- a/backend/internal/data/ent/label_create.go +++ b/backend/internal/data/ent/label_create.go @@ -232,13 +232,7 @@ func (lc *LabelCreate) sqlSave(ctx context.Context) (*Label, error) { func (lc *LabelCreate) createSpec() (*Label, *sqlgraph.CreateSpec) { var ( _node = &Label{config: lc.config} - _spec = &sqlgraph.CreateSpec{ - Table: label.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(label.Table, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID)) ) if id, ok := lc.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/label_delete.go b/backend/internal/data/ent/label_delete.go index bd869cd..2f6e251 100644 --- a/backend/internal/data/ent/label_delete.go +++ b/backend/internal/data/ent/label_delete.go @@ -40,15 +40,7 @@ func (ld *LabelDelete) ExecX(ctx context.Context) int { } func (ld *LabelDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: label.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(label.Table, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID)) if ps := ld.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/label_query.go b/backend/internal/data/ent/label_query.go index ec6165e..925641b 100644 --- a/backend/internal/data/ent/label_query.go +++ b/backend/internal/data/ent/label_query.go @@ -228,10 +228,12 @@ func (lq *LabelQuery) AllX(ctx context.Context) []*Label { } // IDs executes the query and returns a list of Label IDs. -func (lq *LabelQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (lq *LabelQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if lq.ctx.Unique == nil && lq.path != nil { + lq.Unique(true) + } ctx = setContextOp(ctx, lq.ctx, "IDs") - if err := lq.Select(label.FieldID).Scan(ctx, &ids); err != nil { + if err = lq.Select(label.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -556,20 +558,12 @@ func (lq *LabelQuery) sqlCount(ctx context.Context) (int, error) { } func (lq *LabelQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: label.Table, - Columns: label.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, - }, - From: lq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(label.Table, label.Columns, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID)) + _spec.From = lq.sql if unique := lq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if lq.path != nil { + _spec.Unique = true } if fields := lq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/label_update.go b/backend/internal/data/ent/label_update.go index 5b40eb2..57464ff 100644 --- a/backend/internal/data/ent/label_update.go +++ b/backend/internal/data/ent/label_update.go @@ -204,16 +204,7 @@ func (lu *LabelUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := lu.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: label.Table, - Columns: label.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(label.Table, label.Columns, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID)) if ps := lu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -458,6 +449,12 @@ func (luo *LabelUpdateOne) RemoveItems(i ...*Item) *LabelUpdateOne { return luo.RemoveItemIDs(ids...) } +// Where appends a list predicates to the LabelUpdate builder. +func (luo *LabelUpdateOne) Where(ps ...predicate.Label) *LabelUpdateOne { + luo.mutation.Where(ps...) + return luo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (luo *LabelUpdateOne) Select(field string, fields ...string) *LabelUpdateOne { @@ -528,16 +525,7 @@ func (luo *LabelUpdateOne) sqlSave(ctx context.Context) (_node *Label, err error if err := luo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: label.Table, - Columns: label.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: label.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(label.Table, label.Columns, sqlgraph.NewFieldSpec(label.FieldID, field.TypeUUID)) id, ok := luo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Label.id" for update`)} diff --git a/backend/internal/data/ent/location.go b/backend/internal/data/ent/location.go index 0ac5d00..002cfb2 100644 --- a/backend/internal/data/ent/location.go +++ b/backend/internal/data/ent/location.go @@ -231,9 +231,3 @@ func (l *Location) String() string { // Locations is a parsable slice of Location. type Locations []*Location - -func (l Locations) config(cfg config) { - for _i := range l { - l[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/location_create.go b/backend/internal/data/ent/location_create.go index 72618cf..2fade30 100644 --- a/backend/internal/data/ent/location_create.go +++ b/backend/internal/data/ent/location_create.go @@ -247,13 +247,7 @@ func (lc *LocationCreate) sqlSave(ctx context.Context) (*Location, error) { func (lc *LocationCreate) createSpec() (*Location, *sqlgraph.CreateSpec) { var ( _node = &Location{config: lc.config} - _spec = &sqlgraph.CreateSpec{ - Table: location.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(location.Table, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID)) ) if id, ok := lc.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/location_delete.go b/backend/internal/data/ent/location_delete.go index 24e0ff5..67a2adc 100644 --- a/backend/internal/data/ent/location_delete.go +++ b/backend/internal/data/ent/location_delete.go @@ -40,15 +40,7 @@ func (ld *LocationDelete) ExecX(ctx context.Context) int { } func (ld *LocationDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: location.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(location.Table, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID)) if ps := ld.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/location_query.go b/backend/internal/data/ent/location_query.go index 5b8647d..916215b 100644 --- a/backend/internal/data/ent/location_query.go +++ b/backend/internal/data/ent/location_query.go @@ -274,10 +274,12 @@ func (lq *LocationQuery) AllX(ctx context.Context) []*Location { } // IDs executes the query and returns a list of Location IDs. -func (lq *LocationQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (lq *LocationQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if lq.ctx.Unique == nil && lq.path != nil { + lq.Unique(true) + } ctx = setContextOp(ctx, lq.ctx, "IDs") - if err := lq.Select(location.FieldID).Scan(ctx, &ids); err != nil { + if err = lq.Select(location.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -674,20 +676,12 @@ func (lq *LocationQuery) sqlCount(ctx context.Context) (int, error) { } func (lq *LocationQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: location.Table, - Columns: location.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, - }, - From: lq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(location.Table, location.Columns, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID)) + _spec.From = lq.sql if unique := lq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if lq.path != nil { + _spec.Unique = true } if fields := lq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/location_update.go b/backend/internal/data/ent/location_update.go index 6833208..b67f7e4 100644 --- a/backend/internal/data/ent/location_update.go +++ b/backend/internal/data/ent/location_update.go @@ -240,16 +240,7 @@ func (lu *LocationUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := lu.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: location.Table, - Columns: location.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(location.Table, location.Columns, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID)) if ps := lu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -618,6 +609,12 @@ func (luo *LocationUpdateOne) RemoveItems(i ...*Item) *LocationUpdateOne { return luo.RemoveItemIDs(ids...) } +// Where appends a list predicates to the LocationUpdate builder. +func (luo *LocationUpdateOne) Where(ps ...predicate.Location) *LocationUpdateOne { + luo.mutation.Where(ps...) + return luo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (luo *LocationUpdateOne) Select(field string, fields ...string) *LocationUpdateOne { @@ -683,16 +680,7 @@ func (luo *LocationUpdateOne) sqlSave(ctx context.Context) (_node *Location, err if err := luo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: location.Table, - Columns: location.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: location.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(location.Table, location.Columns, sqlgraph.NewFieldSpec(location.FieldID, field.TypeUUID)) id, ok := luo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Location.id" for update`)} diff --git a/backend/internal/data/ent/maintenanceentry.go b/backend/internal/data/ent/maintenanceentry.go index c0f6a4e..b571bce 100644 --- a/backend/internal/data/ent/maintenanceentry.go +++ b/backend/internal/data/ent/maintenanceentry.go @@ -194,9 +194,3 @@ func (me *MaintenanceEntry) String() string { // MaintenanceEntries is a parsable slice of MaintenanceEntry. type MaintenanceEntries []*MaintenanceEntry - -func (me MaintenanceEntries) config(cfg config) { - for _i := range me { - me[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/maintenanceentry_create.go b/backend/internal/data/ent/maintenanceentry_create.go index a7a6a94..ef5602b 100644 --- a/backend/internal/data/ent/maintenanceentry_create.go +++ b/backend/internal/data/ent/maintenanceentry_create.go @@ -242,13 +242,7 @@ func (mec *MaintenanceEntryCreate) sqlSave(ctx context.Context) (*MaintenanceEnt func (mec *MaintenanceEntryCreate) createSpec() (*MaintenanceEntry, *sqlgraph.CreateSpec) { var ( _node = &MaintenanceEntry{config: mec.config} - _spec = &sqlgraph.CreateSpec{ - Table: maintenanceentry.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(maintenanceentry.Table, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID)) ) if id, ok := mec.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/maintenanceentry_delete.go b/backend/internal/data/ent/maintenanceentry_delete.go index cdfe480..d65ed8b 100644 --- a/backend/internal/data/ent/maintenanceentry_delete.go +++ b/backend/internal/data/ent/maintenanceentry_delete.go @@ -40,15 +40,7 @@ func (med *MaintenanceEntryDelete) ExecX(ctx context.Context) int { } func (med *MaintenanceEntryDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: maintenanceentry.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(maintenanceentry.Table, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID)) if ps := med.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/maintenanceentry_query.go b/backend/internal/data/ent/maintenanceentry_query.go index 114f8d9..52c8504 100644 --- a/backend/internal/data/ent/maintenanceentry_query.go +++ b/backend/internal/data/ent/maintenanceentry_query.go @@ -202,10 +202,12 @@ func (meq *MaintenanceEntryQuery) AllX(ctx context.Context) []*MaintenanceEntry } // IDs executes the query and returns a list of MaintenanceEntry IDs. -func (meq *MaintenanceEntryQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (meq *MaintenanceEntryQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if meq.ctx.Unique == nil && meq.path != nil { + meq.Unique(true) + } ctx = setContextOp(ctx, meq.ctx, "IDs") - if err := meq.Select(maintenanceentry.FieldID).Scan(ctx, &ids); err != nil { + if err = meq.Select(maintenanceentry.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -439,20 +441,12 @@ func (meq *MaintenanceEntryQuery) sqlCount(ctx context.Context) (int, error) { } func (meq *MaintenanceEntryQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: maintenanceentry.Table, - Columns: maintenanceentry.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, - }, - From: meq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(maintenanceentry.Table, maintenanceentry.Columns, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID)) + _spec.From = meq.sql if unique := meq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if meq.path != nil { + _spec.Unique = true } if fields := meq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/maintenanceentry_update.go b/backend/internal/data/ent/maintenanceentry_update.go index d4c3ee3..cade06b 100644 --- a/backend/internal/data/ent/maintenanceentry_update.go +++ b/backend/internal/data/ent/maintenanceentry_update.go @@ -177,16 +177,7 @@ func (meu *MaintenanceEntryUpdate) sqlSave(ctx context.Context) (n int, err erro if err := meu.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: maintenanceentry.Table, - Columns: maintenanceentry.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(maintenanceentry.Table, maintenanceentry.Columns, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID)) if ps := meu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -359,6 +350,12 @@ func (meuo *MaintenanceEntryUpdateOne) ClearItem() *MaintenanceEntryUpdateOne { return meuo } +// Where appends a list predicates to the MaintenanceEntryUpdate builder. +func (meuo *MaintenanceEntryUpdateOne) Where(ps ...predicate.MaintenanceEntry) *MaintenanceEntryUpdateOne { + meuo.mutation.Where(ps...) + return meuo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (meuo *MaintenanceEntryUpdateOne) Select(field string, fields ...string) *MaintenanceEntryUpdateOne { @@ -424,16 +421,7 @@ func (meuo *MaintenanceEntryUpdateOne) sqlSave(ctx context.Context) (_node *Main if err := meuo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: maintenanceentry.Table, - Columns: maintenanceentry.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: maintenanceentry.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(maintenanceentry.Table, maintenanceentry.Columns, sqlgraph.NewFieldSpec(maintenanceentry.FieldID, field.TypeUUID)) id, ok := meuo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "MaintenanceEntry.id" for update`)} diff --git a/backend/internal/data/ent/runtime/runtime.go b/backend/internal/data/ent/runtime/runtime.go index 84a815f..f6cb4c1 100644 --- a/backend/internal/data/ent/runtime/runtime.go +++ b/backend/internal/data/ent/runtime/runtime.go @@ -5,6 +5,6 @@ package runtime // The schema-stitching logic is generated in github.com/hay-kot/homebox/backend/internal/data/ent/runtime.go const ( - Version = "v0.11.7" // Version of ent codegen. - Sum = "h1:V+wKFh0jhAbY/FoU+PPbdMOf2Ma5vh07R/IdF+N/nFg=" // Sum of ent codegen. + Version = "v0.11.8" // Version of ent codegen. + Sum = "h1:M/M0QL1CYCUSdqGRXUrXhFYSDRJPsOOrr+RLEej/gyQ=" // Sum of ent codegen. ) diff --git a/backend/internal/data/ent/user.go b/backend/internal/data/ent/user.go index cd4709b..97a9279 100644 --- a/backend/internal/data/ent/user.go +++ b/backend/internal/data/ent/user.go @@ -241,9 +241,3 @@ func (u *User) String() string { // Users is a parsable slice of User. type Users []*User - -func (u Users) config(cfg config) { - for _i := range u { - u[_i].config = cfg - } -} diff --git a/backend/internal/data/ent/user_create.go b/backend/internal/data/ent/user_create.go index 367ff07..3dc703d 100644 --- a/backend/internal/data/ent/user_create.go +++ b/backend/internal/data/ent/user_create.go @@ -304,13 +304,7 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { var ( _node = &User{config: uc.config} - _spec = &sqlgraph.CreateSpec{ - Table: user.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, - } + _spec = sqlgraph.NewCreateSpec(user.Table, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID)) ) if id, ok := uc.mutation.ID(); ok { _node.ID = id diff --git a/backend/internal/data/ent/user_delete.go b/backend/internal/data/ent/user_delete.go index 0f2d066..4e38aab 100644 --- a/backend/internal/data/ent/user_delete.go +++ b/backend/internal/data/ent/user_delete.go @@ -40,15 +40,7 @@ func (ud *UserDelete) ExecX(ctx context.Context) int { } func (ud *UserDelete) sqlExec(ctx context.Context) (int, error) { - _spec := &sqlgraph.DeleteSpec{ - Node: &sqlgraph.NodeSpec{ - Table: user.Table, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, - }, - } + _spec := sqlgraph.NewDeleteSpec(user.Table, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID)) if ps := ud.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { diff --git a/backend/internal/data/ent/user_query.go b/backend/internal/data/ent/user_query.go index 151b5cb..a722f2e 100644 --- a/backend/internal/data/ent/user_query.go +++ b/backend/internal/data/ent/user_query.go @@ -228,10 +228,12 @@ func (uq *UserQuery) AllX(ctx context.Context) []*User { } // IDs executes the query and returns a list of User IDs. -func (uq *UserQuery) IDs(ctx context.Context) ([]uuid.UUID, error) { - var ids []uuid.UUID +func (uq *UserQuery) IDs(ctx context.Context) (ids []uuid.UUID, err error) { + if uq.ctx.Unique == nil && uq.path != nil { + uq.Unique(true) + } ctx = setContextOp(ctx, uq.ctx, "IDs") - if err := uq.Select(user.FieldID).Scan(ctx, &ids); err != nil { + if err = uq.Select(user.FieldID).Scan(ctx, &ids); err != nil { return nil, err } return ids, nil @@ -526,20 +528,12 @@ func (uq *UserQuery) sqlCount(ctx context.Context) (int, error) { } func (uq *UserQuery) querySpec() *sqlgraph.QuerySpec { - _spec := &sqlgraph.QuerySpec{ - Node: &sqlgraph.NodeSpec{ - Table: user.Table, - Columns: user.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, - }, - From: uq.sql, - Unique: true, - } + _spec := sqlgraph.NewQuerySpec(user.Table, user.Columns, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID)) + _spec.From = uq.sql if unique := uq.ctx.Unique; unique != nil { _spec.Unique = *unique + } else if uq.path != nil { + _spec.Unique = true } if fields := uq.ctx.Fields; len(fields) > 0 { _spec.Node.Columns = make([]string, 0, len(fields)) diff --git a/backend/internal/data/ent/user_update.go b/backend/internal/data/ent/user_update.go index f453d37..4bb0296 100644 --- a/backend/internal/data/ent/user_update.go +++ b/backend/internal/data/ent/user_update.go @@ -243,16 +243,7 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { if err := uu.check(); err != nil { return n, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: user.Table, - Columns: user.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(user.Table, user.Columns, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID)) if ps := uu.mutation.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { for i := range ps { @@ -540,6 +531,12 @@ func (uuo *UserUpdateOne) RemoveAuthTokens(a ...*AuthTokens) *UserUpdateOne { return uuo.RemoveAuthTokenIDs(ids...) } +// Where appends a list predicates to the UserUpdate builder. +func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne { + uuo.mutation.Where(ps...) + return uuo +} + // Select allows selecting one or more fields (columns) of the returned entity. // The default is selecting all fields defined in the entity schema. func (uuo *UserUpdateOne) Select(field string, fields ...string) *UserUpdateOne { @@ -615,16 +612,7 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) if err := uuo.check(); err != nil { return _node, err } - _spec := &sqlgraph.UpdateSpec{ - Node: &sqlgraph.NodeSpec{ - Table: user.Table, - Columns: user.Columns, - ID: &sqlgraph.FieldSpec{ - Type: field.TypeUUID, - Column: user.FieldID, - }, - }, - } + _spec := sqlgraph.NewUpdateSpec(user.Table, user.Columns, sqlgraph.NewFieldSpec(user.FieldID, field.TypeUUID)) id, ok := uuo.mutation.ID() if !ok { return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "User.id" for update`)}