From 7c1c4f11210670cf6f4eafe9c57ccce8e097d3c1 Mon Sep 17 00:00:00 2001 From: noah Date: Mon, 22 Nov 2021 16:26:54 +0900 Subject: [PATCH] Fix the ref --- ent/chatuser_create.go | 3 ++ ent/client.go | 6 +-- ent/migrate/schema.go | 2 +- ent/mutation.go | 90 +++++++++++++++++++++--------------------- ent/repo_create.go | 2 +- ent/schema/repo.go | 2 +- ent/user.go | 18 ++++----- ent/user/user.go | 16 ++++---- ent/user/where.go | 16 ++++---- ent/user_create.go | 14 +++---- ent/user_query.go | 28 ++++++------- ent/user_update.go | 72 ++++++++++++++++----------------- go.sum | 1 + 13 files changed, 137 insertions(+), 133 deletions(-) diff --git a/ent/chatuser_create.go b/ent/chatuser_create.go index 1f869059..e94afb54 100644 --- a/ent/chatuser_create.go +++ b/ent/chatuser_create.go @@ -208,6 +208,9 @@ func (cuc *ChatUserCreate) sqlSave(ctx context.Context) (*ChatUser, error) { } return nil, err } + if _spec.ID.Value != nil { + _node.ID = _spec.ID.Value.(string) + } return _node, nil } diff --git a/ent/client.go b/ent/client.go index 2c020ddd..14a8910f 100644 --- a/ent/client.go +++ b/ent/client.go @@ -1770,15 +1770,15 @@ func (c *UserClient) QueryLocks(u *User) *LockQuery { return query } -// QueryRepo queries the repo edge of a User. -func (c *UserClient) QueryRepo(u *User) *RepoQuery { +// QueryRepos queries the repos edge of a User. +func (c *UserClient) QueryRepos(u *User) *RepoQuery { query := &RepoQuery{config: c.config} query.path = func(ctx context.Context) (fromV *sql.Selector, _ error) { id := u.ID step := sqlgraph.NewStep( sqlgraph.From(user.Table, user.FieldID, id), sqlgraph.To(repo.Table, repo.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, user.RepoTable, user.RepoColumn), + sqlgraph.Edge(sqlgraph.O2M, false, user.ReposTable, user.ReposColumn), ) fromV = sqlgraph.Neighbors(u.driver.Dialect(), step) return fromV, nil diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index 1b2263af..cce3caf4 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -348,7 +348,7 @@ var ( PrimaryKey: []*schema.Column{ReposColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { - Symbol: "repos_users_repo", + Symbol: "repos_users_repos", Columns: []*schema.Column{ReposColumns[10]}, RefColumns: []*schema.Column{UsersColumns[0]}, OnDelete: schema.SetNull, diff --git a/ent/mutation.go b/ent/mutation.go index eeec2c68..0d67a88b 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -9368,9 +9368,9 @@ type UserMutation struct { locks map[int]struct{} removedlocks map[int]struct{} clearedlocks bool - repo map[int64]struct{} - removedrepo map[int64]struct{} - clearedrepo bool + repos map[int64]struct{} + removedrepos map[int64]struct{} + clearedrepos bool done bool oldValue func(context.Context) (*User, error) predicates []predicate.User @@ -10040,58 +10040,58 @@ func (m *UserMutation) ResetLocks() { m.removedlocks = nil } -// AddRepoIDs adds the "repo" edge to the Repo entity by ids. +// AddRepoIDs adds the "repos" edge to the Repo entity by ids. func (m *UserMutation) AddRepoIDs(ids ...int64) { - if m.repo == nil { - m.repo = make(map[int64]struct{}) + if m.repos == nil { + m.repos = make(map[int64]struct{}) } for i := range ids { - m.repo[ids[i]] = struct{}{} + m.repos[ids[i]] = struct{}{} } } -// ClearRepo clears the "repo" edge to the Repo entity. -func (m *UserMutation) ClearRepo() { - m.clearedrepo = true +// ClearRepos clears the "repos" edge to the Repo entity. +func (m *UserMutation) ClearRepos() { + m.clearedrepos = true } -// RepoCleared reports if the "repo" edge to the Repo entity was cleared. -func (m *UserMutation) RepoCleared() bool { - return m.clearedrepo +// ReposCleared reports if the "repos" edge to the Repo entity was cleared. +func (m *UserMutation) ReposCleared() bool { + return m.clearedrepos } -// RemoveRepoIDs removes the "repo" edge to the Repo entity by IDs. +// RemoveRepoIDs removes the "repos" edge to the Repo entity by IDs. func (m *UserMutation) RemoveRepoIDs(ids ...int64) { - if m.removedrepo == nil { - m.removedrepo = make(map[int64]struct{}) + if m.removedrepos == nil { + m.removedrepos = make(map[int64]struct{}) } for i := range ids { - delete(m.repo, ids[i]) - m.removedrepo[ids[i]] = struct{}{} + delete(m.repos, ids[i]) + m.removedrepos[ids[i]] = struct{}{} } } -// RemovedRepo returns the removed IDs of the "repo" edge to the Repo entity. -func (m *UserMutation) RemovedRepoIDs() (ids []int64) { - for id := range m.removedrepo { +// RemovedRepos returns the removed IDs of the "repos" edge to the Repo entity. +func (m *UserMutation) RemovedReposIDs() (ids []int64) { + for id := range m.removedrepos { ids = append(ids, id) } return } -// RepoIDs returns the "repo" edge IDs in the mutation. -func (m *UserMutation) RepoIDs() (ids []int64) { - for id := range m.repo { +// ReposIDs returns the "repos" edge IDs in the mutation. +func (m *UserMutation) ReposIDs() (ids []int64) { + for id := range m.repos { ids = append(ids, id) } return } -// ResetRepo resets all changes to the "repo" edge. -func (m *UserMutation) ResetRepo() { - m.repo = nil - m.clearedrepo = false - m.removedrepo = nil +// ResetRepos resets all changes to the "repos" edge. +func (m *UserMutation) ResetRepos() { + m.repos = nil + m.clearedrepos = false + m.removedrepos = nil } // Where appends a list predicates to the UserMutation builder. @@ -10364,8 +10364,8 @@ func (m *UserMutation) AddedEdges() []string { if m.locks != nil { edges = append(edges, user.EdgeLocks) } - if m.repo != nil { - edges = append(edges, user.EdgeRepo) + if m.repos != nil { + edges = append(edges, user.EdgeRepos) } return edges } @@ -10402,9 +10402,9 @@ func (m *UserMutation) AddedIDs(name string) []ent.Value { ids = append(ids, id) } return ids - case user.EdgeRepo: - ids := make([]ent.Value, 0, len(m.repo)) - for id := range m.repo { + case user.EdgeRepos: + ids := make([]ent.Value, 0, len(m.repos)) + for id := range m.repos { ids = append(ids, id) } return ids @@ -10427,8 +10427,8 @@ func (m *UserMutation) RemovedEdges() []string { if m.removedlocks != nil { edges = append(edges, user.EdgeLocks) } - if m.removedrepo != nil { - edges = append(edges, user.EdgeRepo) + if m.removedrepos != nil { + edges = append(edges, user.EdgeRepos) } return edges } @@ -10461,9 +10461,9 @@ func (m *UserMutation) RemovedIDs(name string) []ent.Value { ids = append(ids, id) } return ids - case user.EdgeRepo: - ids := make([]ent.Value, 0, len(m.removedrepo)) - for id := range m.removedrepo { + case user.EdgeRepos: + ids := make([]ent.Value, 0, len(m.removedrepos)) + for id := range m.removedrepos { ids = append(ids, id) } return ids @@ -10489,8 +10489,8 @@ func (m *UserMutation) ClearedEdges() []string { if m.clearedlocks { edges = append(edges, user.EdgeLocks) } - if m.clearedrepo { - edges = append(edges, user.EdgeRepo) + if m.clearedrepos { + edges = append(edges, user.EdgeRepos) } return edges } @@ -10509,8 +10509,8 @@ func (m *UserMutation) EdgeCleared(name string) bool { return m.clearedreviews case user.EdgeLocks: return m.clearedlocks - case user.EdgeRepo: - return m.clearedrepo + case user.EdgeRepos: + return m.clearedrepos } return false } @@ -10545,8 +10545,8 @@ func (m *UserMutation) ResetEdge(name string) error { case user.EdgeLocks: m.ResetLocks() return nil - case user.EdgeRepo: - m.ResetRepo() + case user.EdgeRepos: + m.ResetRepos() return nil } return fmt.Errorf("unknown User edge %s", name) diff --git a/ent/repo_create.go b/ent/repo_create.go index b9c2a6aa..97e4f40d 100644 --- a/ent/repo_create.go +++ b/ent/repo_create.go @@ -351,7 +351,7 @@ func (rc *RepoCreate) sqlSave(ctx context.Context) (*Repo, error) { } return nil, err } - if _node.ID == 0 { + if _spec.ID.Value != _node.ID { id := _spec.ID.Value.(int64) _node.ID = int64(id) } diff --git a/ent/schema/repo.go b/ent/schema/repo.go index 7b44a113..9ddbcbf3 100644 --- a/ent/schema/repo.go +++ b/ent/schema/repo.go @@ -65,7 +65,7 @@ func (Repo) Edges() []ent.Edge { OnDelete: entsql.Cascade, }), edge.From("owner", User.Type). - Ref("repo"). + Ref("repos"). Field("owner_id"). Unique(), } diff --git a/ent/user.go b/ent/user.go index 09fdda40..e8ef56c6 100644 --- a/ent/user.go +++ b/ent/user.go @@ -52,8 +52,8 @@ type UserEdges struct { Reviews []*Review `json:"reviews,omitempty"` // Locks holds the value of the locks edge. Locks []*Lock `json:"locks,omitempty"` - // Repo holds the value of the repo edge. - Repo []*Repo `json:"repo,omitempty"` + // Repos holds the value of the repos edge. + Repos []*Repo `json:"repos,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. loadedTypes [6]bool @@ -109,13 +109,13 @@ func (e UserEdges) LocksOrErr() ([]*Lock, error) { return nil, &NotLoadedError{edge: "locks"} } -// RepoOrErr returns the Repo value or an error if the edge +// ReposOrErr returns the Repos value or an error if the edge // was not loaded in eager-loading. -func (e UserEdges) RepoOrErr() ([]*Repo, error) { +func (e UserEdges) ReposOrErr() ([]*Repo, error) { if e.loadedTypes[5] { - return e.Repo, nil + return e.Repos, nil } - return nil, &NotLoadedError{edge: "repo"} + return nil, &NotLoadedError{edge: "repos"} } // scanValues returns the types for scanning values from sql.Rows. @@ -236,9 +236,9 @@ func (u *User) QueryLocks() *LockQuery { return (&UserClient{config: u.config}).QueryLocks(u) } -// QueryRepo queries the "repo" edge of the User entity. -func (u *User) QueryRepo() *RepoQuery { - return (&UserClient{config: u.config}).QueryRepo(u) +// QueryRepos queries the "repos" edge of the User entity. +func (u *User) QueryRepos() *RepoQuery { + return (&UserClient{config: u.config}).QueryRepos(u) } // Update returns a builder for updating this User. diff --git a/ent/user/user.go b/ent/user/user.go index 2938adbc..336f3db6 100644 --- a/ent/user/user.go +++ b/ent/user/user.go @@ -39,8 +39,8 @@ const ( EdgeReviews = "reviews" // EdgeLocks holds the string denoting the locks edge name in mutations. EdgeLocks = "locks" - // EdgeRepo holds the string denoting the repo edge name in mutations. - EdgeRepo = "repo" + // EdgeRepos holds the string denoting the repos edge name in mutations. + EdgeRepos = "repos" // Table holds the table name of the user in the database. Table = "users" // ChatUserTable is the table that holds the chat_user relation/edge. @@ -78,13 +78,13 @@ const ( LocksInverseTable = "locks" // LocksColumn is the table column denoting the locks relation/edge. LocksColumn = "user_id" - // RepoTable is the table that holds the repo relation/edge. - RepoTable = "repos" - // RepoInverseTable is the table name for the Repo entity. + // ReposTable is the table that holds the repos relation/edge. + ReposTable = "repos" + // ReposInverseTable is the table name for the Repo entity. // It exists in this package in order to avoid circular dependency with the "repo" package. - RepoInverseTable = "repos" - // RepoColumn is the table column denoting the repo relation/edge. - RepoColumn = "owner_id" + ReposInverseTable = "repos" + // ReposColumn is the table column denoting the repos relation/edge. + ReposColumn = "owner_id" ) // Columns holds all SQL columns for user fields. diff --git a/ent/user/where.go b/ent/user/where.go index 2bb08161..0d8c6fff 100644 --- a/ent/user/where.go +++ b/ent/user/where.go @@ -1093,25 +1093,25 @@ func HasLocksWith(preds ...predicate.Lock) predicate.User { }) } -// HasRepo applies the HasEdge predicate on the "repo" edge. -func HasRepo() predicate.User { +// HasRepos applies the HasEdge predicate on the "repos" edge. +func HasRepos() predicate.User { return predicate.User(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.To(RepoTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, RepoTable, RepoColumn), + sqlgraph.To(ReposTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ReposTable, ReposColumn), ) sqlgraph.HasNeighbors(s, step) }) } -// HasRepoWith applies the HasEdge predicate on the "repo" edge with a given conditions (other predicates). -func HasRepoWith(preds ...predicate.Repo) predicate.User { +// HasReposWith applies the HasEdge predicate on the "repos" edge with a given conditions (other predicates). +func HasReposWith(preds ...predicate.Repo) predicate.User { return predicate.User(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.To(RepoInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, RepoTable, RepoColumn), + sqlgraph.To(ReposInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, ReposTable, ReposColumn), ) sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { diff --git a/ent/user_create.go b/ent/user_create.go index 0a22a39d..25613774 100644 --- a/ent/user_create.go +++ b/ent/user_create.go @@ -197,14 +197,14 @@ func (uc *UserCreate) AddLocks(l ...*Lock) *UserCreate { return uc.AddLockIDs(ids...) } -// AddRepoIDs adds the "repo" edge to the Repo entity by IDs. +// AddRepoIDs adds the "repos" edge to the Repo entity by IDs. func (uc *UserCreate) AddRepoIDs(ids ...int64) *UserCreate { uc.mutation.AddRepoIDs(ids...) return uc } -// AddRepo adds the "repo" edges to the Repo entity. -func (uc *UserCreate) AddRepo(r ...*Repo) *UserCreate { +// AddRepos adds the "repos" edges to the Repo entity. +func (uc *UserCreate) AddRepos(r ...*Repo) *UserCreate { ids := make([]int64, len(r)) for i := range r { ids[i] = r[i].ID @@ -341,7 +341,7 @@ func (uc *UserCreate) sqlSave(ctx context.Context) (*User, error) { } return nil, err } - if _node.ID == 0 { + if _spec.ID.Value != _node.ID { id := _spec.ID.Value.(int64) _node.ID = int64(id) } @@ -530,12 +530,12 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - if nodes := uc.mutation.RepoIDs(); len(nodes) > 0 { + if nodes := uc.mutation.ReposIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: user.RepoTable, - Columns: []string{user.RepoColumn}, + Table: user.ReposTable, + Columns: []string{user.ReposColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ diff --git a/ent/user_query.go b/ent/user_query.go index 220e83d3..a05bfd6d 100644 --- a/ent/user_query.go +++ b/ent/user_query.go @@ -38,7 +38,7 @@ type UserQuery struct { withDeployments *DeploymentQuery withReviews *ReviewQuery withLocks *LockQuery - withRepo *RepoQuery + withRepos *RepoQuery modifiers []func(s *sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector @@ -186,8 +186,8 @@ func (uq *UserQuery) QueryLocks() *LockQuery { return query } -// QueryRepo chains the current query on the "repo" edge. -func (uq *UserQuery) QueryRepo() *RepoQuery { +// QueryRepos chains the current query on the "repos" edge. +func (uq *UserQuery) QueryRepos() *RepoQuery { query := &RepoQuery{config: uq.config} query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := uq.prepareQuery(ctx); err != nil { @@ -200,7 +200,7 @@ func (uq *UserQuery) QueryRepo() *RepoQuery { step := sqlgraph.NewStep( sqlgraph.From(user.Table, user.FieldID, selector), sqlgraph.To(repo.Table, repo.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, user.RepoTable, user.RepoColumn), + sqlgraph.Edge(sqlgraph.O2M, false, user.ReposTable, user.ReposColumn), ) fromU = sqlgraph.SetNeighbors(uq.driver.Dialect(), step) return fromU, nil @@ -394,7 +394,7 @@ func (uq *UserQuery) Clone() *UserQuery { withDeployments: uq.withDeployments.Clone(), withReviews: uq.withReviews.Clone(), withLocks: uq.withLocks.Clone(), - withRepo: uq.withRepo.Clone(), + withRepos: uq.withRepos.Clone(), // clone intermediate query. sql: uq.sql.Clone(), path: uq.path, @@ -456,14 +456,14 @@ func (uq *UserQuery) WithLocks(opts ...func(*LockQuery)) *UserQuery { return uq } -// WithRepo tells the query-builder to eager-load the nodes that are connected to -// the "repo" edge. The optional arguments are used to configure the query builder of the edge. -func (uq *UserQuery) WithRepo(opts ...func(*RepoQuery)) *UserQuery { +// WithRepos tells the query-builder to eager-load the nodes that are connected to +// the "repos" edge. The optional arguments are used to configure the query builder of the edge. +func (uq *UserQuery) WithRepos(opts ...func(*RepoQuery)) *UserQuery { query := &RepoQuery{config: uq.config} for _, opt := range opts { opt(query) } - uq.withRepo = query + uq.withRepos = query return uq } @@ -538,7 +538,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { uq.withDeployments != nil, uq.withReviews != nil, uq.withLocks != nil, - uq.withRepo != nil, + uq.withRepos != nil, } ) _spec.ScanValues = func(columns []string) ([]interface{}, error) { @@ -688,16 +688,16 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { } } - if query := uq.withRepo; query != nil { + if query := uq.withRepos; query != nil { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[int64]*User) for i := range nodes { fks = append(fks, nodes[i].ID) nodeids[nodes[i].ID] = nodes[i] - nodes[i].Edges.Repo = []*Repo{} + nodes[i].Edges.Repos = []*Repo{} } query.Where(predicate.Repo(func(s *sql.Selector) { - s.Where(sql.InValues(user.RepoColumn, fks...)) + s.Where(sql.InValues(user.ReposColumn, fks...)) })) neighbors, err := query.All(ctx) if err != nil { @@ -709,7 +709,7 @@ func (uq *UserQuery) sqlAll(ctx context.Context) ([]*User, error) { if !ok { return nil, fmt.Errorf(`unexpected foreign-key "owner_id" returned %v for node %v`, fk, n.ID) } - node.Edges.Repo = append(node.Edges.Repo, n) + node.Edges.Repos = append(node.Edges.Repos, n) } } diff --git a/ent/user_update.go b/ent/user_update.go index 90979b68..e4e215f8 100644 --- a/ent/user_update.go +++ b/ent/user_update.go @@ -176,14 +176,14 @@ func (uu *UserUpdate) AddLocks(l ...*Lock) *UserUpdate { return uu.AddLockIDs(ids...) } -// AddRepoIDs adds the "repo" edge to the Repo entity by IDs. +// AddRepoIDs adds the "repos" edge to the Repo entity by IDs. func (uu *UserUpdate) AddRepoIDs(ids ...int64) *UserUpdate { uu.mutation.AddRepoIDs(ids...) return uu } -// AddRepo adds the "repo" edges to the Repo entity. -func (uu *UserUpdate) AddRepo(r ...*Repo) *UserUpdate { +// AddRepos adds the "repos" edges to the Repo entity. +func (uu *UserUpdate) AddRepos(r ...*Repo) *UserUpdate { ids := make([]int64, len(r)) for i := range r { ids[i] = r[i].ID @@ -286,20 +286,20 @@ func (uu *UserUpdate) RemoveLocks(l ...*Lock) *UserUpdate { return uu.RemoveLockIDs(ids...) } -// ClearRepo clears all "repo" edges to the Repo entity. -func (uu *UserUpdate) ClearRepo() *UserUpdate { - uu.mutation.ClearRepo() +// ClearRepos clears all "repos" edges to the Repo entity. +func (uu *UserUpdate) ClearRepos() *UserUpdate { + uu.mutation.ClearRepos() return uu } -// RemoveRepoIDs removes the "repo" edge to Repo entities by IDs. +// RemoveRepoIDs removes the "repos" edge to Repo entities by IDs. func (uu *UserUpdate) RemoveRepoIDs(ids ...int64) *UserUpdate { uu.mutation.RemoveRepoIDs(ids...) return uu } -// RemoveRepo removes "repo" edges to Repo entities. -func (uu *UserUpdate) RemoveRepo(r ...*Repo) *UserUpdate { +// RemoveRepos removes "repos" edges to Repo entities. +func (uu *UserUpdate) RemoveRepos(r ...*Repo) *UserUpdate { ids := make([]int64, len(r)) for i := range r { ids[i] = r[i].ID @@ -695,12 +695,12 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if uu.mutation.RepoCleared() { + if uu.mutation.ReposCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: user.RepoTable, - Columns: []string{user.RepoColumn}, + Table: user.ReposTable, + Columns: []string{user.ReposColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ @@ -711,12 +711,12 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := uu.mutation.RemovedRepoIDs(); len(nodes) > 0 && !uu.mutation.RepoCleared() { + if nodes := uu.mutation.RemovedReposIDs(); len(nodes) > 0 && !uu.mutation.ReposCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: user.RepoTable, - Columns: []string{user.RepoColumn}, + Table: user.ReposTable, + Columns: []string{user.ReposColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ @@ -730,12 +730,12 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := uu.mutation.RepoIDs(); len(nodes) > 0 { + if nodes := uu.mutation.ReposIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: user.RepoTable, - Columns: []string{user.RepoColumn}, + Table: user.ReposTable, + Columns: []string{user.ReposColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ @@ -911,14 +911,14 @@ func (uuo *UserUpdateOne) AddLocks(l ...*Lock) *UserUpdateOne { return uuo.AddLockIDs(ids...) } -// AddRepoIDs adds the "repo" edge to the Repo entity by IDs. +// AddRepoIDs adds the "repos" edge to the Repo entity by IDs. func (uuo *UserUpdateOne) AddRepoIDs(ids ...int64) *UserUpdateOne { uuo.mutation.AddRepoIDs(ids...) return uuo } -// AddRepo adds the "repo" edges to the Repo entity. -func (uuo *UserUpdateOne) AddRepo(r ...*Repo) *UserUpdateOne { +// AddRepos adds the "repos" edges to the Repo entity. +func (uuo *UserUpdateOne) AddRepos(r ...*Repo) *UserUpdateOne { ids := make([]int64, len(r)) for i := range r { ids[i] = r[i].ID @@ -1021,20 +1021,20 @@ func (uuo *UserUpdateOne) RemoveLocks(l ...*Lock) *UserUpdateOne { return uuo.RemoveLockIDs(ids...) } -// ClearRepo clears all "repo" edges to the Repo entity. -func (uuo *UserUpdateOne) ClearRepo() *UserUpdateOne { - uuo.mutation.ClearRepo() +// ClearRepos clears all "repos" edges to the Repo entity. +func (uuo *UserUpdateOne) ClearRepos() *UserUpdateOne { + uuo.mutation.ClearRepos() return uuo } -// RemoveRepoIDs removes the "repo" edge to Repo entities by IDs. +// RemoveRepoIDs removes the "repos" edge to Repo entities by IDs. func (uuo *UserUpdateOne) RemoveRepoIDs(ids ...int64) *UserUpdateOne { uuo.mutation.RemoveRepoIDs(ids...) return uuo } -// RemoveRepo removes "repo" edges to Repo entities. -func (uuo *UserUpdateOne) RemoveRepo(r ...*Repo) *UserUpdateOne { +// RemoveRepos removes "repos" edges to Repo entities. +func (uuo *UserUpdateOne) RemoveRepos(r ...*Repo) *UserUpdateOne { ids := make([]int64, len(r)) for i := range r { ids[i] = r[i].ID @@ -1454,12 +1454,12 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if uuo.mutation.RepoCleared() { + if uuo.mutation.ReposCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: user.RepoTable, - Columns: []string{user.RepoColumn}, + Table: user.ReposTable, + Columns: []string{user.ReposColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ @@ -1470,12 +1470,12 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := uuo.mutation.RemovedRepoIDs(); len(nodes) > 0 && !uuo.mutation.RepoCleared() { + if nodes := uuo.mutation.RemovedReposIDs(); len(nodes) > 0 && !uuo.mutation.ReposCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: user.RepoTable, - Columns: []string{user.RepoColumn}, + Table: user.ReposTable, + Columns: []string{user.ReposColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ @@ -1489,12 +1489,12 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := uuo.mutation.RepoIDs(); len(nodes) > 0 { + if nodes := uuo.mutation.ReposIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: user.RepoTable, - Columns: []string{user.RepoColumn}, + Table: user.ReposTable, + Columns: []string{user.ReposColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: &sqlgraph.FieldSpec{ diff --git a/go.sum b/go.sum index 6cb3d899..271b719c 100644 --- a/go.sum +++ b/go.sum @@ -113,6 +113,7 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4= github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=