/
actor_update.go
4264 lines (3977 loc) · 120 KB
/
actor_update.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// 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/schema/field"
"github.com/eriner/burr/internal/ent/actor"
"github.com/eriner/burr/internal/ent/event"
"github.com/eriner/burr/internal/ent/predicate"
"github.com/eriner/burr/internal/ent/server"
"github.com/eriner/burr/internal/ent/session"
"github.com/eriner/burr/internal/ent/status"
)
// ActorUpdate is the builder for updating Actor entities.
type ActorUpdate struct {
config
hooks []Hook
mutation *ActorMutation
}
// Where appends a list predicates to the ActorUpdate builder.
func (au *ActorUpdate) Where(ps ...predicate.Actor) *ActorUpdate {
au.mutation.Where(ps...)
return au
}
// SetUpdatedAt sets the "updated_at" field.
func (au *ActorUpdate) SetUpdatedAt(t time.Time) *ActorUpdate {
au.mutation.SetUpdatedAt(t)
return au
}
// SetCreatedBy sets the "created_by" field.
func (au *ActorUpdate) SetCreatedBy(i int) *ActorUpdate {
au.mutation.ResetCreatedBy()
au.mutation.SetCreatedBy(i)
return au
}
// SetNillableCreatedBy sets the "created_by" field if the given value is not nil.
func (au *ActorUpdate) SetNillableCreatedBy(i *int) *ActorUpdate {
if i != nil {
au.SetCreatedBy(*i)
}
return au
}
// AddCreatedBy adds i to the "created_by" field.
func (au *ActorUpdate) AddCreatedBy(i int) *ActorUpdate {
au.mutation.AddCreatedBy(i)
return au
}
// ClearCreatedBy clears the value of the "created_by" field.
func (au *ActorUpdate) ClearCreatedBy() *ActorUpdate {
au.mutation.ClearCreatedBy()
return au
}
// SetUpdatedBy sets the "updated_by" field.
func (au *ActorUpdate) SetUpdatedBy(i int) *ActorUpdate {
au.mutation.ResetUpdatedBy()
au.mutation.SetUpdatedBy(i)
return au
}
// SetNillableUpdatedBy sets the "updated_by" field if the given value is not nil.
func (au *ActorUpdate) SetNillableUpdatedBy(i *int) *ActorUpdate {
if i != nil {
au.SetUpdatedBy(*i)
}
return au
}
// AddUpdatedBy adds i to the "updated_by" field.
func (au *ActorUpdate) AddUpdatedBy(i int) *ActorUpdate {
au.mutation.AddUpdatedBy(i)
return au
}
// ClearUpdatedBy clears the value of the "updated_by" field.
func (au *ActorUpdate) ClearUpdatedBy() *ActorUpdate {
au.mutation.ClearUpdatedBy()
return au
}
// SetType sets the "type" field.
func (au *ActorUpdate) SetType(a actor.Type) *ActorUpdate {
au.mutation.SetType(a)
return au
}
// SetDisplayName sets the "display_name" field.
func (au *ActorUpdate) SetDisplayName(s string) *ActorUpdate {
au.mutation.SetDisplayName(s)
return au
}
// SetNillableDisplayName sets the "display_name" field if the given value is not nil.
func (au *ActorUpdate) SetNillableDisplayName(s *string) *ActorUpdate {
if s != nil {
au.SetDisplayName(*s)
}
return au
}
// SetNote sets the "note" field.
func (au *ActorUpdate) SetNote(s string) *ActorUpdate {
au.mutation.SetNote(s)
return au
}
// SetNillableNote sets the "note" field if the given value is not nil.
func (au *ActorUpdate) SetNillableNote(s *string) *ActorUpdate {
if s != nil {
au.SetNote(*s)
}
return au
}
// SetLocked sets the "locked" field.
func (au *ActorUpdate) SetLocked(b bool) *ActorUpdate {
au.mutation.SetLocked(b)
return au
}
// SetNillableLocked sets the "locked" field if the given value is not nil.
func (au *ActorUpdate) SetNillableLocked(b *bool) *ActorUpdate {
if b != nil {
au.SetLocked(*b)
}
return au
}
// SetMemorial sets the "memorial" field.
func (au *ActorUpdate) SetMemorial(b bool) *ActorUpdate {
au.mutation.SetMemorial(b)
return au
}
// SetNillableMemorial sets the "memorial" field if the given value is not nil.
func (au *ActorUpdate) SetNillableMemorial(b *bool) *ActorUpdate {
if b != nil {
au.SetMemorial(*b)
}
return au
}
// SetURL sets the "url" field.
func (au *ActorUpdate) SetURL(s string) *ActorUpdate {
au.mutation.SetURL(s)
return au
}
// SetPubkey sets the "pubkey" field.
func (au *ActorUpdate) SetPubkey(b []byte) *ActorUpdate {
au.mutation.SetPubkey(b)
return au
}
// SetPrivkey sets the "privkey" field.
func (au *ActorUpdate) SetPrivkey(b []byte) *ActorUpdate {
au.mutation.SetPrivkey(b)
return au
}
// ClearPrivkey clears the value of the "privkey" field.
func (au *ActorUpdate) ClearPrivkey() *ActorUpdate {
au.mutation.ClearPrivkey()
return au
}
// SetAvatarRemoteURL sets the "avatar_remote_url" field.
func (au *ActorUpdate) SetAvatarRemoteURL(s string) *ActorUpdate {
au.mutation.SetAvatarRemoteURL(s)
return au
}
// SetNillableAvatarRemoteURL sets the "avatar_remote_url" field if the given value is not nil.
func (au *ActorUpdate) SetNillableAvatarRemoteURL(s *string) *ActorUpdate {
if s != nil {
au.SetAvatarRemoteURL(*s)
}
return au
}
// ClearAvatarRemoteURL clears the value of the "avatar_remote_url" field.
func (au *ActorUpdate) ClearAvatarRemoteURL() *ActorUpdate {
au.mutation.ClearAvatarRemoteURL()
return au
}
// SetAvatarLocalFile sets the "avatar_local_file" field.
func (au *ActorUpdate) SetAvatarLocalFile(s string) *ActorUpdate {
au.mutation.SetAvatarLocalFile(s)
return au
}
// SetNillableAvatarLocalFile sets the "avatar_local_file" field if the given value is not nil.
func (au *ActorUpdate) SetNillableAvatarLocalFile(s *string) *ActorUpdate {
if s != nil {
au.SetAvatarLocalFile(*s)
}
return au
}
// ClearAvatarLocalFile clears the value of the "avatar_local_file" field.
func (au *ActorUpdate) ClearAvatarLocalFile() *ActorUpdate {
au.mutation.ClearAvatarLocalFile()
return au
}
// SetAvatarUpdatedAt sets the "avatar_updated_at" field.
func (au *ActorUpdate) SetAvatarUpdatedAt(t time.Time) *ActorUpdate {
au.mutation.SetAvatarUpdatedAt(t)
return au
}
// SetNillableAvatarUpdatedAt sets the "avatar_updated_at" field if the given value is not nil.
func (au *ActorUpdate) SetNillableAvatarUpdatedAt(t *time.Time) *ActorUpdate {
if t != nil {
au.SetAvatarUpdatedAt(*t)
}
return au
}
// ClearAvatarUpdatedAt clears the value of the "avatar_updated_at" field.
func (au *ActorUpdate) ClearAvatarUpdatedAt() *ActorUpdate {
au.mutation.ClearAvatarUpdatedAt()
return au
}
// SetHeaderURL sets the "header_url" field.
func (au *ActorUpdate) SetHeaderURL(s string) *ActorUpdate {
au.mutation.SetHeaderURL(s)
return au
}
// SetNillableHeaderURL sets the "header_url" field if the given value is not nil.
func (au *ActorUpdate) SetNillableHeaderURL(s *string) *ActorUpdate {
if s != nil {
au.SetHeaderURL(*s)
}
return au
}
// ClearHeaderURL clears the value of the "header_url" field.
func (au *ActorUpdate) ClearHeaderURL() *ActorUpdate {
au.mutation.ClearHeaderURL()
return au
}
// SetHeaderLocalFile sets the "header_local_file" field.
func (au *ActorUpdate) SetHeaderLocalFile(s string) *ActorUpdate {
au.mutation.SetHeaderLocalFile(s)
return au
}
// SetNillableHeaderLocalFile sets the "header_local_file" field if the given value is not nil.
func (au *ActorUpdate) SetNillableHeaderLocalFile(s *string) *ActorUpdate {
if s != nil {
au.SetHeaderLocalFile(*s)
}
return au
}
// ClearHeaderLocalFile clears the value of the "header_local_file" field.
func (au *ActorUpdate) ClearHeaderLocalFile() *ActorUpdate {
au.mutation.ClearHeaderLocalFile()
return au
}
// SetHeaderUpdatedAt sets the "header_updated_at" field.
func (au *ActorUpdate) SetHeaderUpdatedAt(t time.Time) *ActorUpdate {
au.mutation.SetHeaderUpdatedAt(t)
return au
}
// SetNillableHeaderUpdatedAt sets the "header_updated_at" field if the given value is not nil.
func (au *ActorUpdate) SetNillableHeaderUpdatedAt(t *time.Time) *ActorUpdate {
if t != nil {
au.SetHeaderUpdatedAt(*t)
}
return au
}
// ClearHeaderUpdatedAt clears the value of the "header_updated_at" field.
func (au *ActorUpdate) ClearHeaderUpdatedAt() *ActorUpdate {
au.mutation.ClearHeaderUpdatedAt()
return au
}
// SetLastWebfingerAt sets the "last_webfinger_at" field.
func (au *ActorUpdate) SetLastWebfingerAt(t time.Time) *ActorUpdate {
au.mutation.SetLastWebfingerAt(t)
return au
}
// SetNillableLastWebfingerAt sets the "last_webfinger_at" field if the given value is not nil.
func (au *ActorUpdate) SetNillableLastWebfingerAt(t *time.Time) *ActorUpdate {
if t != nil {
au.SetLastWebfingerAt(*t)
}
return au
}
// ClearLastWebfingerAt clears the value of the "last_webfinger_at" field.
func (au *ActorUpdate) ClearLastWebfingerAt() *ActorUpdate {
au.mutation.ClearLastWebfingerAt()
return au
}
// SetInboxURL sets the "inbox_url" field.
func (au *ActorUpdate) SetInboxURL(s string) *ActorUpdate {
au.mutation.SetInboxURL(s)
return au
}
// SetOutboxURL sets the "outbox_url" field.
func (au *ActorUpdate) SetOutboxURL(s string) *ActorUpdate {
au.mutation.SetOutboxURL(s)
return au
}
// SetSharedInboxURL sets the "shared_inbox_url" field.
func (au *ActorUpdate) SetSharedInboxURL(s string) *ActorUpdate {
au.mutation.SetSharedInboxURL(s)
return au
}
// SetFollowersURL sets the "followers_url" field.
func (au *ActorUpdate) SetFollowersURL(s string) *ActorUpdate {
au.mutation.SetFollowersURL(s)
return au
}
// SetMovedToID sets the "moved_to_id" field.
func (au *ActorUpdate) SetMovedToID(u uint64) *ActorUpdate {
au.mutation.ResetMovedToID()
au.mutation.SetMovedToID(u)
return au
}
// SetNillableMovedToID sets the "moved_to_id" field if the given value is not nil.
func (au *ActorUpdate) SetNillableMovedToID(u *uint64) *ActorUpdate {
if u != nil {
au.SetMovedToID(*u)
}
return au
}
// AddMovedToID adds u to the "moved_to_id" field.
func (au *ActorUpdate) AddMovedToID(u int64) *ActorUpdate {
au.mutation.AddMovedToID(u)
return au
}
// ClearMovedToID clears the value of the "moved_to_id" field.
func (au *ActorUpdate) ClearMovedToID() *ActorUpdate {
au.mutation.ClearMovedToID()
return au
}
// SetFeaturedCollectionURL sets the "featured_collection_url" field.
func (au *ActorUpdate) SetFeaturedCollectionURL(s string) *ActorUpdate {
au.mutation.SetFeaturedCollectionURL(s)
return au
}
// SetNillableFeaturedCollectionURL sets the "featured_collection_url" field if the given value is not nil.
func (au *ActorUpdate) SetNillableFeaturedCollectionURL(s *string) *ActorUpdate {
if s != nil {
au.SetFeaturedCollectionURL(*s)
}
return au
}
// ClearFeaturedCollectionURL clears the value of the "featured_collection_url" field.
func (au *ActorUpdate) ClearFeaturedCollectionURL() *ActorUpdate {
au.mutation.ClearFeaturedCollectionURL()
return au
}
// SetSilencedAt sets the "silenced_at" field.
func (au *ActorUpdate) SetSilencedAt(t time.Time) *ActorUpdate {
au.mutation.SetSilencedAt(t)
return au
}
// SetNillableSilencedAt sets the "silenced_at" field if the given value is not nil.
func (au *ActorUpdate) SetNillableSilencedAt(t *time.Time) *ActorUpdate {
if t != nil {
au.SetSilencedAt(*t)
}
return au
}
// ClearSilencedAt clears the value of the "silenced_at" field.
func (au *ActorUpdate) ClearSilencedAt() *ActorUpdate {
au.mutation.ClearSilencedAt()
return au
}
// SetSuspendedAt sets the "suspended_at" field.
func (au *ActorUpdate) SetSuspendedAt(t time.Time) *ActorUpdate {
au.mutation.SetSuspendedAt(t)
return au
}
// SetNillableSuspendedAt sets the "suspended_at" field if the given value is not nil.
func (au *ActorUpdate) SetNillableSuspendedAt(t *time.Time) *ActorUpdate {
if t != nil {
au.SetSuspendedAt(*t)
}
return au
}
// ClearSuspendedAt clears the value of the "suspended_at" field.
func (au *ActorUpdate) ClearSuspendedAt() *ActorUpdate {
au.mutation.ClearSuspendedAt()
return au
}
// SetPasswordHash sets the "passwordHash" field.
func (au *ActorUpdate) SetPasswordHash(b []byte) *ActorUpdate {
au.mutation.SetPasswordHash(b)
return au
}
// ClearPasswordHash clears the value of the "passwordHash" field.
func (au *ActorUpdate) ClearPasswordHash() *ActorUpdate {
au.mutation.ClearPasswordHash()
return au
}
// SetRecoveryCode sets the "recovery_code" field.
func (au *ActorUpdate) SetRecoveryCode(s string) *ActorUpdate {
au.mutation.SetRecoveryCode(s)
return au
}
// SetNillableRecoveryCode sets the "recovery_code" field if the given value is not nil.
func (au *ActorUpdate) SetNillableRecoveryCode(s *string) *ActorUpdate {
if s != nil {
au.SetRecoveryCode(*s)
}
return au
}
// ClearRecoveryCode clears the value of the "recovery_code" field.
func (au *ActorUpdate) ClearRecoveryCode() *ActorUpdate {
au.mutation.ClearRecoveryCode()
return au
}
// SetRole sets the "role" field.
func (au *ActorUpdate) SetRole(u uint64) *ActorUpdate {
au.mutation.ResetRole()
au.mutation.SetRole(u)
return au
}
// SetNillableRole sets the "role" field if the given value is not nil.
func (au *ActorUpdate) SetNillableRole(u *uint64) *ActorUpdate {
if u != nil {
au.SetRole(*u)
}
return au
}
// AddRole adds u to the "role" field.
func (au *ActorUpdate) AddRole(u int64) *ActorUpdate {
au.mutation.AddRole(u)
return au
}
// ClearRole clears the value of the "role" field.
func (au *ActorUpdate) ClearRole() *ActorUpdate {
au.mutation.ClearRole()
return au
}
// SetBadge sets the "badge" field.
func (au *ActorUpdate) SetBadge(u uint64) *ActorUpdate {
au.mutation.ResetBadge()
au.mutation.SetBadge(u)
return au
}
// SetNillableBadge sets the "badge" field if the given value is not nil.
func (au *ActorUpdate) SetNillableBadge(u *uint64) *ActorUpdate {
if u != nil {
au.SetBadge(*u)
}
return au
}
// AddBadge adds u to the "badge" field.
func (au *ActorUpdate) AddBadge(u int64) *ActorUpdate {
au.mutation.AddBadge(u)
return au
}
// ClearBadge clears the value of the "badge" field.
func (au *ActorUpdate) ClearBadge() *ActorUpdate {
au.mutation.ClearBadge()
return au
}
// SetLocale sets the "locale" field.
func (au *ActorUpdate) SetLocale(a actor.Locale) *ActorUpdate {
au.mutation.SetLocale(a)
return au
}
// SetServerID sets the "server" edge to the Server entity by ID.
func (au *ActorUpdate) SetServerID(id uint64) *ActorUpdate {
au.mutation.SetServerID(id)
return au
}
// SetServer sets the "server" edge to the Server entity.
func (au *ActorUpdate) SetServer(s *Server) *ActorUpdate {
return au.SetServerID(s.ID)
}
// AddEventIDs adds the "events" edge to the Event entity by IDs.
func (au *ActorUpdate) AddEventIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddEventIDs(ids...)
return au
}
// AddEvents adds the "events" edges to the Event entity.
func (au *ActorUpdate) AddEvents(e ...*Event) *ActorUpdate {
ids := make([]uint64, len(e))
for i := range e {
ids[i] = e[i].ID
}
return au.AddEventIDs(ids...)
}
// AddOrganizerOfIDs adds the "organizer_of" edge to the Event entity by IDs.
func (au *ActorUpdate) AddOrganizerOfIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddOrganizerOfIDs(ids...)
return au
}
// AddOrganizerOf adds the "organizer_of" edges to the Event entity.
func (au *ActorUpdate) AddOrganizerOf(e ...*Event) *ActorUpdate {
ids := make([]uint64, len(e))
for i := range e {
ids[i] = e[i].ID
}
return au.AddOrganizerOfIDs(ids...)
}
// AddStatusIDs adds the "statuses" edge to the Status entity by IDs.
func (au *ActorUpdate) AddStatusIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddStatusIDs(ids...)
return au
}
// AddStatuses adds the "statuses" edges to the Status entity.
func (au *ActorUpdate) AddStatuses(s ...*Status) *ActorUpdate {
ids := make([]uint64, len(s))
for i := range s {
ids[i] = s[i].ID
}
return au.AddStatusIDs(ids...)
}
// AddFollowerIDs adds the "followers" edge to the Actor entity by IDs.
func (au *ActorUpdate) AddFollowerIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddFollowerIDs(ids...)
return au
}
// AddFollowers adds the "followers" edges to the Actor entity.
func (au *ActorUpdate) AddFollowers(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.AddFollowerIDs(ids...)
}
// AddFollowingIDs adds the "following" edge to the Actor entity by IDs.
func (au *ActorUpdate) AddFollowingIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddFollowingIDs(ids...)
return au
}
// AddFollowing adds the "following" edges to the Actor entity.
func (au *ActorUpdate) AddFollowing(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.AddFollowingIDs(ids...)
}
// AddReactedStatusIDs adds the "reacted_statuses" edge to the Status entity by IDs.
func (au *ActorUpdate) AddReactedStatusIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddReactedStatusIDs(ids...)
return au
}
// AddReactedStatuses adds the "reacted_statuses" edges to the Status entity.
func (au *ActorUpdate) AddReactedStatuses(s ...*Status) *ActorUpdate {
ids := make([]uint64, len(s))
for i := range s {
ids[i] = s[i].ID
}
return au.AddReactedStatusIDs(ids...)
}
// AddModeratorIDs adds the "moderators" edge to the Actor entity by IDs.
func (au *ActorUpdate) AddModeratorIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddModeratorIDs(ids...)
return au
}
// AddModerators adds the "moderators" edges to the Actor entity.
func (au *ActorUpdate) AddModerators(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.AddModeratorIDs(ids...)
}
// AddModeratingIDs adds the "moderating" edge to the Actor entity by IDs.
func (au *ActorUpdate) AddModeratingIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddModeratingIDs(ids...)
return au
}
// AddModerating adds the "moderating" edges to the Actor entity.
func (au *ActorUpdate) AddModerating(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.AddModeratingIDs(ids...)
}
// AddMemberIDs adds the "members" edge to the Actor entity by IDs.
func (au *ActorUpdate) AddMemberIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddMemberIDs(ids...)
return au
}
// AddMembers adds the "members" edges to the Actor entity.
func (au *ActorUpdate) AddMembers(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.AddMemberIDs(ids...)
}
// AddGroupIDs adds the "groups" edge to the Actor entity by IDs.
func (au *ActorUpdate) AddGroupIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddGroupIDs(ids...)
return au
}
// AddGroups adds the "groups" edges to the Actor entity.
func (au *ActorUpdate) AddGroups(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.AddGroupIDs(ids...)
}
// AddSessionIDs adds the "sessions" edge to the Session entity by IDs.
func (au *ActorUpdate) AddSessionIDs(ids ...uint64) *ActorUpdate {
au.mutation.AddSessionIDs(ids...)
return au
}
// AddSessions adds the "sessions" edges to the Session entity.
func (au *ActorUpdate) AddSessions(s ...*Session) *ActorUpdate {
ids := make([]uint64, len(s))
for i := range s {
ids[i] = s[i].ID
}
return au.AddSessionIDs(ids...)
}
// Mutation returns the ActorMutation object of the builder.
func (au *ActorUpdate) Mutation() *ActorMutation {
return au.mutation
}
// ClearServer clears the "server" edge to the Server entity.
func (au *ActorUpdate) ClearServer() *ActorUpdate {
au.mutation.ClearServer()
return au
}
// ClearEvents clears all "events" edges to the Event entity.
func (au *ActorUpdate) ClearEvents() *ActorUpdate {
au.mutation.ClearEvents()
return au
}
// RemoveEventIDs removes the "events" edge to Event entities by IDs.
func (au *ActorUpdate) RemoveEventIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveEventIDs(ids...)
return au
}
// RemoveEvents removes "events" edges to Event entities.
func (au *ActorUpdate) RemoveEvents(e ...*Event) *ActorUpdate {
ids := make([]uint64, len(e))
for i := range e {
ids[i] = e[i].ID
}
return au.RemoveEventIDs(ids...)
}
// ClearOrganizerOf clears all "organizer_of" edges to the Event entity.
func (au *ActorUpdate) ClearOrganizerOf() *ActorUpdate {
au.mutation.ClearOrganizerOf()
return au
}
// RemoveOrganizerOfIDs removes the "organizer_of" edge to Event entities by IDs.
func (au *ActorUpdate) RemoveOrganizerOfIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveOrganizerOfIDs(ids...)
return au
}
// RemoveOrganizerOf removes "organizer_of" edges to Event entities.
func (au *ActorUpdate) RemoveOrganizerOf(e ...*Event) *ActorUpdate {
ids := make([]uint64, len(e))
for i := range e {
ids[i] = e[i].ID
}
return au.RemoveOrganizerOfIDs(ids...)
}
// ClearStatuses clears all "statuses" edges to the Status entity.
func (au *ActorUpdate) ClearStatuses() *ActorUpdate {
au.mutation.ClearStatuses()
return au
}
// RemoveStatusIDs removes the "statuses" edge to Status entities by IDs.
func (au *ActorUpdate) RemoveStatusIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveStatusIDs(ids...)
return au
}
// RemoveStatuses removes "statuses" edges to Status entities.
func (au *ActorUpdate) RemoveStatuses(s ...*Status) *ActorUpdate {
ids := make([]uint64, len(s))
for i := range s {
ids[i] = s[i].ID
}
return au.RemoveStatusIDs(ids...)
}
// ClearFollowers clears all "followers" edges to the Actor entity.
func (au *ActorUpdate) ClearFollowers() *ActorUpdate {
au.mutation.ClearFollowers()
return au
}
// RemoveFollowerIDs removes the "followers" edge to Actor entities by IDs.
func (au *ActorUpdate) RemoveFollowerIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveFollowerIDs(ids...)
return au
}
// RemoveFollowers removes "followers" edges to Actor entities.
func (au *ActorUpdate) RemoveFollowers(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.RemoveFollowerIDs(ids...)
}
// ClearFollowing clears all "following" edges to the Actor entity.
func (au *ActorUpdate) ClearFollowing() *ActorUpdate {
au.mutation.ClearFollowing()
return au
}
// RemoveFollowingIDs removes the "following" edge to Actor entities by IDs.
func (au *ActorUpdate) RemoveFollowingIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveFollowingIDs(ids...)
return au
}
// RemoveFollowing removes "following" edges to Actor entities.
func (au *ActorUpdate) RemoveFollowing(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.RemoveFollowingIDs(ids...)
}
// ClearReactedStatuses clears all "reacted_statuses" edges to the Status entity.
func (au *ActorUpdate) ClearReactedStatuses() *ActorUpdate {
au.mutation.ClearReactedStatuses()
return au
}
// RemoveReactedStatusIDs removes the "reacted_statuses" edge to Status entities by IDs.
func (au *ActorUpdate) RemoveReactedStatusIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveReactedStatusIDs(ids...)
return au
}
// RemoveReactedStatuses removes "reacted_statuses" edges to Status entities.
func (au *ActorUpdate) RemoveReactedStatuses(s ...*Status) *ActorUpdate {
ids := make([]uint64, len(s))
for i := range s {
ids[i] = s[i].ID
}
return au.RemoveReactedStatusIDs(ids...)
}
// ClearModerators clears all "moderators" edges to the Actor entity.
func (au *ActorUpdate) ClearModerators() *ActorUpdate {
au.mutation.ClearModerators()
return au
}
// RemoveModeratorIDs removes the "moderators" edge to Actor entities by IDs.
func (au *ActorUpdate) RemoveModeratorIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveModeratorIDs(ids...)
return au
}
// RemoveModerators removes "moderators" edges to Actor entities.
func (au *ActorUpdate) RemoveModerators(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.RemoveModeratorIDs(ids...)
}
// ClearModerating clears all "moderating" edges to the Actor entity.
func (au *ActorUpdate) ClearModerating() *ActorUpdate {
au.mutation.ClearModerating()
return au
}
// RemoveModeratingIDs removes the "moderating" edge to Actor entities by IDs.
func (au *ActorUpdate) RemoveModeratingIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveModeratingIDs(ids...)
return au
}
// RemoveModerating removes "moderating" edges to Actor entities.
func (au *ActorUpdate) RemoveModerating(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.RemoveModeratingIDs(ids...)
}
// ClearMembers clears all "members" edges to the Actor entity.
func (au *ActorUpdate) ClearMembers() *ActorUpdate {
au.mutation.ClearMembers()
return au
}
// RemoveMemberIDs removes the "members" edge to Actor entities by IDs.
func (au *ActorUpdate) RemoveMemberIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveMemberIDs(ids...)
return au
}
// RemoveMembers removes "members" edges to Actor entities.
func (au *ActorUpdate) RemoveMembers(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.RemoveMemberIDs(ids...)
}
// ClearGroups clears all "groups" edges to the Actor entity.
func (au *ActorUpdate) ClearGroups() *ActorUpdate {
au.mutation.ClearGroups()
return au
}
// RemoveGroupIDs removes the "groups" edge to Actor entities by IDs.
func (au *ActorUpdate) RemoveGroupIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveGroupIDs(ids...)
return au
}
// RemoveGroups removes "groups" edges to Actor entities.
func (au *ActorUpdate) RemoveGroups(a ...*Actor) *ActorUpdate {
ids := make([]uint64, len(a))
for i := range a {
ids[i] = a[i].ID
}
return au.RemoveGroupIDs(ids...)
}
// ClearSessions clears all "sessions" edges to the Session entity.
func (au *ActorUpdate) ClearSessions() *ActorUpdate {
au.mutation.ClearSessions()
return au
}
// RemoveSessionIDs removes the "sessions" edge to Session entities by IDs.
func (au *ActorUpdate) RemoveSessionIDs(ids ...uint64) *ActorUpdate {
au.mutation.RemoveSessionIDs(ids...)
return au
}
// RemoveSessions removes "sessions" edges to Session entities.
func (au *ActorUpdate) RemoveSessions(s ...*Session) *ActorUpdate {
ids := make([]uint64, len(s))
for i := range s {
ids[i] = s[i].ID
}
return au.RemoveSessionIDs(ids...)
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (au *ActorUpdate) Save(ctx context.Context) (int, error) {
var (
err error
affected int
)
if err := au.defaults(); err != nil {
return 0, err
}
if len(au.hooks) == 0 {
if err = au.check(); err != nil {
return 0, err
}
affected, err = au.sqlSave(ctx)
} else {
var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
mutation, ok := m.(*ActorMutation)
if !ok {
return nil, fmt.Errorf("unexpected mutation type %T", m)
}
if err = au.check(); err != nil {
return 0, err
}
au.mutation = mutation
affected, err = au.sqlSave(ctx)
mutation.done = true
return affected, err
})
for i := len(au.hooks) - 1; i >= 0; i-- {
if au.hooks[i] == nil {
return 0, fmt.Errorf("ent: uninitialized hook (forgotten import ent/runtime?)")
}
mut = au.hooks[i](mut)
}
if _, err := mut.Mutate(ctx, au.mutation); err != nil {
return 0, err
}
}
return affected, err
}
// SaveX is like Save, but panics if an error occurs.
func (au *ActorUpdate) SaveX(ctx context.Context) int {
affected, err := au.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (au *ActorUpdate) Exec(ctx context.Context) error {
_, err := au.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (au *ActorUpdate) ExecX(ctx context.Context) {
if err := au.Exec(ctx); err != nil {