account_update.go•141 kB
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/dialect/sql/sqljson"
"entgo.io/ent/schema/field"
"github.com/Southclaws/storyden/internal/ent/account"
"github.com/Southclaws/storyden/internal/ent/accountfollow"
"github.com/Southclaws/storyden/internal/ent/accountroles"
"github.com/Southclaws/storyden/internal/ent/asset"
"github.com/Southclaws/storyden/internal/ent/authentication"
"github.com/Southclaws/storyden/internal/ent/collection"
"github.com/Southclaws/storyden/internal/ent/email"
"github.com/Southclaws/storyden/internal/ent/eventparticipant"
"github.com/Southclaws/storyden/internal/ent/invitation"
"github.com/Southclaws/storyden/internal/ent/likepost"
"github.com/Southclaws/storyden/internal/ent/mentionprofile"
"github.com/Southclaws/storyden/internal/ent/node"
"github.com/Southclaws/storyden/internal/ent/notification"
"github.com/Southclaws/storyden/internal/ent/post"
"github.com/Southclaws/storyden/internal/ent/postread"
"github.com/Southclaws/storyden/internal/ent/predicate"
"github.com/Southclaws/storyden/internal/ent/question"
"github.com/Southclaws/storyden/internal/ent/react"
"github.com/Southclaws/storyden/internal/ent/report"
"github.com/Southclaws/storyden/internal/ent/role"
"github.com/Southclaws/storyden/internal/ent/schema"
"github.com/Southclaws/storyden/internal/ent/session"
"github.com/Southclaws/storyden/internal/ent/tag"
"github.com/rs/xid"
)
// AccountUpdate is the builder for updating Account entities.
type AccountUpdate struct {
config
hooks []Hook
mutation *AccountMutation
modifiers []func(*sql.UpdateBuilder)
}
// Where appends a list predicates to the AccountUpdate builder.
func (_u *AccountUpdate) Where(ps ...predicate.Account) *AccountUpdate {
_u.mutation.Where(ps...)
return _u
}
// SetUpdatedAt sets the "updated_at" field.
func (_u *AccountUpdate) SetUpdatedAt(v time.Time) *AccountUpdate {
_u.mutation.SetUpdatedAt(v)
return _u
}
// SetDeletedAt sets the "deleted_at" field.
func (_u *AccountUpdate) SetDeletedAt(v time.Time) *AccountUpdate {
_u.mutation.SetDeletedAt(v)
return _u
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_u *AccountUpdate) SetNillableDeletedAt(v *time.Time) *AccountUpdate {
if v != nil {
_u.SetDeletedAt(*v)
}
return _u
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (_u *AccountUpdate) ClearDeletedAt() *AccountUpdate {
_u.mutation.ClearDeletedAt()
return _u
}
// SetIndexedAt sets the "indexed_at" field.
func (_u *AccountUpdate) SetIndexedAt(v time.Time) *AccountUpdate {
_u.mutation.SetIndexedAt(v)
return _u
}
// SetNillableIndexedAt sets the "indexed_at" field if the given value is not nil.
func (_u *AccountUpdate) SetNillableIndexedAt(v *time.Time) *AccountUpdate {
if v != nil {
_u.SetIndexedAt(*v)
}
return _u
}
// ClearIndexedAt clears the value of the "indexed_at" field.
func (_u *AccountUpdate) ClearIndexedAt() *AccountUpdate {
_u.mutation.ClearIndexedAt()
return _u
}
// SetHandle sets the "handle" field.
func (_u *AccountUpdate) SetHandle(v string) *AccountUpdate {
_u.mutation.SetHandle(v)
return _u
}
// SetNillableHandle sets the "handle" field if the given value is not nil.
func (_u *AccountUpdate) SetNillableHandle(v *string) *AccountUpdate {
if v != nil {
_u.SetHandle(*v)
}
return _u
}
// SetName sets the "name" field.
func (_u *AccountUpdate) SetName(v string) *AccountUpdate {
_u.mutation.SetName(v)
return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
func (_u *AccountUpdate) SetNillableName(v *string) *AccountUpdate {
if v != nil {
_u.SetName(*v)
}
return _u
}
// SetBio sets the "bio" field.
func (_u *AccountUpdate) SetBio(v string) *AccountUpdate {
_u.mutation.SetBio(v)
return _u
}
// SetNillableBio sets the "bio" field if the given value is not nil.
func (_u *AccountUpdate) SetNillableBio(v *string) *AccountUpdate {
if v != nil {
_u.SetBio(*v)
}
return _u
}
// ClearBio clears the value of the "bio" field.
func (_u *AccountUpdate) ClearBio() *AccountUpdate {
_u.mutation.ClearBio()
return _u
}
// SetKind sets the "kind" field.
func (_u *AccountUpdate) SetKind(v account.Kind) *AccountUpdate {
_u.mutation.SetKind(v)
return _u
}
// SetNillableKind sets the "kind" field if the given value is not nil.
func (_u *AccountUpdate) SetNillableKind(v *account.Kind) *AccountUpdate {
if v != nil {
_u.SetKind(*v)
}
return _u
}
// SetAdmin sets the "admin" field.
func (_u *AccountUpdate) SetAdmin(v bool) *AccountUpdate {
_u.mutation.SetAdmin(v)
return _u
}
// SetNillableAdmin sets the "admin" field if the given value is not nil.
func (_u *AccountUpdate) SetNillableAdmin(v *bool) *AccountUpdate {
if v != nil {
_u.SetAdmin(*v)
}
return _u
}
// SetLinks sets the "links" field.
func (_u *AccountUpdate) SetLinks(v []schema.ExternalLink) *AccountUpdate {
_u.mutation.SetLinks(v)
return _u
}
// AppendLinks appends value to the "links" field.
func (_u *AccountUpdate) AppendLinks(v []schema.ExternalLink) *AccountUpdate {
_u.mutation.AppendLinks(v)
return _u
}
// ClearLinks clears the value of the "links" field.
func (_u *AccountUpdate) ClearLinks() *AccountUpdate {
_u.mutation.ClearLinks()
return _u
}
// SetMetadata sets the "metadata" field.
func (_u *AccountUpdate) SetMetadata(v map[string]interface{}) *AccountUpdate {
_u.mutation.SetMetadata(v)
return _u
}
// ClearMetadata clears the value of the "metadata" field.
func (_u *AccountUpdate) ClearMetadata() *AccountUpdate {
_u.mutation.ClearMetadata()
return _u
}
// SetInvitedByID sets the "invited_by_id" field.
func (_u *AccountUpdate) SetInvitedByID(v xid.ID) *AccountUpdate {
_u.mutation.SetInvitedByID(v)
return _u
}
// SetNillableInvitedByID sets the "invited_by_id" field if the given value is not nil.
func (_u *AccountUpdate) SetNillableInvitedByID(v *xid.ID) *AccountUpdate {
if v != nil {
_u.SetInvitedByID(*v)
}
return _u
}
// ClearInvitedByID clears the value of the "invited_by_id" field.
func (_u *AccountUpdate) ClearInvitedByID() *AccountUpdate {
_u.mutation.ClearInvitedByID()
return _u
}
// AddSessionIDs adds the "sessions" edge to the Session entity by IDs.
func (_u *AccountUpdate) AddSessionIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddSessionIDs(ids...)
return _u
}
// AddSessions adds the "sessions" edges to the Session entity.
func (_u *AccountUpdate) AddSessions(v ...*Session) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddSessionIDs(ids...)
}
// AddEmailIDs adds the "emails" edge to the Email entity by IDs.
func (_u *AccountUpdate) AddEmailIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddEmailIDs(ids...)
return _u
}
// AddEmails adds the "emails" edges to the Email entity.
func (_u *AccountUpdate) AddEmails(v ...*Email) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddEmailIDs(ids...)
}
// AddNotificationIDs adds the "notifications" edge to the Notification entity by IDs.
func (_u *AccountUpdate) AddNotificationIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddNotificationIDs(ids...)
return _u
}
// AddNotifications adds the "notifications" edges to the Notification entity.
func (_u *AccountUpdate) AddNotifications(v ...*Notification) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddNotificationIDs(ids...)
}
// AddTriggeredNotificationIDs adds the "triggered_notifications" edge to the Notification entity by IDs.
func (_u *AccountUpdate) AddTriggeredNotificationIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddTriggeredNotificationIDs(ids...)
return _u
}
// AddTriggeredNotifications adds the "triggered_notifications" edges to the Notification entity.
func (_u *AccountUpdate) AddTriggeredNotifications(v ...*Notification) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddTriggeredNotificationIDs(ids...)
}
// AddFollowingIDs adds the "following" edge to the AccountFollow entity by IDs.
func (_u *AccountUpdate) AddFollowingIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddFollowingIDs(ids...)
return _u
}
// AddFollowing adds the "following" edges to the AccountFollow entity.
func (_u *AccountUpdate) AddFollowing(v ...*AccountFollow) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddFollowingIDs(ids...)
}
// AddFollowedByIDs adds the "followed_by" edge to the AccountFollow entity by IDs.
func (_u *AccountUpdate) AddFollowedByIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddFollowedByIDs(ids...)
return _u
}
// AddFollowedBy adds the "followed_by" edges to the AccountFollow entity.
func (_u *AccountUpdate) AddFollowedBy(v ...*AccountFollow) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddFollowedByIDs(ids...)
}
// AddInvitationIDs adds the "invitations" edge to the Invitation entity by IDs.
func (_u *AccountUpdate) AddInvitationIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddInvitationIDs(ids...)
return _u
}
// AddInvitations adds the "invitations" edges to the Invitation entity.
func (_u *AccountUpdate) AddInvitations(v ...*Invitation) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddInvitationIDs(ids...)
}
// SetInvitedBy sets the "invited_by" edge to the Invitation entity.
func (_u *AccountUpdate) SetInvitedBy(v *Invitation) *AccountUpdate {
return _u.SetInvitedByID(v.ID)
}
// AddPostIDs adds the "posts" edge to the Post entity by IDs.
func (_u *AccountUpdate) AddPostIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddPostIDs(ids...)
return _u
}
// AddPosts adds the "posts" edges to the Post entity.
func (_u *AccountUpdate) AddPosts(v ...*Post) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddPostIDs(ids...)
}
// AddQuestionIDs adds the "questions" edge to the Question entity by IDs.
func (_u *AccountUpdate) AddQuestionIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddQuestionIDs(ids...)
return _u
}
// AddQuestions adds the "questions" edges to the Question entity.
func (_u *AccountUpdate) AddQuestions(v ...*Question) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddQuestionIDs(ids...)
}
// AddReactIDs adds the "reacts" edge to the React entity by IDs.
func (_u *AccountUpdate) AddReactIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddReactIDs(ids...)
return _u
}
// AddReacts adds the "reacts" edges to the React entity.
func (_u *AccountUpdate) AddReacts(v ...*React) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddReactIDs(ids...)
}
// AddLikeIDs adds the "likes" edge to the LikePost entity by IDs.
func (_u *AccountUpdate) AddLikeIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddLikeIDs(ids...)
return _u
}
// AddLikes adds the "likes" edges to the LikePost entity.
func (_u *AccountUpdate) AddLikes(v ...*LikePost) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddLikeIDs(ids...)
}
// AddMentionIDs adds the "mentions" edge to the MentionProfile entity by IDs.
func (_u *AccountUpdate) AddMentionIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddMentionIDs(ids...)
return _u
}
// AddMentions adds the "mentions" edges to the MentionProfile entity.
func (_u *AccountUpdate) AddMentions(v ...*MentionProfile) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddMentionIDs(ids...)
}
// AddRoleIDs adds the "roles" edge to the Role entity by IDs.
func (_u *AccountUpdate) AddRoleIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddRoleIDs(ids...)
return _u
}
// AddRoles adds the "roles" edges to the Role entity.
func (_u *AccountUpdate) AddRoles(v ...*Role) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddRoleIDs(ids...)
}
// AddAuthenticationIDs adds the "authentication" edge to the Authentication entity by IDs.
func (_u *AccountUpdate) AddAuthenticationIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddAuthenticationIDs(ids...)
return _u
}
// AddAuthentication adds the "authentication" edges to the Authentication entity.
func (_u *AccountUpdate) AddAuthentication(v ...*Authentication) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddAuthenticationIDs(ids...)
}
// AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (_u *AccountUpdate) AddTagIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddTagIDs(ids...)
return _u
}
// AddTags adds the "tags" edges to the Tag entity.
func (_u *AccountUpdate) AddTags(v ...*Tag) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddTagIDs(ids...)
}
// AddCollectionIDs adds the "collections" edge to the Collection entity by IDs.
func (_u *AccountUpdate) AddCollectionIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddCollectionIDs(ids...)
return _u
}
// AddCollections adds the "collections" edges to the Collection entity.
func (_u *AccountUpdate) AddCollections(v ...*Collection) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddCollectionIDs(ids...)
}
// AddNodeIDs adds the "nodes" edge to the Node entity by IDs.
func (_u *AccountUpdate) AddNodeIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddNodeIDs(ids...)
return _u
}
// AddNodes adds the "nodes" edges to the Node entity.
func (_u *AccountUpdate) AddNodes(v ...*Node) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddNodeIDs(ids...)
}
// AddAssetIDs adds the "assets" edge to the Asset entity by IDs.
func (_u *AccountUpdate) AddAssetIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddAssetIDs(ids...)
return _u
}
// AddAssets adds the "assets" edges to the Asset entity.
func (_u *AccountUpdate) AddAssets(v ...*Asset) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddAssetIDs(ids...)
}
// AddEventIDs adds the "events" edge to the EventParticipant entity by IDs.
func (_u *AccountUpdate) AddEventIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddEventIDs(ids...)
return _u
}
// AddEvents adds the "events" edges to the EventParticipant entity.
func (_u *AccountUpdate) AddEvents(v ...*EventParticipant) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddEventIDs(ids...)
}
// AddPostReadIDs adds the "post_reads" edge to the PostRead entity by IDs.
func (_u *AccountUpdate) AddPostReadIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddPostReadIDs(ids...)
return _u
}
// AddPostReads adds the "post_reads" edges to the PostRead entity.
func (_u *AccountUpdate) AddPostReads(v ...*PostRead) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddPostReadIDs(ids...)
}
// AddReportIDs adds the "reports" edge to the Report entity by IDs.
func (_u *AccountUpdate) AddReportIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddReportIDs(ids...)
return _u
}
// AddReports adds the "reports" edges to the Report entity.
func (_u *AccountUpdate) AddReports(v ...*Report) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddReportIDs(ids...)
}
// AddHandledReportIDs adds the "handled_reports" edge to the Report entity by IDs.
func (_u *AccountUpdate) AddHandledReportIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddHandledReportIDs(ids...)
return _u
}
// AddHandledReports adds the "handled_reports" edges to the Report entity.
func (_u *AccountUpdate) AddHandledReports(v ...*Report) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddHandledReportIDs(ids...)
}
// AddAccountRoleIDs adds the "account_roles" edge to the AccountRoles entity by IDs.
func (_u *AccountUpdate) AddAccountRoleIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.AddAccountRoleIDs(ids...)
return _u
}
// AddAccountRoles adds the "account_roles" edges to the AccountRoles entity.
func (_u *AccountUpdate) AddAccountRoles(v ...*AccountRoles) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddAccountRoleIDs(ids...)
}
// Mutation returns the AccountMutation object of the builder.
func (_u *AccountUpdate) Mutation() *AccountMutation {
return _u.mutation
}
// ClearSessions clears all "sessions" edges to the Session entity.
func (_u *AccountUpdate) ClearSessions() *AccountUpdate {
_u.mutation.ClearSessions()
return _u
}
// RemoveSessionIDs removes the "sessions" edge to Session entities by IDs.
func (_u *AccountUpdate) RemoveSessionIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveSessionIDs(ids...)
return _u
}
// RemoveSessions removes "sessions" edges to Session entities.
func (_u *AccountUpdate) RemoveSessions(v ...*Session) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveSessionIDs(ids...)
}
// ClearEmails clears all "emails" edges to the Email entity.
func (_u *AccountUpdate) ClearEmails() *AccountUpdate {
_u.mutation.ClearEmails()
return _u
}
// RemoveEmailIDs removes the "emails" edge to Email entities by IDs.
func (_u *AccountUpdate) RemoveEmailIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveEmailIDs(ids...)
return _u
}
// RemoveEmails removes "emails" edges to Email entities.
func (_u *AccountUpdate) RemoveEmails(v ...*Email) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveEmailIDs(ids...)
}
// ClearNotifications clears all "notifications" edges to the Notification entity.
func (_u *AccountUpdate) ClearNotifications() *AccountUpdate {
_u.mutation.ClearNotifications()
return _u
}
// RemoveNotificationIDs removes the "notifications" edge to Notification entities by IDs.
func (_u *AccountUpdate) RemoveNotificationIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveNotificationIDs(ids...)
return _u
}
// RemoveNotifications removes "notifications" edges to Notification entities.
func (_u *AccountUpdate) RemoveNotifications(v ...*Notification) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveNotificationIDs(ids...)
}
// ClearTriggeredNotifications clears all "triggered_notifications" edges to the Notification entity.
func (_u *AccountUpdate) ClearTriggeredNotifications() *AccountUpdate {
_u.mutation.ClearTriggeredNotifications()
return _u
}
// RemoveTriggeredNotificationIDs removes the "triggered_notifications" edge to Notification entities by IDs.
func (_u *AccountUpdate) RemoveTriggeredNotificationIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveTriggeredNotificationIDs(ids...)
return _u
}
// RemoveTriggeredNotifications removes "triggered_notifications" edges to Notification entities.
func (_u *AccountUpdate) RemoveTriggeredNotifications(v ...*Notification) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveTriggeredNotificationIDs(ids...)
}
// ClearFollowing clears all "following" edges to the AccountFollow entity.
func (_u *AccountUpdate) ClearFollowing() *AccountUpdate {
_u.mutation.ClearFollowing()
return _u
}
// RemoveFollowingIDs removes the "following" edge to AccountFollow entities by IDs.
func (_u *AccountUpdate) RemoveFollowingIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveFollowingIDs(ids...)
return _u
}
// RemoveFollowing removes "following" edges to AccountFollow entities.
func (_u *AccountUpdate) RemoveFollowing(v ...*AccountFollow) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveFollowingIDs(ids...)
}
// ClearFollowedBy clears all "followed_by" edges to the AccountFollow entity.
func (_u *AccountUpdate) ClearFollowedBy() *AccountUpdate {
_u.mutation.ClearFollowedBy()
return _u
}
// RemoveFollowedByIDs removes the "followed_by" edge to AccountFollow entities by IDs.
func (_u *AccountUpdate) RemoveFollowedByIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveFollowedByIDs(ids...)
return _u
}
// RemoveFollowedBy removes "followed_by" edges to AccountFollow entities.
func (_u *AccountUpdate) RemoveFollowedBy(v ...*AccountFollow) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveFollowedByIDs(ids...)
}
// ClearInvitations clears all "invitations" edges to the Invitation entity.
func (_u *AccountUpdate) ClearInvitations() *AccountUpdate {
_u.mutation.ClearInvitations()
return _u
}
// RemoveInvitationIDs removes the "invitations" edge to Invitation entities by IDs.
func (_u *AccountUpdate) RemoveInvitationIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveInvitationIDs(ids...)
return _u
}
// RemoveInvitations removes "invitations" edges to Invitation entities.
func (_u *AccountUpdate) RemoveInvitations(v ...*Invitation) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveInvitationIDs(ids...)
}
// ClearInvitedBy clears the "invited_by" edge to the Invitation entity.
func (_u *AccountUpdate) ClearInvitedBy() *AccountUpdate {
_u.mutation.ClearInvitedBy()
return _u
}
// ClearPosts clears all "posts" edges to the Post entity.
func (_u *AccountUpdate) ClearPosts() *AccountUpdate {
_u.mutation.ClearPosts()
return _u
}
// RemovePostIDs removes the "posts" edge to Post entities by IDs.
func (_u *AccountUpdate) RemovePostIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemovePostIDs(ids...)
return _u
}
// RemovePosts removes "posts" edges to Post entities.
func (_u *AccountUpdate) RemovePosts(v ...*Post) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemovePostIDs(ids...)
}
// ClearQuestions clears all "questions" edges to the Question entity.
func (_u *AccountUpdate) ClearQuestions() *AccountUpdate {
_u.mutation.ClearQuestions()
return _u
}
// RemoveQuestionIDs removes the "questions" edge to Question entities by IDs.
func (_u *AccountUpdate) RemoveQuestionIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveQuestionIDs(ids...)
return _u
}
// RemoveQuestions removes "questions" edges to Question entities.
func (_u *AccountUpdate) RemoveQuestions(v ...*Question) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveQuestionIDs(ids...)
}
// ClearReacts clears all "reacts" edges to the React entity.
func (_u *AccountUpdate) ClearReacts() *AccountUpdate {
_u.mutation.ClearReacts()
return _u
}
// RemoveReactIDs removes the "reacts" edge to React entities by IDs.
func (_u *AccountUpdate) RemoveReactIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveReactIDs(ids...)
return _u
}
// RemoveReacts removes "reacts" edges to React entities.
func (_u *AccountUpdate) RemoveReacts(v ...*React) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveReactIDs(ids...)
}
// ClearLikes clears all "likes" edges to the LikePost entity.
func (_u *AccountUpdate) ClearLikes() *AccountUpdate {
_u.mutation.ClearLikes()
return _u
}
// RemoveLikeIDs removes the "likes" edge to LikePost entities by IDs.
func (_u *AccountUpdate) RemoveLikeIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveLikeIDs(ids...)
return _u
}
// RemoveLikes removes "likes" edges to LikePost entities.
func (_u *AccountUpdate) RemoveLikes(v ...*LikePost) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveLikeIDs(ids...)
}
// ClearMentions clears all "mentions" edges to the MentionProfile entity.
func (_u *AccountUpdate) ClearMentions() *AccountUpdate {
_u.mutation.ClearMentions()
return _u
}
// RemoveMentionIDs removes the "mentions" edge to MentionProfile entities by IDs.
func (_u *AccountUpdate) RemoveMentionIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveMentionIDs(ids...)
return _u
}
// RemoveMentions removes "mentions" edges to MentionProfile entities.
func (_u *AccountUpdate) RemoveMentions(v ...*MentionProfile) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveMentionIDs(ids...)
}
// ClearRoles clears all "roles" edges to the Role entity.
func (_u *AccountUpdate) ClearRoles() *AccountUpdate {
_u.mutation.ClearRoles()
return _u
}
// RemoveRoleIDs removes the "roles" edge to Role entities by IDs.
func (_u *AccountUpdate) RemoveRoleIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveRoleIDs(ids...)
return _u
}
// RemoveRoles removes "roles" edges to Role entities.
func (_u *AccountUpdate) RemoveRoles(v ...*Role) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveRoleIDs(ids...)
}
// ClearAuthentication clears all "authentication" edges to the Authentication entity.
func (_u *AccountUpdate) ClearAuthentication() *AccountUpdate {
_u.mutation.ClearAuthentication()
return _u
}
// RemoveAuthenticationIDs removes the "authentication" edge to Authentication entities by IDs.
func (_u *AccountUpdate) RemoveAuthenticationIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveAuthenticationIDs(ids...)
return _u
}
// RemoveAuthentication removes "authentication" edges to Authentication entities.
func (_u *AccountUpdate) RemoveAuthentication(v ...*Authentication) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveAuthenticationIDs(ids...)
}
// ClearTags clears all "tags" edges to the Tag entity.
func (_u *AccountUpdate) ClearTags() *AccountUpdate {
_u.mutation.ClearTags()
return _u
}
// RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (_u *AccountUpdate) RemoveTagIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveTagIDs(ids...)
return _u
}
// RemoveTags removes "tags" edges to Tag entities.
func (_u *AccountUpdate) RemoveTags(v ...*Tag) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveTagIDs(ids...)
}
// ClearCollections clears all "collections" edges to the Collection entity.
func (_u *AccountUpdate) ClearCollections() *AccountUpdate {
_u.mutation.ClearCollections()
return _u
}
// RemoveCollectionIDs removes the "collections" edge to Collection entities by IDs.
func (_u *AccountUpdate) RemoveCollectionIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveCollectionIDs(ids...)
return _u
}
// RemoveCollections removes "collections" edges to Collection entities.
func (_u *AccountUpdate) RemoveCollections(v ...*Collection) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveCollectionIDs(ids...)
}
// ClearNodes clears all "nodes" edges to the Node entity.
func (_u *AccountUpdate) ClearNodes() *AccountUpdate {
_u.mutation.ClearNodes()
return _u
}
// RemoveNodeIDs removes the "nodes" edge to Node entities by IDs.
func (_u *AccountUpdate) RemoveNodeIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveNodeIDs(ids...)
return _u
}
// RemoveNodes removes "nodes" edges to Node entities.
func (_u *AccountUpdate) RemoveNodes(v ...*Node) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveNodeIDs(ids...)
}
// ClearAssets clears all "assets" edges to the Asset entity.
func (_u *AccountUpdate) ClearAssets() *AccountUpdate {
_u.mutation.ClearAssets()
return _u
}
// RemoveAssetIDs removes the "assets" edge to Asset entities by IDs.
func (_u *AccountUpdate) RemoveAssetIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveAssetIDs(ids...)
return _u
}
// RemoveAssets removes "assets" edges to Asset entities.
func (_u *AccountUpdate) RemoveAssets(v ...*Asset) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveAssetIDs(ids...)
}
// ClearEvents clears all "events" edges to the EventParticipant entity.
func (_u *AccountUpdate) ClearEvents() *AccountUpdate {
_u.mutation.ClearEvents()
return _u
}
// RemoveEventIDs removes the "events" edge to EventParticipant entities by IDs.
func (_u *AccountUpdate) RemoveEventIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveEventIDs(ids...)
return _u
}
// RemoveEvents removes "events" edges to EventParticipant entities.
func (_u *AccountUpdate) RemoveEvents(v ...*EventParticipant) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveEventIDs(ids...)
}
// ClearPostReads clears all "post_reads" edges to the PostRead entity.
func (_u *AccountUpdate) ClearPostReads() *AccountUpdate {
_u.mutation.ClearPostReads()
return _u
}
// RemovePostReadIDs removes the "post_reads" edge to PostRead entities by IDs.
func (_u *AccountUpdate) RemovePostReadIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemovePostReadIDs(ids...)
return _u
}
// RemovePostReads removes "post_reads" edges to PostRead entities.
func (_u *AccountUpdate) RemovePostReads(v ...*PostRead) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemovePostReadIDs(ids...)
}
// ClearReports clears all "reports" edges to the Report entity.
func (_u *AccountUpdate) ClearReports() *AccountUpdate {
_u.mutation.ClearReports()
return _u
}
// RemoveReportIDs removes the "reports" edge to Report entities by IDs.
func (_u *AccountUpdate) RemoveReportIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveReportIDs(ids...)
return _u
}
// RemoveReports removes "reports" edges to Report entities.
func (_u *AccountUpdate) RemoveReports(v ...*Report) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveReportIDs(ids...)
}
// ClearHandledReports clears all "handled_reports" edges to the Report entity.
func (_u *AccountUpdate) ClearHandledReports() *AccountUpdate {
_u.mutation.ClearHandledReports()
return _u
}
// RemoveHandledReportIDs removes the "handled_reports" edge to Report entities by IDs.
func (_u *AccountUpdate) RemoveHandledReportIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveHandledReportIDs(ids...)
return _u
}
// RemoveHandledReports removes "handled_reports" edges to Report entities.
func (_u *AccountUpdate) RemoveHandledReports(v ...*Report) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveHandledReportIDs(ids...)
}
// ClearAccountRoles clears all "account_roles" edges to the AccountRoles entity.
func (_u *AccountUpdate) ClearAccountRoles() *AccountUpdate {
_u.mutation.ClearAccountRoles()
return _u
}
// RemoveAccountRoleIDs removes the "account_roles" edge to AccountRoles entities by IDs.
func (_u *AccountUpdate) RemoveAccountRoleIDs(ids ...xid.ID) *AccountUpdate {
_u.mutation.RemoveAccountRoleIDs(ids...)
return _u
}
// RemoveAccountRoles removes "account_roles" edges to AccountRoles entities.
func (_u *AccountUpdate) RemoveAccountRoles(v ...*AccountRoles) *AccountUpdate {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveAccountRoleIDs(ids...)
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (_u *AccountUpdate) Save(ctx context.Context) (int, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *AccountUpdate) SaveX(ctx context.Context) int {
affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (_u *AccountUpdate) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *AccountUpdate) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *AccountUpdate) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := account.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *AccountUpdate) check() error {
if v, ok := _u.mutation.Handle(); ok {
if err := account.HandleValidator(v); err != nil {
return &ValidationError{Name: "handle", err: fmt.Errorf(`ent: validator failed for field "Account.handle": %w`, err)}
}
}
if v, ok := _u.mutation.Name(); ok {
if err := account.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Account.name": %w`, err)}
}
}
if v, ok := _u.mutation.Kind(); ok {
if err := account.KindValidator(v); err != nil {
return &ValidationError{Name: "kind", err: fmt.Errorf(`ent: validator failed for field "Account.kind": %w`, err)}
}
}
return nil
}
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (_u *AccountUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *AccountUpdate {
_u.modifiers = append(_u.modifiers, modifiers...)
return _u
}
func (_u *AccountUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(account.Table, account.Columns, sqlgraph.NewFieldSpec(account.FieldID, field.TypeString))
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(account.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := _u.mutation.DeletedAt(); ok {
_spec.SetField(account.FieldDeletedAt, field.TypeTime, value)
}
if _u.mutation.DeletedAtCleared() {
_spec.ClearField(account.FieldDeletedAt, field.TypeTime)
}
if value, ok := _u.mutation.IndexedAt(); ok {
_spec.SetField(account.FieldIndexedAt, field.TypeTime, value)
}
if _u.mutation.IndexedAtCleared() {
_spec.ClearField(account.FieldIndexedAt, field.TypeTime)
}
if value, ok := _u.mutation.Handle(); ok {
_spec.SetField(account.FieldHandle, field.TypeString, value)
}
if value, ok := _u.mutation.Name(); ok {
_spec.SetField(account.FieldName, field.TypeString, value)
}
if value, ok := _u.mutation.Bio(); ok {
_spec.SetField(account.FieldBio, field.TypeString, value)
}
if _u.mutation.BioCleared() {
_spec.ClearField(account.FieldBio, field.TypeString)
}
if value, ok := _u.mutation.Kind(); ok {
_spec.SetField(account.FieldKind, field.TypeEnum, value)
}
if value, ok := _u.mutation.Admin(); ok {
_spec.SetField(account.FieldAdmin, field.TypeBool, value)
}
if value, ok := _u.mutation.Links(); ok {
_spec.SetField(account.FieldLinks, field.TypeJSON, value)
}
if value, ok := _u.mutation.AppendedLinks(); ok {
_spec.AddModifier(func(u *sql.UpdateBuilder) {
sqljson.Append(u, account.FieldLinks, value)
})
}
if _u.mutation.LinksCleared() {
_spec.ClearField(account.FieldLinks, field.TypeJSON)
}
if value, ok := _u.mutation.Metadata(); ok {
_spec.SetField(account.FieldMetadata, field.TypeJSON, value)
}
if _u.mutation.MetadataCleared() {
_spec.ClearField(account.FieldMetadata, field.TypeJSON)
}
if _u.mutation.SessionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.SessionsTable,
Columns: []string{account.SessionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(session.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedSessionsIDs(); len(nodes) > 0 && !_u.mutation.SessionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.SessionsTable,
Columns: []string{account.SessionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(session.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.SessionsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.SessionsTable,
Columns: []string{account.SessionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(session.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.EmailsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EmailsTable,
Columns: []string{account.EmailsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(email.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedEmailsIDs(); len(nodes) > 0 && !_u.mutation.EmailsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EmailsTable,
Columns: []string{account.EmailsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(email.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.EmailsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EmailsTable,
Columns: []string{account.EmailsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(email.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.NotificationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NotificationsTable,
Columns: []string{account.NotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedNotificationsIDs(); len(nodes) > 0 && !_u.mutation.NotificationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NotificationsTable,
Columns: []string{account.NotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.NotificationsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NotificationsTable,
Columns: []string{account.NotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.TriggeredNotificationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.TriggeredNotificationsTable,
Columns: []string{account.TriggeredNotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedTriggeredNotificationsIDs(); len(nodes) > 0 && !_u.mutation.TriggeredNotificationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.TriggeredNotificationsTable,
Columns: []string{account.TriggeredNotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.TriggeredNotificationsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.TriggeredNotificationsTable,
Columns: []string{account.TriggeredNotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.FollowingCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowingTable,
Columns: []string{account.FollowingColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedFollowingIDs(); len(nodes) > 0 && !_u.mutation.FollowingCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowingTable,
Columns: []string{account.FollowingColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.FollowingIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowingTable,
Columns: []string{account.FollowingColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.FollowedByCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowedByTable,
Columns: []string{account.FollowedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedFollowedByIDs(); len(nodes) > 0 && !_u.mutation.FollowedByCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowedByTable,
Columns: []string{account.FollowedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.FollowedByIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowedByTable,
Columns: []string{account.FollowedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.InvitationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.InvitationsTable,
Columns: []string{account.InvitationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedInvitationsIDs(); len(nodes) > 0 && !_u.mutation.InvitationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.InvitationsTable,
Columns: []string{account.InvitationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.InvitationsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.InvitationsTable,
Columns: []string{account.InvitationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.InvitedByCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: account.InvitedByTable,
Columns: []string{account.InvitedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.InvitedByIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: account.InvitedByTable,
Columns: []string{account.InvitedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.PostsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostsTable,
Columns: []string{account.PostsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(post.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedPostsIDs(); len(nodes) > 0 && !_u.mutation.PostsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostsTable,
Columns: []string{account.PostsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(post.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.PostsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostsTable,
Columns: []string{account.PostsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(post.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.QuestionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.QuestionsTable,
Columns: []string{account.QuestionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedQuestionsIDs(); len(nodes) > 0 && !_u.mutation.QuestionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.QuestionsTable,
Columns: []string{account.QuestionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.QuestionsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.QuestionsTable,
Columns: []string{account.QuestionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.ReactsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReactsTable,
Columns: []string{account.ReactsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(react.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedReactsIDs(); len(nodes) > 0 && !_u.mutation.ReactsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReactsTable,
Columns: []string{account.ReactsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(react.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.ReactsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReactsTable,
Columns: []string{account.ReactsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(react.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.LikesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.LikesTable,
Columns: []string{account.LikesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(likepost.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedLikesIDs(); len(nodes) > 0 && !_u.mutation.LikesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.LikesTable,
Columns: []string{account.LikesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(likepost.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.LikesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.LikesTable,
Columns: []string{account.LikesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(likepost.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.MentionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.MentionsTable,
Columns: []string{account.MentionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(mentionprofile.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedMentionsIDs(); len(nodes) > 0 && !_u.mutation.MentionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.MentionsTable,
Columns: []string{account.MentionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(mentionprofile.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.MentionsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.MentionsTable,
Columns: []string{account.MentionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(mentionprofile.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.RolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: account.RolesTable,
Columns: account.RolesPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(role.FieldID, field.TypeString),
},
}
createE := &AccountRolesCreate{config: _u.config, mutation: newAccountRolesMutation(_u.config, OpCreate)}
createE.defaults()
_, specE := createE.createSpec()
edge.Target.Fields = specE.Fields
if specE.ID.Value != nil {
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedRolesIDs(); len(nodes) > 0 && !_u.mutation.RolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: account.RolesTable,
Columns: account.RolesPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(role.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
createE := &AccountRolesCreate{config: _u.config, mutation: newAccountRolesMutation(_u.config, OpCreate)}
createE.defaults()
_, specE := createE.createSpec()
edge.Target.Fields = specE.Fields
if specE.ID.Value != nil {
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RolesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: account.RolesTable,
Columns: account.RolesPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(role.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
createE := &AccountRolesCreate{config: _u.config, mutation: newAccountRolesMutation(_u.config, OpCreate)}
createE.defaults()
_, specE := createE.createSpec()
edge.Target.Fields = specE.Fields
if specE.ID.Value != nil {
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.AuthenticationCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AuthenticationTable,
Columns: []string{account.AuthenticationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(authentication.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedAuthenticationIDs(); len(nodes) > 0 && !_u.mutation.AuthenticationCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AuthenticationTable,
Columns: []string{account.AuthenticationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(authentication.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.AuthenticationIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AuthenticationTable,
Columns: []string{account.AuthenticationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(authentication.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.TagsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
Table: account.TagsTable,
Columns: account.TagsPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(tag.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedTagsIDs(); len(nodes) > 0 && !_u.mutation.TagsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
Table: account.TagsTable,
Columns: account.TagsPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(tag.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.TagsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
Table: account.TagsTable,
Columns: account.TagsPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(tag.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.CollectionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.CollectionsTable,
Columns: []string{account.CollectionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(collection.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedCollectionsIDs(); len(nodes) > 0 && !_u.mutation.CollectionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.CollectionsTable,
Columns: []string{account.CollectionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(collection.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.CollectionsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.CollectionsTable,
Columns: []string{account.CollectionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(collection.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.NodesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NodesTable,
Columns: []string{account.NodesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(node.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedNodesIDs(); len(nodes) > 0 && !_u.mutation.NodesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NodesTable,
Columns: []string{account.NodesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(node.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.NodesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NodesTable,
Columns: []string{account.NodesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(node.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.AssetsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AssetsTable,
Columns: []string{account.AssetsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedAssetsIDs(); len(nodes) > 0 && !_u.mutation.AssetsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AssetsTable,
Columns: []string{account.AssetsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.AssetsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AssetsTable,
Columns: []string{account.AssetsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.EventsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EventsTable,
Columns: []string{account.EventsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(eventparticipant.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedEventsIDs(); len(nodes) > 0 && !_u.mutation.EventsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EventsTable,
Columns: []string{account.EventsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(eventparticipant.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.EventsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EventsTable,
Columns: []string{account.EventsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(eventparticipant.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.PostReadsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostReadsTable,
Columns: []string{account.PostReadsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(postread.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedPostReadsIDs(); len(nodes) > 0 && !_u.mutation.PostReadsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostReadsTable,
Columns: []string{account.PostReadsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(postread.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.PostReadsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostReadsTable,
Columns: []string{account.PostReadsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(postread.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.ReportsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReportsTable,
Columns: []string{account.ReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedReportsIDs(); len(nodes) > 0 && !_u.mutation.ReportsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReportsTable,
Columns: []string{account.ReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.ReportsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReportsTable,
Columns: []string{account.ReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.HandledReportsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.HandledReportsTable,
Columns: []string{account.HandledReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedHandledReportsIDs(); len(nodes) > 0 && !_u.mutation.HandledReportsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.HandledReportsTable,
Columns: []string{account.HandledReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.HandledReportsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.HandledReportsTable,
Columns: []string{account.HandledReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.AccountRolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: account.AccountRolesTable,
Columns: []string{account.AccountRolesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountroles.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedAccountRolesIDs(); len(nodes) > 0 && !_u.mutation.AccountRolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: account.AccountRolesTable,
Columns: []string{account.AccountRolesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountroles.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.AccountRolesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: account.AccountRolesTable,
Columns: []string{account.AccountRolesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountroles.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
_spec.AddModifiers(_u.modifiers...)
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{account.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
_u.mutation.done = true
return _node, nil
}
// AccountUpdateOne is the builder for updating a single Account entity.
type AccountUpdateOne struct {
config
fields []string
hooks []Hook
mutation *AccountMutation
modifiers []func(*sql.UpdateBuilder)
}
// SetUpdatedAt sets the "updated_at" field.
func (_u *AccountUpdateOne) SetUpdatedAt(v time.Time) *AccountUpdateOne {
_u.mutation.SetUpdatedAt(v)
return _u
}
// SetDeletedAt sets the "deleted_at" field.
func (_u *AccountUpdateOne) SetDeletedAt(v time.Time) *AccountUpdateOne {
_u.mutation.SetDeletedAt(v)
return _u
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_u *AccountUpdateOne) SetNillableDeletedAt(v *time.Time) *AccountUpdateOne {
if v != nil {
_u.SetDeletedAt(*v)
}
return _u
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (_u *AccountUpdateOne) ClearDeletedAt() *AccountUpdateOne {
_u.mutation.ClearDeletedAt()
return _u
}
// SetIndexedAt sets the "indexed_at" field.
func (_u *AccountUpdateOne) SetIndexedAt(v time.Time) *AccountUpdateOne {
_u.mutation.SetIndexedAt(v)
return _u
}
// SetNillableIndexedAt sets the "indexed_at" field if the given value is not nil.
func (_u *AccountUpdateOne) SetNillableIndexedAt(v *time.Time) *AccountUpdateOne {
if v != nil {
_u.SetIndexedAt(*v)
}
return _u
}
// ClearIndexedAt clears the value of the "indexed_at" field.
func (_u *AccountUpdateOne) ClearIndexedAt() *AccountUpdateOne {
_u.mutation.ClearIndexedAt()
return _u
}
// SetHandle sets the "handle" field.
func (_u *AccountUpdateOne) SetHandle(v string) *AccountUpdateOne {
_u.mutation.SetHandle(v)
return _u
}
// SetNillableHandle sets the "handle" field if the given value is not nil.
func (_u *AccountUpdateOne) SetNillableHandle(v *string) *AccountUpdateOne {
if v != nil {
_u.SetHandle(*v)
}
return _u
}
// SetName sets the "name" field.
func (_u *AccountUpdateOne) SetName(v string) *AccountUpdateOne {
_u.mutation.SetName(v)
return _u
}
// SetNillableName sets the "name" field if the given value is not nil.
func (_u *AccountUpdateOne) SetNillableName(v *string) *AccountUpdateOne {
if v != nil {
_u.SetName(*v)
}
return _u
}
// SetBio sets the "bio" field.
func (_u *AccountUpdateOne) SetBio(v string) *AccountUpdateOne {
_u.mutation.SetBio(v)
return _u
}
// SetNillableBio sets the "bio" field if the given value is not nil.
func (_u *AccountUpdateOne) SetNillableBio(v *string) *AccountUpdateOne {
if v != nil {
_u.SetBio(*v)
}
return _u
}
// ClearBio clears the value of the "bio" field.
func (_u *AccountUpdateOne) ClearBio() *AccountUpdateOne {
_u.mutation.ClearBio()
return _u
}
// SetKind sets the "kind" field.
func (_u *AccountUpdateOne) SetKind(v account.Kind) *AccountUpdateOne {
_u.mutation.SetKind(v)
return _u
}
// SetNillableKind sets the "kind" field if the given value is not nil.
func (_u *AccountUpdateOne) SetNillableKind(v *account.Kind) *AccountUpdateOne {
if v != nil {
_u.SetKind(*v)
}
return _u
}
// SetAdmin sets the "admin" field.
func (_u *AccountUpdateOne) SetAdmin(v bool) *AccountUpdateOne {
_u.mutation.SetAdmin(v)
return _u
}
// SetNillableAdmin sets the "admin" field if the given value is not nil.
func (_u *AccountUpdateOne) SetNillableAdmin(v *bool) *AccountUpdateOne {
if v != nil {
_u.SetAdmin(*v)
}
return _u
}
// SetLinks sets the "links" field.
func (_u *AccountUpdateOne) SetLinks(v []schema.ExternalLink) *AccountUpdateOne {
_u.mutation.SetLinks(v)
return _u
}
// AppendLinks appends value to the "links" field.
func (_u *AccountUpdateOne) AppendLinks(v []schema.ExternalLink) *AccountUpdateOne {
_u.mutation.AppendLinks(v)
return _u
}
// ClearLinks clears the value of the "links" field.
func (_u *AccountUpdateOne) ClearLinks() *AccountUpdateOne {
_u.mutation.ClearLinks()
return _u
}
// SetMetadata sets the "metadata" field.
func (_u *AccountUpdateOne) SetMetadata(v map[string]interface{}) *AccountUpdateOne {
_u.mutation.SetMetadata(v)
return _u
}
// ClearMetadata clears the value of the "metadata" field.
func (_u *AccountUpdateOne) ClearMetadata() *AccountUpdateOne {
_u.mutation.ClearMetadata()
return _u
}
// SetInvitedByID sets the "invited_by_id" field.
func (_u *AccountUpdateOne) SetInvitedByID(v xid.ID) *AccountUpdateOne {
_u.mutation.SetInvitedByID(v)
return _u
}
// SetNillableInvitedByID sets the "invited_by_id" field if the given value is not nil.
func (_u *AccountUpdateOne) SetNillableInvitedByID(v *xid.ID) *AccountUpdateOne {
if v != nil {
_u.SetInvitedByID(*v)
}
return _u
}
// ClearInvitedByID clears the value of the "invited_by_id" field.
func (_u *AccountUpdateOne) ClearInvitedByID() *AccountUpdateOne {
_u.mutation.ClearInvitedByID()
return _u
}
// AddSessionIDs adds the "sessions" edge to the Session entity by IDs.
func (_u *AccountUpdateOne) AddSessionIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddSessionIDs(ids...)
return _u
}
// AddSessions adds the "sessions" edges to the Session entity.
func (_u *AccountUpdateOne) AddSessions(v ...*Session) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddSessionIDs(ids...)
}
// AddEmailIDs adds the "emails" edge to the Email entity by IDs.
func (_u *AccountUpdateOne) AddEmailIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddEmailIDs(ids...)
return _u
}
// AddEmails adds the "emails" edges to the Email entity.
func (_u *AccountUpdateOne) AddEmails(v ...*Email) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddEmailIDs(ids...)
}
// AddNotificationIDs adds the "notifications" edge to the Notification entity by IDs.
func (_u *AccountUpdateOne) AddNotificationIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddNotificationIDs(ids...)
return _u
}
// AddNotifications adds the "notifications" edges to the Notification entity.
func (_u *AccountUpdateOne) AddNotifications(v ...*Notification) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddNotificationIDs(ids...)
}
// AddTriggeredNotificationIDs adds the "triggered_notifications" edge to the Notification entity by IDs.
func (_u *AccountUpdateOne) AddTriggeredNotificationIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddTriggeredNotificationIDs(ids...)
return _u
}
// AddTriggeredNotifications adds the "triggered_notifications" edges to the Notification entity.
func (_u *AccountUpdateOne) AddTriggeredNotifications(v ...*Notification) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddTriggeredNotificationIDs(ids...)
}
// AddFollowingIDs adds the "following" edge to the AccountFollow entity by IDs.
func (_u *AccountUpdateOne) AddFollowingIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddFollowingIDs(ids...)
return _u
}
// AddFollowing adds the "following" edges to the AccountFollow entity.
func (_u *AccountUpdateOne) AddFollowing(v ...*AccountFollow) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddFollowingIDs(ids...)
}
// AddFollowedByIDs adds the "followed_by" edge to the AccountFollow entity by IDs.
func (_u *AccountUpdateOne) AddFollowedByIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddFollowedByIDs(ids...)
return _u
}
// AddFollowedBy adds the "followed_by" edges to the AccountFollow entity.
func (_u *AccountUpdateOne) AddFollowedBy(v ...*AccountFollow) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddFollowedByIDs(ids...)
}
// AddInvitationIDs adds the "invitations" edge to the Invitation entity by IDs.
func (_u *AccountUpdateOne) AddInvitationIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddInvitationIDs(ids...)
return _u
}
// AddInvitations adds the "invitations" edges to the Invitation entity.
func (_u *AccountUpdateOne) AddInvitations(v ...*Invitation) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddInvitationIDs(ids...)
}
// SetInvitedBy sets the "invited_by" edge to the Invitation entity.
func (_u *AccountUpdateOne) SetInvitedBy(v *Invitation) *AccountUpdateOne {
return _u.SetInvitedByID(v.ID)
}
// AddPostIDs adds the "posts" edge to the Post entity by IDs.
func (_u *AccountUpdateOne) AddPostIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddPostIDs(ids...)
return _u
}
// AddPosts adds the "posts" edges to the Post entity.
func (_u *AccountUpdateOne) AddPosts(v ...*Post) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddPostIDs(ids...)
}
// AddQuestionIDs adds the "questions" edge to the Question entity by IDs.
func (_u *AccountUpdateOne) AddQuestionIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddQuestionIDs(ids...)
return _u
}
// AddQuestions adds the "questions" edges to the Question entity.
func (_u *AccountUpdateOne) AddQuestions(v ...*Question) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddQuestionIDs(ids...)
}
// AddReactIDs adds the "reacts" edge to the React entity by IDs.
func (_u *AccountUpdateOne) AddReactIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddReactIDs(ids...)
return _u
}
// AddReacts adds the "reacts" edges to the React entity.
func (_u *AccountUpdateOne) AddReacts(v ...*React) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddReactIDs(ids...)
}
// AddLikeIDs adds the "likes" edge to the LikePost entity by IDs.
func (_u *AccountUpdateOne) AddLikeIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddLikeIDs(ids...)
return _u
}
// AddLikes adds the "likes" edges to the LikePost entity.
func (_u *AccountUpdateOne) AddLikes(v ...*LikePost) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddLikeIDs(ids...)
}
// AddMentionIDs adds the "mentions" edge to the MentionProfile entity by IDs.
func (_u *AccountUpdateOne) AddMentionIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddMentionIDs(ids...)
return _u
}
// AddMentions adds the "mentions" edges to the MentionProfile entity.
func (_u *AccountUpdateOne) AddMentions(v ...*MentionProfile) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddMentionIDs(ids...)
}
// AddRoleIDs adds the "roles" edge to the Role entity by IDs.
func (_u *AccountUpdateOne) AddRoleIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddRoleIDs(ids...)
return _u
}
// AddRoles adds the "roles" edges to the Role entity.
func (_u *AccountUpdateOne) AddRoles(v ...*Role) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddRoleIDs(ids...)
}
// AddAuthenticationIDs adds the "authentication" edge to the Authentication entity by IDs.
func (_u *AccountUpdateOne) AddAuthenticationIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddAuthenticationIDs(ids...)
return _u
}
// AddAuthentication adds the "authentication" edges to the Authentication entity.
func (_u *AccountUpdateOne) AddAuthentication(v ...*Authentication) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddAuthenticationIDs(ids...)
}
// AddTagIDs adds the "tags" edge to the Tag entity by IDs.
func (_u *AccountUpdateOne) AddTagIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddTagIDs(ids...)
return _u
}
// AddTags adds the "tags" edges to the Tag entity.
func (_u *AccountUpdateOne) AddTags(v ...*Tag) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddTagIDs(ids...)
}
// AddCollectionIDs adds the "collections" edge to the Collection entity by IDs.
func (_u *AccountUpdateOne) AddCollectionIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddCollectionIDs(ids...)
return _u
}
// AddCollections adds the "collections" edges to the Collection entity.
func (_u *AccountUpdateOne) AddCollections(v ...*Collection) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddCollectionIDs(ids...)
}
// AddNodeIDs adds the "nodes" edge to the Node entity by IDs.
func (_u *AccountUpdateOne) AddNodeIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddNodeIDs(ids...)
return _u
}
// AddNodes adds the "nodes" edges to the Node entity.
func (_u *AccountUpdateOne) AddNodes(v ...*Node) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddNodeIDs(ids...)
}
// AddAssetIDs adds the "assets" edge to the Asset entity by IDs.
func (_u *AccountUpdateOne) AddAssetIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddAssetIDs(ids...)
return _u
}
// AddAssets adds the "assets" edges to the Asset entity.
func (_u *AccountUpdateOne) AddAssets(v ...*Asset) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddAssetIDs(ids...)
}
// AddEventIDs adds the "events" edge to the EventParticipant entity by IDs.
func (_u *AccountUpdateOne) AddEventIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddEventIDs(ids...)
return _u
}
// AddEvents adds the "events" edges to the EventParticipant entity.
func (_u *AccountUpdateOne) AddEvents(v ...*EventParticipant) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddEventIDs(ids...)
}
// AddPostReadIDs adds the "post_reads" edge to the PostRead entity by IDs.
func (_u *AccountUpdateOne) AddPostReadIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddPostReadIDs(ids...)
return _u
}
// AddPostReads adds the "post_reads" edges to the PostRead entity.
func (_u *AccountUpdateOne) AddPostReads(v ...*PostRead) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddPostReadIDs(ids...)
}
// AddReportIDs adds the "reports" edge to the Report entity by IDs.
func (_u *AccountUpdateOne) AddReportIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddReportIDs(ids...)
return _u
}
// AddReports adds the "reports" edges to the Report entity.
func (_u *AccountUpdateOne) AddReports(v ...*Report) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddReportIDs(ids...)
}
// AddHandledReportIDs adds the "handled_reports" edge to the Report entity by IDs.
func (_u *AccountUpdateOne) AddHandledReportIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddHandledReportIDs(ids...)
return _u
}
// AddHandledReports adds the "handled_reports" edges to the Report entity.
func (_u *AccountUpdateOne) AddHandledReports(v ...*Report) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddHandledReportIDs(ids...)
}
// AddAccountRoleIDs adds the "account_roles" edge to the AccountRoles entity by IDs.
func (_u *AccountUpdateOne) AddAccountRoleIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.AddAccountRoleIDs(ids...)
return _u
}
// AddAccountRoles adds the "account_roles" edges to the AccountRoles entity.
func (_u *AccountUpdateOne) AddAccountRoles(v ...*AccountRoles) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.AddAccountRoleIDs(ids...)
}
// Mutation returns the AccountMutation object of the builder.
func (_u *AccountUpdateOne) Mutation() *AccountMutation {
return _u.mutation
}
// ClearSessions clears all "sessions" edges to the Session entity.
func (_u *AccountUpdateOne) ClearSessions() *AccountUpdateOne {
_u.mutation.ClearSessions()
return _u
}
// RemoveSessionIDs removes the "sessions" edge to Session entities by IDs.
func (_u *AccountUpdateOne) RemoveSessionIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveSessionIDs(ids...)
return _u
}
// RemoveSessions removes "sessions" edges to Session entities.
func (_u *AccountUpdateOne) RemoveSessions(v ...*Session) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveSessionIDs(ids...)
}
// ClearEmails clears all "emails" edges to the Email entity.
func (_u *AccountUpdateOne) ClearEmails() *AccountUpdateOne {
_u.mutation.ClearEmails()
return _u
}
// RemoveEmailIDs removes the "emails" edge to Email entities by IDs.
func (_u *AccountUpdateOne) RemoveEmailIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveEmailIDs(ids...)
return _u
}
// RemoveEmails removes "emails" edges to Email entities.
func (_u *AccountUpdateOne) RemoveEmails(v ...*Email) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveEmailIDs(ids...)
}
// ClearNotifications clears all "notifications" edges to the Notification entity.
func (_u *AccountUpdateOne) ClearNotifications() *AccountUpdateOne {
_u.mutation.ClearNotifications()
return _u
}
// RemoveNotificationIDs removes the "notifications" edge to Notification entities by IDs.
func (_u *AccountUpdateOne) RemoveNotificationIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveNotificationIDs(ids...)
return _u
}
// RemoveNotifications removes "notifications" edges to Notification entities.
func (_u *AccountUpdateOne) RemoveNotifications(v ...*Notification) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveNotificationIDs(ids...)
}
// ClearTriggeredNotifications clears all "triggered_notifications" edges to the Notification entity.
func (_u *AccountUpdateOne) ClearTriggeredNotifications() *AccountUpdateOne {
_u.mutation.ClearTriggeredNotifications()
return _u
}
// RemoveTriggeredNotificationIDs removes the "triggered_notifications" edge to Notification entities by IDs.
func (_u *AccountUpdateOne) RemoveTriggeredNotificationIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveTriggeredNotificationIDs(ids...)
return _u
}
// RemoveTriggeredNotifications removes "triggered_notifications" edges to Notification entities.
func (_u *AccountUpdateOne) RemoveTriggeredNotifications(v ...*Notification) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveTriggeredNotificationIDs(ids...)
}
// ClearFollowing clears all "following" edges to the AccountFollow entity.
func (_u *AccountUpdateOne) ClearFollowing() *AccountUpdateOne {
_u.mutation.ClearFollowing()
return _u
}
// RemoveFollowingIDs removes the "following" edge to AccountFollow entities by IDs.
func (_u *AccountUpdateOne) RemoveFollowingIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveFollowingIDs(ids...)
return _u
}
// RemoveFollowing removes "following" edges to AccountFollow entities.
func (_u *AccountUpdateOne) RemoveFollowing(v ...*AccountFollow) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveFollowingIDs(ids...)
}
// ClearFollowedBy clears all "followed_by" edges to the AccountFollow entity.
func (_u *AccountUpdateOne) ClearFollowedBy() *AccountUpdateOne {
_u.mutation.ClearFollowedBy()
return _u
}
// RemoveFollowedByIDs removes the "followed_by" edge to AccountFollow entities by IDs.
func (_u *AccountUpdateOne) RemoveFollowedByIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveFollowedByIDs(ids...)
return _u
}
// RemoveFollowedBy removes "followed_by" edges to AccountFollow entities.
func (_u *AccountUpdateOne) RemoveFollowedBy(v ...*AccountFollow) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveFollowedByIDs(ids...)
}
// ClearInvitations clears all "invitations" edges to the Invitation entity.
func (_u *AccountUpdateOne) ClearInvitations() *AccountUpdateOne {
_u.mutation.ClearInvitations()
return _u
}
// RemoveInvitationIDs removes the "invitations" edge to Invitation entities by IDs.
func (_u *AccountUpdateOne) RemoveInvitationIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveInvitationIDs(ids...)
return _u
}
// RemoveInvitations removes "invitations" edges to Invitation entities.
func (_u *AccountUpdateOne) RemoveInvitations(v ...*Invitation) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveInvitationIDs(ids...)
}
// ClearInvitedBy clears the "invited_by" edge to the Invitation entity.
func (_u *AccountUpdateOne) ClearInvitedBy() *AccountUpdateOne {
_u.mutation.ClearInvitedBy()
return _u
}
// ClearPosts clears all "posts" edges to the Post entity.
func (_u *AccountUpdateOne) ClearPosts() *AccountUpdateOne {
_u.mutation.ClearPosts()
return _u
}
// RemovePostIDs removes the "posts" edge to Post entities by IDs.
func (_u *AccountUpdateOne) RemovePostIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemovePostIDs(ids...)
return _u
}
// RemovePosts removes "posts" edges to Post entities.
func (_u *AccountUpdateOne) RemovePosts(v ...*Post) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemovePostIDs(ids...)
}
// ClearQuestions clears all "questions" edges to the Question entity.
func (_u *AccountUpdateOne) ClearQuestions() *AccountUpdateOne {
_u.mutation.ClearQuestions()
return _u
}
// RemoveQuestionIDs removes the "questions" edge to Question entities by IDs.
func (_u *AccountUpdateOne) RemoveQuestionIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveQuestionIDs(ids...)
return _u
}
// RemoveQuestions removes "questions" edges to Question entities.
func (_u *AccountUpdateOne) RemoveQuestions(v ...*Question) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveQuestionIDs(ids...)
}
// ClearReacts clears all "reacts" edges to the React entity.
func (_u *AccountUpdateOne) ClearReacts() *AccountUpdateOne {
_u.mutation.ClearReacts()
return _u
}
// RemoveReactIDs removes the "reacts" edge to React entities by IDs.
func (_u *AccountUpdateOne) RemoveReactIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveReactIDs(ids...)
return _u
}
// RemoveReacts removes "reacts" edges to React entities.
func (_u *AccountUpdateOne) RemoveReacts(v ...*React) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveReactIDs(ids...)
}
// ClearLikes clears all "likes" edges to the LikePost entity.
func (_u *AccountUpdateOne) ClearLikes() *AccountUpdateOne {
_u.mutation.ClearLikes()
return _u
}
// RemoveLikeIDs removes the "likes" edge to LikePost entities by IDs.
func (_u *AccountUpdateOne) RemoveLikeIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveLikeIDs(ids...)
return _u
}
// RemoveLikes removes "likes" edges to LikePost entities.
func (_u *AccountUpdateOne) RemoveLikes(v ...*LikePost) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveLikeIDs(ids...)
}
// ClearMentions clears all "mentions" edges to the MentionProfile entity.
func (_u *AccountUpdateOne) ClearMentions() *AccountUpdateOne {
_u.mutation.ClearMentions()
return _u
}
// RemoveMentionIDs removes the "mentions" edge to MentionProfile entities by IDs.
func (_u *AccountUpdateOne) RemoveMentionIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveMentionIDs(ids...)
return _u
}
// RemoveMentions removes "mentions" edges to MentionProfile entities.
func (_u *AccountUpdateOne) RemoveMentions(v ...*MentionProfile) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveMentionIDs(ids...)
}
// ClearRoles clears all "roles" edges to the Role entity.
func (_u *AccountUpdateOne) ClearRoles() *AccountUpdateOne {
_u.mutation.ClearRoles()
return _u
}
// RemoveRoleIDs removes the "roles" edge to Role entities by IDs.
func (_u *AccountUpdateOne) RemoveRoleIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveRoleIDs(ids...)
return _u
}
// RemoveRoles removes "roles" edges to Role entities.
func (_u *AccountUpdateOne) RemoveRoles(v ...*Role) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveRoleIDs(ids...)
}
// ClearAuthentication clears all "authentication" edges to the Authentication entity.
func (_u *AccountUpdateOne) ClearAuthentication() *AccountUpdateOne {
_u.mutation.ClearAuthentication()
return _u
}
// RemoveAuthenticationIDs removes the "authentication" edge to Authentication entities by IDs.
func (_u *AccountUpdateOne) RemoveAuthenticationIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveAuthenticationIDs(ids...)
return _u
}
// RemoveAuthentication removes "authentication" edges to Authentication entities.
func (_u *AccountUpdateOne) RemoveAuthentication(v ...*Authentication) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveAuthenticationIDs(ids...)
}
// ClearTags clears all "tags" edges to the Tag entity.
func (_u *AccountUpdateOne) ClearTags() *AccountUpdateOne {
_u.mutation.ClearTags()
return _u
}
// RemoveTagIDs removes the "tags" edge to Tag entities by IDs.
func (_u *AccountUpdateOne) RemoveTagIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveTagIDs(ids...)
return _u
}
// RemoveTags removes "tags" edges to Tag entities.
func (_u *AccountUpdateOne) RemoveTags(v ...*Tag) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveTagIDs(ids...)
}
// ClearCollections clears all "collections" edges to the Collection entity.
func (_u *AccountUpdateOne) ClearCollections() *AccountUpdateOne {
_u.mutation.ClearCollections()
return _u
}
// RemoveCollectionIDs removes the "collections" edge to Collection entities by IDs.
func (_u *AccountUpdateOne) RemoveCollectionIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveCollectionIDs(ids...)
return _u
}
// RemoveCollections removes "collections" edges to Collection entities.
func (_u *AccountUpdateOne) RemoveCollections(v ...*Collection) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveCollectionIDs(ids...)
}
// ClearNodes clears all "nodes" edges to the Node entity.
func (_u *AccountUpdateOne) ClearNodes() *AccountUpdateOne {
_u.mutation.ClearNodes()
return _u
}
// RemoveNodeIDs removes the "nodes" edge to Node entities by IDs.
func (_u *AccountUpdateOne) RemoveNodeIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveNodeIDs(ids...)
return _u
}
// RemoveNodes removes "nodes" edges to Node entities.
func (_u *AccountUpdateOne) RemoveNodes(v ...*Node) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveNodeIDs(ids...)
}
// ClearAssets clears all "assets" edges to the Asset entity.
func (_u *AccountUpdateOne) ClearAssets() *AccountUpdateOne {
_u.mutation.ClearAssets()
return _u
}
// RemoveAssetIDs removes the "assets" edge to Asset entities by IDs.
func (_u *AccountUpdateOne) RemoveAssetIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveAssetIDs(ids...)
return _u
}
// RemoveAssets removes "assets" edges to Asset entities.
func (_u *AccountUpdateOne) RemoveAssets(v ...*Asset) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveAssetIDs(ids...)
}
// ClearEvents clears all "events" edges to the EventParticipant entity.
func (_u *AccountUpdateOne) ClearEvents() *AccountUpdateOne {
_u.mutation.ClearEvents()
return _u
}
// RemoveEventIDs removes the "events" edge to EventParticipant entities by IDs.
func (_u *AccountUpdateOne) RemoveEventIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveEventIDs(ids...)
return _u
}
// RemoveEvents removes "events" edges to EventParticipant entities.
func (_u *AccountUpdateOne) RemoveEvents(v ...*EventParticipant) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveEventIDs(ids...)
}
// ClearPostReads clears all "post_reads" edges to the PostRead entity.
func (_u *AccountUpdateOne) ClearPostReads() *AccountUpdateOne {
_u.mutation.ClearPostReads()
return _u
}
// RemovePostReadIDs removes the "post_reads" edge to PostRead entities by IDs.
func (_u *AccountUpdateOne) RemovePostReadIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemovePostReadIDs(ids...)
return _u
}
// RemovePostReads removes "post_reads" edges to PostRead entities.
func (_u *AccountUpdateOne) RemovePostReads(v ...*PostRead) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemovePostReadIDs(ids...)
}
// ClearReports clears all "reports" edges to the Report entity.
func (_u *AccountUpdateOne) ClearReports() *AccountUpdateOne {
_u.mutation.ClearReports()
return _u
}
// RemoveReportIDs removes the "reports" edge to Report entities by IDs.
func (_u *AccountUpdateOne) RemoveReportIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveReportIDs(ids...)
return _u
}
// RemoveReports removes "reports" edges to Report entities.
func (_u *AccountUpdateOne) RemoveReports(v ...*Report) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveReportIDs(ids...)
}
// ClearHandledReports clears all "handled_reports" edges to the Report entity.
func (_u *AccountUpdateOne) ClearHandledReports() *AccountUpdateOne {
_u.mutation.ClearHandledReports()
return _u
}
// RemoveHandledReportIDs removes the "handled_reports" edge to Report entities by IDs.
func (_u *AccountUpdateOne) RemoveHandledReportIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveHandledReportIDs(ids...)
return _u
}
// RemoveHandledReports removes "handled_reports" edges to Report entities.
func (_u *AccountUpdateOne) RemoveHandledReports(v ...*Report) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveHandledReportIDs(ids...)
}
// ClearAccountRoles clears all "account_roles" edges to the AccountRoles entity.
func (_u *AccountUpdateOne) ClearAccountRoles() *AccountUpdateOne {
_u.mutation.ClearAccountRoles()
return _u
}
// RemoveAccountRoleIDs removes the "account_roles" edge to AccountRoles entities by IDs.
func (_u *AccountUpdateOne) RemoveAccountRoleIDs(ids ...xid.ID) *AccountUpdateOne {
_u.mutation.RemoveAccountRoleIDs(ids...)
return _u
}
// RemoveAccountRoles removes "account_roles" edges to AccountRoles entities.
func (_u *AccountUpdateOne) RemoveAccountRoles(v ...*AccountRoles) *AccountUpdateOne {
ids := make([]xid.ID, len(v))
for i := range v {
ids[i] = v[i].ID
}
return _u.RemoveAccountRoleIDs(ids...)
}
// Where appends a list predicates to the AccountUpdate builder.
func (_u *AccountUpdateOne) Where(ps ...predicate.Account) *AccountUpdateOne {
_u.mutation.Where(ps...)
return _u
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (_u *AccountUpdateOne) Select(field string, fields ...string) *AccountUpdateOne {
_u.fields = append([]string{field}, fields...)
return _u
}
// Save executes the query and returns the updated Account entity.
func (_u *AccountUpdateOne) Save(ctx context.Context) (*Account, error) {
_u.defaults()
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *AccountUpdateOne) SaveX(ctx context.Context) *Account {
node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (_u *AccountUpdateOne) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *AccountUpdateOne) ExecX(ctx context.Context) {
if err := _u.Exec(ctx); err != nil {
panic(err)
}
}
// defaults sets the default values of the builder before save.
func (_u *AccountUpdateOne) defaults() {
if _, ok := _u.mutation.UpdatedAt(); !ok {
v := account.UpdateDefaultUpdatedAt()
_u.mutation.SetUpdatedAt(v)
}
}
// check runs all checks and user-defined validators on the builder.
func (_u *AccountUpdateOne) check() error {
if v, ok := _u.mutation.Handle(); ok {
if err := account.HandleValidator(v); err != nil {
return &ValidationError{Name: "handle", err: fmt.Errorf(`ent: validator failed for field "Account.handle": %w`, err)}
}
}
if v, ok := _u.mutation.Name(); ok {
if err := account.NameValidator(v); err != nil {
return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Account.name": %w`, err)}
}
}
if v, ok := _u.mutation.Kind(); ok {
if err := account.KindValidator(v); err != nil {
return &ValidationError{Name: "kind", err: fmt.Errorf(`ent: validator failed for field "Account.kind": %w`, err)}
}
}
return nil
}
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (_u *AccountUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *AccountUpdateOne {
_u.modifiers = append(_u.modifiers, modifiers...)
return _u
}
func (_u *AccountUpdateOne) sqlSave(ctx context.Context) (_node *Account, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(account.Table, account.Columns, sqlgraph.NewFieldSpec(account.FieldID, field.TypeString))
id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Account.id" for update`)}
}
_spec.Node.ID.Value = id
if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, account.FieldID)
for _, f := range fields {
if !account.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != account.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.UpdatedAt(); ok {
_spec.SetField(account.FieldUpdatedAt, field.TypeTime, value)
}
if value, ok := _u.mutation.DeletedAt(); ok {
_spec.SetField(account.FieldDeletedAt, field.TypeTime, value)
}
if _u.mutation.DeletedAtCleared() {
_spec.ClearField(account.FieldDeletedAt, field.TypeTime)
}
if value, ok := _u.mutation.IndexedAt(); ok {
_spec.SetField(account.FieldIndexedAt, field.TypeTime, value)
}
if _u.mutation.IndexedAtCleared() {
_spec.ClearField(account.FieldIndexedAt, field.TypeTime)
}
if value, ok := _u.mutation.Handle(); ok {
_spec.SetField(account.FieldHandle, field.TypeString, value)
}
if value, ok := _u.mutation.Name(); ok {
_spec.SetField(account.FieldName, field.TypeString, value)
}
if value, ok := _u.mutation.Bio(); ok {
_spec.SetField(account.FieldBio, field.TypeString, value)
}
if _u.mutation.BioCleared() {
_spec.ClearField(account.FieldBio, field.TypeString)
}
if value, ok := _u.mutation.Kind(); ok {
_spec.SetField(account.FieldKind, field.TypeEnum, value)
}
if value, ok := _u.mutation.Admin(); ok {
_spec.SetField(account.FieldAdmin, field.TypeBool, value)
}
if value, ok := _u.mutation.Links(); ok {
_spec.SetField(account.FieldLinks, field.TypeJSON, value)
}
if value, ok := _u.mutation.AppendedLinks(); ok {
_spec.AddModifier(func(u *sql.UpdateBuilder) {
sqljson.Append(u, account.FieldLinks, value)
})
}
if _u.mutation.LinksCleared() {
_spec.ClearField(account.FieldLinks, field.TypeJSON)
}
if value, ok := _u.mutation.Metadata(); ok {
_spec.SetField(account.FieldMetadata, field.TypeJSON, value)
}
if _u.mutation.MetadataCleared() {
_spec.ClearField(account.FieldMetadata, field.TypeJSON)
}
if _u.mutation.SessionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.SessionsTable,
Columns: []string{account.SessionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(session.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedSessionsIDs(); len(nodes) > 0 && !_u.mutation.SessionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.SessionsTable,
Columns: []string{account.SessionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(session.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.SessionsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.SessionsTable,
Columns: []string{account.SessionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(session.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.EmailsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EmailsTable,
Columns: []string{account.EmailsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(email.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedEmailsIDs(); len(nodes) > 0 && !_u.mutation.EmailsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EmailsTable,
Columns: []string{account.EmailsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(email.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.EmailsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EmailsTable,
Columns: []string{account.EmailsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(email.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.NotificationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NotificationsTable,
Columns: []string{account.NotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedNotificationsIDs(); len(nodes) > 0 && !_u.mutation.NotificationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NotificationsTable,
Columns: []string{account.NotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.NotificationsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NotificationsTable,
Columns: []string{account.NotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.TriggeredNotificationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.TriggeredNotificationsTable,
Columns: []string{account.TriggeredNotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedTriggeredNotificationsIDs(); len(nodes) > 0 && !_u.mutation.TriggeredNotificationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.TriggeredNotificationsTable,
Columns: []string{account.TriggeredNotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.TriggeredNotificationsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.TriggeredNotificationsTable,
Columns: []string{account.TriggeredNotificationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.FollowingCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowingTable,
Columns: []string{account.FollowingColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedFollowingIDs(); len(nodes) > 0 && !_u.mutation.FollowingCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowingTable,
Columns: []string{account.FollowingColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.FollowingIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowingTable,
Columns: []string{account.FollowingColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.FollowedByCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowedByTable,
Columns: []string{account.FollowedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedFollowedByIDs(); len(nodes) > 0 && !_u.mutation.FollowedByCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowedByTable,
Columns: []string{account.FollowedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.FollowedByIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.FollowedByTable,
Columns: []string{account.FollowedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountfollow.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.InvitationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.InvitationsTable,
Columns: []string{account.InvitationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedInvitationsIDs(); len(nodes) > 0 && !_u.mutation.InvitationsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.InvitationsTable,
Columns: []string{account.InvitationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.InvitationsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.InvitationsTable,
Columns: []string{account.InvitationsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.InvitedByCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: account.InvitedByTable,
Columns: []string{account.InvitedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.InvitedByIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: account.InvitedByTable,
Columns: []string{account.InvitedByColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(invitation.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.PostsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostsTable,
Columns: []string{account.PostsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(post.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedPostsIDs(); len(nodes) > 0 && !_u.mutation.PostsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostsTable,
Columns: []string{account.PostsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(post.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.PostsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostsTable,
Columns: []string{account.PostsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(post.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.QuestionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.QuestionsTable,
Columns: []string{account.QuestionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedQuestionsIDs(); len(nodes) > 0 && !_u.mutation.QuestionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.QuestionsTable,
Columns: []string{account.QuestionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.QuestionsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.QuestionsTable,
Columns: []string{account.QuestionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(question.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.ReactsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReactsTable,
Columns: []string{account.ReactsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(react.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedReactsIDs(); len(nodes) > 0 && !_u.mutation.ReactsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReactsTable,
Columns: []string{account.ReactsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(react.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.ReactsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReactsTable,
Columns: []string{account.ReactsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(react.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.LikesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.LikesTable,
Columns: []string{account.LikesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(likepost.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedLikesIDs(); len(nodes) > 0 && !_u.mutation.LikesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.LikesTable,
Columns: []string{account.LikesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(likepost.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.LikesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.LikesTable,
Columns: []string{account.LikesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(likepost.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.MentionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.MentionsTable,
Columns: []string{account.MentionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(mentionprofile.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedMentionsIDs(); len(nodes) > 0 && !_u.mutation.MentionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.MentionsTable,
Columns: []string{account.MentionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(mentionprofile.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.MentionsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.MentionsTable,
Columns: []string{account.MentionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(mentionprofile.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.RolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: account.RolesTable,
Columns: account.RolesPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(role.FieldID, field.TypeString),
},
}
createE := &AccountRolesCreate{config: _u.config, mutation: newAccountRolesMutation(_u.config, OpCreate)}
createE.defaults()
_, specE := createE.createSpec()
edge.Target.Fields = specE.Fields
if specE.ID.Value != nil {
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedRolesIDs(); len(nodes) > 0 && !_u.mutation.RolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: account.RolesTable,
Columns: account.RolesPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(role.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
createE := &AccountRolesCreate{config: _u.config, mutation: newAccountRolesMutation(_u.config, OpCreate)}
createE.defaults()
_, specE := createE.createSpec()
edge.Target.Fields = specE.Fields
if specE.ID.Value != nil {
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RolesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: true,
Table: account.RolesTable,
Columns: account.RolesPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(role.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
createE := &AccountRolesCreate{config: _u.config, mutation: newAccountRolesMutation(_u.config, OpCreate)}
createE.defaults()
_, specE := createE.createSpec()
edge.Target.Fields = specE.Fields
if specE.ID.Value != nil {
edge.Target.Fields = append(edge.Target.Fields, specE.ID)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.AuthenticationCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AuthenticationTable,
Columns: []string{account.AuthenticationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(authentication.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedAuthenticationIDs(); len(nodes) > 0 && !_u.mutation.AuthenticationCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AuthenticationTable,
Columns: []string{account.AuthenticationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(authentication.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.AuthenticationIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AuthenticationTable,
Columns: []string{account.AuthenticationColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(authentication.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.TagsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
Table: account.TagsTable,
Columns: account.TagsPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(tag.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedTagsIDs(); len(nodes) > 0 && !_u.mutation.TagsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
Table: account.TagsTable,
Columns: account.TagsPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(tag.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.TagsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2M,
Inverse: false,
Table: account.TagsTable,
Columns: account.TagsPrimaryKey,
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(tag.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.CollectionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.CollectionsTable,
Columns: []string{account.CollectionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(collection.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedCollectionsIDs(); len(nodes) > 0 && !_u.mutation.CollectionsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.CollectionsTable,
Columns: []string{account.CollectionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(collection.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.CollectionsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.CollectionsTable,
Columns: []string{account.CollectionsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(collection.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.NodesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NodesTable,
Columns: []string{account.NodesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(node.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedNodesIDs(); len(nodes) > 0 && !_u.mutation.NodesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NodesTable,
Columns: []string{account.NodesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(node.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.NodesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.NodesTable,
Columns: []string{account.NodesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(node.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.AssetsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AssetsTable,
Columns: []string{account.AssetsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedAssetsIDs(); len(nodes) > 0 && !_u.mutation.AssetsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AssetsTable,
Columns: []string{account.AssetsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.AssetsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.AssetsTable,
Columns: []string{account.AssetsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(asset.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.EventsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EventsTable,
Columns: []string{account.EventsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(eventparticipant.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedEventsIDs(); len(nodes) > 0 && !_u.mutation.EventsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EventsTable,
Columns: []string{account.EventsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(eventparticipant.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.EventsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.EventsTable,
Columns: []string{account.EventsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(eventparticipant.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.PostReadsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostReadsTable,
Columns: []string{account.PostReadsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(postread.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedPostReadsIDs(); len(nodes) > 0 && !_u.mutation.PostReadsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostReadsTable,
Columns: []string{account.PostReadsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(postread.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.PostReadsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.PostReadsTable,
Columns: []string{account.PostReadsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(postread.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.ReportsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReportsTable,
Columns: []string{account.ReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedReportsIDs(); len(nodes) > 0 && !_u.mutation.ReportsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReportsTable,
Columns: []string{account.ReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.ReportsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.ReportsTable,
Columns: []string{account.ReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.HandledReportsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.HandledReportsTable,
Columns: []string{account.HandledReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedHandledReportsIDs(); len(nodes) > 0 && !_u.mutation.HandledReportsCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.HandledReportsTable,
Columns: []string{account.HandledReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.HandledReportsIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: false,
Table: account.HandledReportsTable,
Columns: []string{account.HandledReportsColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(report.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.AccountRolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: account.AccountRolesTable,
Columns: []string{account.AccountRolesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountroles.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.RemovedAccountRolesIDs(); len(nodes) > 0 && !_u.mutation.AccountRolesCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: account.AccountRolesTable,
Columns: []string{account.AccountRolesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountroles.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.AccountRolesIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.O2M,
Inverse: true,
Table: account.AccountRolesTable,
Columns: []string{account.AccountRolesColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(accountroles.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
_spec.AddModifiers(_u.modifiers...)
_node = &Account{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{account.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
_u.mutation.done = true
return _node, nil
}