/
repository.go
1025 lines (1008 loc) · 40 KB
/
repository.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 (
"encoding/json"
"fmt"
"strings"
"time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
"github.com/gnolang/gh-sql/ent/repository"
"github.com/gnolang/gh-sql/ent/user"
"github.com/gnolang/gh-sql/pkg/model"
)
// Repository is the model entity for the Repository schema.
type Repository struct {
config `json:"-"`
// ID of the ent.
ID int64 `json:"id,omitempty"`
// NodeID holds the value of the "node_id" field.
NodeID string `json:"node_id"`
// Name holds the value of the "name" field.
Name string `json:"name"`
// FullName holds the value of the "full_name" field.
FullName string `json:"full_name"`
// Private holds the value of the "private" field.
Private bool `json:"private"`
// HTMLURL holds the value of the "html_url" field.
HTMLURL string `json:"html_url"`
// Description holds the value of the "description" field.
Description string `json:"description"`
// Fork holds the value of the "fork" field.
Fork bool `json:"fork"`
// URL holds the value of the "url" field.
URL string `json:"url"`
// ArchiveURL holds the value of the "archive_url" field.
ArchiveURL string `json:"archive_url"`
// AssigneesURL holds the value of the "assignees_url" field.
AssigneesURL string `json:"assignees_url"`
// BlobsURL holds the value of the "blobs_url" field.
BlobsURL string `json:"blobs_url"`
// BranchesURL holds the value of the "branches_url" field.
BranchesURL string `json:"branches_url"`
// CollaboratorsURL holds the value of the "collaborators_url" field.
CollaboratorsURL string `json:"collaborators_url"`
// CommentsURL holds the value of the "comments_url" field.
CommentsURL string `json:"comments_url"`
// CommitsURL holds the value of the "commits_url" field.
CommitsURL string `json:"commits_url"`
// CompareURL holds the value of the "compare_url" field.
CompareURL string `json:"compare_url"`
// ContentsURL holds the value of the "contents_url" field.
ContentsURL string `json:"contents_url"`
// ContributorsURL holds the value of the "contributors_url" field.
ContributorsURL string `json:"contributors_url"`
// DeploymentsURL holds the value of the "deployments_url" field.
DeploymentsURL string `json:"deployments_url"`
// DownloadsURL holds the value of the "downloads_url" field.
DownloadsURL string `json:"downloads_url"`
// EventsURL holds the value of the "events_url" field.
EventsURL string `json:"events_url"`
// ForksURL holds the value of the "forks_url" field.
ForksURL string `json:"forks_url"`
// GitCommitsURL holds the value of the "git_commits_url" field.
GitCommitsURL string `json:"git_commits_url"`
// GitRefsURL holds the value of the "git_refs_url" field.
GitRefsURL string `json:"git_refs_url"`
// GitTagsURL holds the value of the "git_tags_url" field.
GitTagsURL string `json:"git_tags_url"`
// GitURL holds the value of the "git_url" field.
GitURL string `json:"git_url"`
// IssueCommentURL holds the value of the "issue_comment_url" field.
IssueCommentURL string `json:"issue_comment_url"`
// IssueEventsURL holds the value of the "issue_events_url" field.
IssueEventsURL string `json:"issue_events_url"`
// IssuesURL holds the value of the "issues_url" field.
IssuesURL string `json:"issues_url"`
// KeysURL holds the value of the "keys_url" field.
KeysURL string `json:"keys_url"`
// LabelsURL holds the value of the "labels_url" field.
LabelsURL string `json:"labels_url"`
// LanguagesURL holds the value of the "languages_url" field.
LanguagesURL string `json:"languages_url"`
// MergesURL holds the value of the "merges_url" field.
MergesURL string `json:"merges_url"`
// MilestonesURL holds the value of the "milestones_url" field.
MilestonesURL string `json:"milestones_url"`
// NotificationsURL holds the value of the "notifications_url" field.
NotificationsURL string `json:"notifications_url"`
// PullsURL holds the value of the "pulls_url" field.
PullsURL string `json:"pulls_url"`
// ReleasesURL holds the value of the "releases_url" field.
ReleasesURL string `json:"releases_url"`
// SSHURL holds the value of the "ssh_url" field.
SSHURL string `json:"ssh_url"`
// StargazersURL holds the value of the "stargazers_url" field.
StargazersURL string `json:"stargazers_url"`
// StatusesURL holds the value of the "statuses_url" field.
StatusesURL string `json:"statuses_url"`
// SubscribersURL holds the value of the "subscribers_url" field.
SubscribersURL string `json:"subscribers_url"`
// SubscriptionURL holds the value of the "subscription_url" field.
SubscriptionURL string `json:"subscription_url"`
// TagsURL holds the value of the "tags_url" field.
TagsURL string `json:"tags_url"`
// TeamsURL holds the value of the "teams_url" field.
TeamsURL string `json:"teams_url"`
// TreesURL holds the value of the "trees_url" field.
TreesURL string `json:"trees_url"`
// CloneURL holds the value of the "clone_url" field.
CloneURL string `json:"clone_url"`
// MirrorURL holds the value of the "mirror_url" field.
MirrorURL *string `json:"mirror_url"`
// HooksURL holds the value of the "hooks_url" field.
HooksURL string `json:"hooks_url"`
// SvnURL holds the value of the "svn_url" field.
SvnURL string `json:"svn_url"`
// Homepage holds the value of the "homepage" field.
Homepage string `json:"homepage"`
// Language holds the value of the "language" field.
Language string `json:"language"`
// ForksCount holds the value of the "forks_count" field.
ForksCount int64 `json:"forks_count"`
// StargazersCount holds the value of the "stargazers_count" field.
StargazersCount int64 `json:"stargazers_count"`
// WatchersCount holds the value of the "watchers_count" field.
WatchersCount int64 `json:"watchers_count"`
// The size of the repository, in kilobytes. Size is calculated hourly. When a repository is initially created, the size is 0.
Size int64 `json:"size"`
// DefaultBranch holds the value of the "default_branch" field.
DefaultBranch string `json:"default_branch"`
// OpenIssuesCount holds the value of the "open_issues_count" field.
OpenIssuesCount int64 `json:"open_issues_count"`
// IsTemplate holds the value of the "is_template" field.
IsTemplate bool `json:"is_template"`
// Topics holds the value of the "topics" field.
Topics []string `json:"topics"`
// HasIssuesEnabled holds the value of the "has_issues_enabled" field.
HasIssuesEnabled bool `json:"has_issues"`
// HasProjects holds the value of the "has_projects" field.
HasProjects bool `json:"has_projects"`
// HasWiki holds the value of the "has_wiki" field.
HasWiki bool `json:"has_wiki"`
// HasPages holds the value of the "has_pages" field.
HasPages bool `json:"has_pages"`
// HasDownloads holds the value of the "has_downloads" field.
HasDownloads bool `json:"has_downloads"`
// HasDiscussions holds the value of the "has_discussions" field.
HasDiscussions bool `json:"has_discussions"`
// Archived holds the value of the "archived" field.
Archived bool `json:"archived"`
// Returns whether or not this repository disabled.
Disabled bool `json:"disabled"`
// Visibility holds the value of the "visibility" field.
Visibility *repository.Visibility `json:"visibility"`
// PushedAt holds the value of the "pushed_at" field.
PushedAt time.Time `json:"pushed_at"`
// CreatedAt holds the value of the "created_at" field.
CreatedAt time.Time `json:"created_at"`
// UpdatedAt holds the value of the "updated_at" field.
UpdatedAt time.Time `json:"updated_at"`
// SubscribersCount holds the value of the "subscribers_count" field.
SubscribersCount int64 `json:"subscribers_count"`
// NetworkCount holds the value of the "network_count" field.
NetworkCount int64 `json:"network_count"`
// Forks holds the value of the "forks" field.
Forks int64 `json:"forks"`
// OpenIssues holds the value of the "open_issues" field.
OpenIssues int64 `json:"open_issues"`
// Watchers holds the value of the "watchers" field.
Watchers int64 `json:"watchers"`
// License holds the value of the "license" field.
License *model.License `json:"license"`
// Edges holds the relations/edges for other nodes in the graph.
// The values are being populated by the RepositoryQuery when eager-loading is set.
Edges RepositoryEdges `json:"-"`
user_repositories *int64
selectValues sql.SelectValues
}
// RepositoryEdges holds the relations/edges for other nodes in the graph.
type RepositoryEdges struct {
// Owner holds the value of the owner edge.
Owner *User `json:"owner,omitempty"`
// Issues holds the value of the issues edge.
Issues []*Issue `json:"issues,omitempty"`
// loadedTypes holds the information for reporting if a
// type was loaded (or requested) in eager-loading or not.
loadedTypes [2]bool
}
// OwnerOrErr returns the Owner value or an error if the edge
// was not loaded in eager-loading, or loaded but was not found.
func (e RepositoryEdges) OwnerOrErr() (*User, error) {
if e.Owner != nil {
return e.Owner, nil
} else if e.loadedTypes[0] {
return nil, &NotFoundError{label: user.Label}
}
return nil, &NotLoadedError{edge: "owner"}
}
// IssuesOrErr returns the Issues value or an error if the edge
// was not loaded in eager-loading.
func (e RepositoryEdges) IssuesOrErr() ([]*Issue, error) {
if e.loadedTypes[1] {
return e.Issues, nil
}
return nil, &NotLoadedError{edge: "issues"}
}
// scanValues returns the types for scanning values from sql.Rows.
func (*Repository) scanValues(columns []string) ([]any, error) {
values := make([]any, len(columns))
for i := range columns {
switch columns[i] {
case repository.FieldTopics, repository.FieldLicense:
values[i] = new([]byte)
case repository.FieldPrivate, repository.FieldFork, repository.FieldIsTemplate, repository.FieldHasIssuesEnabled, repository.FieldHasProjects, repository.FieldHasWiki, repository.FieldHasPages, repository.FieldHasDownloads, repository.FieldHasDiscussions, repository.FieldArchived, repository.FieldDisabled:
values[i] = new(sql.NullBool)
case repository.FieldID, repository.FieldForksCount, repository.FieldStargazersCount, repository.FieldWatchersCount, repository.FieldSize, repository.FieldOpenIssuesCount, repository.FieldSubscribersCount, repository.FieldNetworkCount, repository.FieldForks, repository.FieldOpenIssues, repository.FieldWatchers:
values[i] = new(sql.NullInt64)
case repository.FieldNodeID, repository.FieldName, repository.FieldFullName, repository.FieldHTMLURL, repository.FieldDescription, repository.FieldURL, repository.FieldArchiveURL, repository.FieldAssigneesURL, repository.FieldBlobsURL, repository.FieldBranchesURL, repository.FieldCollaboratorsURL, repository.FieldCommentsURL, repository.FieldCommitsURL, repository.FieldCompareURL, repository.FieldContentsURL, repository.FieldContributorsURL, repository.FieldDeploymentsURL, repository.FieldDownloadsURL, repository.FieldEventsURL, repository.FieldForksURL, repository.FieldGitCommitsURL, repository.FieldGitRefsURL, repository.FieldGitTagsURL, repository.FieldGitURL, repository.FieldIssueCommentURL, repository.FieldIssueEventsURL, repository.FieldIssuesURL, repository.FieldKeysURL, repository.FieldLabelsURL, repository.FieldLanguagesURL, repository.FieldMergesURL, repository.FieldMilestonesURL, repository.FieldNotificationsURL, repository.FieldPullsURL, repository.FieldReleasesURL, repository.FieldSSHURL, repository.FieldStargazersURL, repository.FieldStatusesURL, repository.FieldSubscribersURL, repository.FieldSubscriptionURL, repository.FieldTagsURL, repository.FieldTeamsURL, repository.FieldTreesURL, repository.FieldCloneURL, repository.FieldMirrorURL, repository.FieldHooksURL, repository.FieldSvnURL, repository.FieldHomepage, repository.FieldLanguage, repository.FieldDefaultBranch, repository.FieldVisibility:
values[i] = new(sql.NullString)
case repository.FieldPushedAt, repository.FieldCreatedAt, repository.FieldUpdatedAt:
values[i] = new(sql.NullTime)
case repository.ForeignKeys[0]: // user_repositories
values[i] = new(sql.NullInt64)
default:
values[i] = new(sql.UnknownType)
}
}
return values, nil
}
// assignValues assigns the values that were returned from sql.Rows (after scanning)
// to the Repository fields.
func (r *Repository) assignValues(columns []string, values []any) error {
if m, n := len(values), len(columns); m < n {
return fmt.Errorf("mismatch number of scan values: %d != %d", m, n)
}
for i := range columns {
switch columns[i] {
case repository.FieldID:
value, ok := values[i].(*sql.NullInt64)
if !ok {
return fmt.Errorf("unexpected type %T for field id", value)
}
r.ID = int64(value.Int64)
case repository.FieldNodeID:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field node_id", values[i])
} else if value.Valid {
r.NodeID = value.String
}
case repository.FieldName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field name", values[i])
} else if value.Valid {
r.Name = value.String
}
case repository.FieldFullName:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field full_name", values[i])
} else if value.Valid {
r.FullName = value.String
}
case repository.FieldPrivate:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field private", values[i])
} else if value.Valid {
r.Private = value.Bool
}
case repository.FieldHTMLURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field html_url", values[i])
} else if value.Valid {
r.HTMLURL = value.String
}
case repository.FieldDescription:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field description", values[i])
} else if value.Valid {
r.Description = value.String
}
case repository.FieldFork:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field fork", values[i])
} else if value.Valid {
r.Fork = value.Bool
}
case repository.FieldURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field url", values[i])
} else if value.Valid {
r.URL = value.String
}
case repository.FieldArchiveURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field archive_url", values[i])
} else if value.Valid {
r.ArchiveURL = value.String
}
case repository.FieldAssigneesURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field assignees_url", values[i])
} else if value.Valid {
r.AssigneesURL = value.String
}
case repository.FieldBlobsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field blobs_url", values[i])
} else if value.Valid {
r.BlobsURL = value.String
}
case repository.FieldBranchesURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field branches_url", values[i])
} else if value.Valid {
r.BranchesURL = value.String
}
case repository.FieldCollaboratorsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field collaborators_url", values[i])
} else if value.Valid {
r.CollaboratorsURL = value.String
}
case repository.FieldCommentsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field comments_url", values[i])
} else if value.Valid {
r.CommentsURL = value.String
}
case repository.FieldCommitsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field commits_url", values[i])
} else if value.Valid {
r.CommitsURL = value.String
}
case repository.FieldCompareURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field compare_url", values[i])
} else if value.Valid {
r.CompareURL = value.String
}
case repository.FieldContentsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field contents_url", values[i])
} else if value.Valid {
r.ContentsURL = value.String
}
case repository.FieldContributorsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field contributors_url", values[i])
} else if value.Valid {
r.ContributorsURL = value.String
}
case repository.FieldDeploymentsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field deployments_url", values[i])
} else if value.Valid {
r.DeploymentsURL = value.String
}
case repository.FieldDownloadsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field downloads_url", values[i])
} else if value.Valid {
r.DownloadsURL = value.String
}
case repository.FieldEventsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field events_url", values[i])
} else if value.Valid {
r.EventsURL = value.String
}
case repository.FieldForksURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field forks_url", values[i])
} else if value.Valid {
r.ForksURL = value.String
}
case repository.FieldGitCommitsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field git_commits_url", values[i])
} else if value.Valid {
r.GitCommitsURL = value.String
}
case repository.FieldGitRefsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field git_refs_url", values[i])
} else if value.Valid {
r.GitRefsURL = value.String
}
case repository.FieldGitTagsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field git_tags_url", values[i])
} else if value.Valid {
r.GitTagsURL = value.String
}
case repository.FieldGitURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field git_url", values[i])
} else if value.Valid {
r.GitURL = value.String
}
case repository.FieldIssueCommentURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field issue_comment_url", values[i])
} else if value.Valid {
r.IssueCommentURL = value.String
}
case repository.FieldIssueEventsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field issue_events_url", values[i])
} else if value.Valid {
r.IssueEventsURL = value.String
}
case repository.FieldIssuesURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field issues_url", values[i])
} else if value.Valid {
r.IssuesURL = value.String
}
case repository.FieldKeysURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field keys_url", values[i])
} else if value.Valid {
r.KeysURL = value.String
}
case repository.FieldLabelsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field labels_url", values[i])
} else if value.Valid {
r.LabelsURL = value.String
}
case repository.FieldLanguagesURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field languages_url", values[i])
} else if value.Valid {
r.LanguagesURL = value.String
}
case repository.FieldMergesURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field merges_url", values[i])
} else if value.Valid {
r.MergesURL = value.String
}
case repository.FieldMilestonesURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field milestones_url", values[i])
} else if value.Valid {
r.MilestonesURL = value.String
}
case repository.FieldNotificationsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field notifications_url", values[i])
} else if value.Valid {
r.NotificationsURL = value.String
}
case repository.FieldPullsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field pulls_url", values[i])
} else if value.Valid {
r.PullsURL = value.String
}
case repository.FieldReleasesURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field releases_url", values[i])
} else if value.Valid {
r.ReleasesURL = value.String
}
case repository.FieldSSHURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field ssh_url", values[i])
} else if value.Valid {
r.SSHURL = value.String
}
case repository.FieldStargazersURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field stargazers_url", values[i])
} else if value.Valid {
r.StargazersURL = value.String
}
case repository.FieldStatusesURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field statuses_url", values[i])
} else if value.Valid {
r.StatusesURL = value.String
}
case repository.FieldSubscribersURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field subscribers_url", values[i])
} else if value.Valid {
r.SubscribersURL = value.String
}
case repository.FieldSubscriptionURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field subscription_url", values[i])
} else if value.Valid {
r.SubscriptionURL = value.String
}
case repository.FieldTagsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field tags_url", values[i])
} else if value.Valid {
r.TagsURL = value.String
}
case repository.FieldTeamsURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field teams_url", values[i])
} else if value.Valid {
r.TeamsURL = value.String
}
case repository.FieldTreesURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field trees_url", values[i])
} else if value.Valid {
r.TreesURL = value.String
}
case repository.FieldCloneURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field clone_url", values[i])
} else if value.Valid {
r.CloneURL = value.String
}
case repository.FieldMirrorURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field mirror_url", values[i])
} else if value.Valid {
r.MirrorURL = new(string)
*r.MirrorURL = value.String
}
case repository.FieldHooksURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field hooks_url", values[i])
} else if value.Valid {
r.HooksURL = value.String
}
case repository.FieldSvnURL:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field svn_url", values[i])
} else if value.Valid {
r.SvnURL = value.String
}
case repository.FieldHomepage:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field homepage", values[i])
} else if value.Valid {
r.Homepage = value.String
}
case repository.FieldLanguage:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field language", values[i])
} else if value.Valid {
r.Language = value.String
}
case repository.FieldForksCount:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field forks_count", values[i])
} else if value.Valid {
r.ForksCount = value.Int64
}
case repository.FieldStargazersCount:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field stargazers_count", values[i])
} else if value.Valid {
r.StargazersCount = value.Int64
}
case repository.FieldWatchersCount:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field watchers_count", values[i])
} else if value.Valid {
r.WatchersCount = value.Int64
}
case repository.FieldSize:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field size", values[i])
} else if value.Valid {
r.Size = value.Int64
}
case repository.FieldDefaultBranch:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field default_branch", values[i])
} else if value.Valid {
r.DefaultBranch = value.String
}
case repository.FieldOpenIssuesCount:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field open_issues_count", values[i])
} else if value.Valid {
r.OpenIssuesCount = value.Int64
}
case repository.FieldIsTemplate:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field is_template", values[i])
} else if value.Valid {
r.IsTemplate = value.Bool
}
case repository.FieldTopics:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field topics", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &r.Topics); err != nil {
return fmt.Errorf("unmarshal field topics: %w", err)
}
}
case repository.FieldHasIssuesEnabled:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field has_issues_enabled", values[i])
} else if value.Valid {
r.HasIssuesEnabled = value.Bool
}
case repository.FieldHasProjects:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field has_projects", values[i])
} else if value.Valid {
r.HasProjects = value.Bool
}
case repository.FieldHasWiki:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field has_wiki", values[i])
} else if value.Valid {
r.HasWiki = value.Bool
}
case repository.FieldHasPages:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field has_pages", values[i])
} else if value.Valid {
r.HasPages = value.Bool
}
case repository.FieldHasDownloads:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field has_downloads", values[i])
} else if value.Valid {
r.HasDownloads = value.Bool
}
case repository.FieldHasDiscussions:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field has_discussions", values[i])
} else if value.Valid {
r.HasDiscussions = value.Bool
}
case repository.FieldArchived:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field archived", values[i])
} else if value.Valid {
r.Archived = value.Bool
}
case repository.FieldDisabled:
if value, ok := values[i].(*sql.NullBool); !ok {
return fmt.Errorf("unexpected type %T for field disabled", values[i])
} else if value.Valid {
r.Disabled = value.Bool
}
case repository.FieldVisibility:
if value, ok := values[i].(*sql.NullString); !ok {
return fmt.Errorf("unexpected type %T for field visibility", values[i])
} else if value.Valid {
r.Visibility = new(repository.Visibility)
*r.Visibility = repository.Visibility(value.String)
}
case repository.FieldPushedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field pushed_at", values[i])
} else if value.Valid {
r.PushedAt = value.Time
}
case repository.FieldCreatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field created_at", values[i])
} else if value.Valid {
r.CreatedAt = value.Time
}
case repository.FieldUpdatedAt:
if value, ok := values[i].(*sql.NullTime); !ok {
return fmt.Errorf("unexpected type %T for field updated_at", values[i])
} else if value.Valid {
r.UpdatedAt = value.Time
}
case repository.FieldSubscribersCount:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field subscribers_count", values[i])
} else if value.Valid {
r.SubscribersCount = value.Int64
}
case repository.FieldNetworkCount:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field network_count", values[i])
} else if value.Valid {
r.NetworkCount = value.Int64
}
case repository.FieldForks:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field forks", values[i])
} else if value.Valid {
r.Forks = value.Int64
}
case repository.FieldOpenIssues:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field open_issues", values[i])
} else if value.Valid {
r.OpenIssues = value.Int64
}
case repository.FieldWatchers:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for field watchers", values[i])
} else if value.Valid {
r.Watchers = value.Int64
}
case repository.FieldLicense:
if value, ok := values[i].(*[]byte); !ok {
return fmt.Errorf("unexpected type %T for field license", values[i])
} else if value != nil && len(*value) > 0 {
if err := json.Unmarshal(*value, &r.License); err != nil {
return fmt.Errorf("unmarshal field license: %w", err)
}
}
case repository.ForeignKeys[0]:
if value, ok := values[i].(*sql.NullInt64); !ok {
return fmt.Errorf("unexpected type %T for edge-field user_repositories", value)
} else if value.Valid {
r.user_repositories = new(int64)
*r.user_repositories = int64(value.Int64)
}
default:
r.selectValues.Set(columns[i], values[i])
}
}
return nil
}
// Value returns the ent.Value that was dynamically selected and assigned to the Repository.
// This includes values selected through modifiers, order, etc.
func (r *Repository) Value(name string) (ent.Value, error) {
return r.selectValues.Get(name)
}
// QueryOwner queries the "owner" edge of the Repository entity.
func (r *Repository) QueryOwner() *UserQuery {
return NewRepositoryClient(r.config).QueryOwner(r)
}
// QueryIssues queries the "issues" edge of the Repository entity.
func (r *Repository) QueryIssues() *IssueQuery {
return NewRepositoryClient(r.config).QueryIssues(r)
}
// Update returns a builder for updating this Repository.
// Note that you need to call Repository.Unwrap() before calling this method if this Repository
// was returned from a transaction, and the transaction was committed or rolled back.
func (r *Repository) Update() *RepositoryUpdateOne {
return NewRepositoryClient(r.config).UpdateOne(r)
}
// Unwrap unwraps the Repository entity that was returned from a transaction after it was closed,
// so that all future queries will be executed through the driver which created the transaction.
func (r *Repository) Unwrap() *Repository {
_tx, ok := r.config.driver.(*txDriver)
if !ok {
panic("ent: Repository is not a transactional entity")
}
r.config.driver = _tx.drv
return r
}
// String implements the fmt.Stringer.
func (r *Repository) String() string {
var builder strings.Builder
builder.WriteString("Repository(")
builder.WriteString(fmt.Sprintf("id=%v, ", r.ID))
builder.WriteString("node_id=")
builder.WriteString(r.NodeID)
builder.WriteString(", ")
builder.WriteString("name=")
builder.WriteString(r.Name)
builder.WriteString(", ")
builder.WriteString("full_name=")
builder.WriteString(r.FullName)
builder.WriteString(", ")
builder.WriteString("private=")
builder.WriteString(fmt.Sprintf("%v", r.Private))
builder.WriteString(", ")
builder.WriteString("html_url=")
builder.WriteString(r.HTMLURL)
builder.WriteString(", ")
builder.WriteString("description=")
builder.WriteString(r.Description)
builder.WriteString(", ")
builder.WriteString("fork=")
builder.WriteString(fmt.Sprintf("%v", r.Fork))
builder.WriteString(", ")
builder.WriteString("url=")
builder.WriteString(r.URL)
builder.WriteString(", ")
builder.WriteString("archive_url=")
builder.WriteString(r.ArchiveURL)
builder.WriteString(", ")
builder.WriteString("assignees_url=")
builder.WriteString(r.AssigneesURL)
builder.WriteString(", ")
builder.WriteString("blobs_url=")
builder.WriteString(r.BlobsURL)
builder.WriteString(", ")
builder.WriteString("branches_url=")
builder.WriteString(r.BranchesURL)
builder.WriteString(", ")
builder.WriteString("collaborators_url=")
builder.WriteString(r.CollaboratorsURL)
builder.WriteString(", ")
builder.WriteString("comments_url=")
builder.WriteString(r.CommentsURL)
builder.WriteString(", ")
builder.WriteString("commits_url=")
builder.WriteString(r.CommitsURL)
builder.WriteString(", ")
builder.WriteString("compare_url=")
builder.WriteString(r.CompareURL)
builder.WriteString(", ")
builder.WriteString("contents_url=")
builder.WriteString(r.ContentsURL)
builder.WriteString(", ")
builder.WriteString("contributors_url=")
builder.WriteString(r.ContributorsURL)
builder.WriteString(", ")
builder.WriteString("deployments_url=")
builder.WriteString(r.DeploymentsURL)
builder.WriteString(", ")
builder.WriteString("downloads_url=")
builder.WriteString(r.DownloadsURL)
builder.WriteString(", ")
builder.WriteString("events_url=")
builder.WriteString(r.EventsURL)
builder.WriteString(", ")
builder.WriteString("forks_url=")
builder.WriteString(r.ForksURL)
builder.WriteString(", ")
builder.WriteString("git_commits_url=")
builder.WriteString(r.GitCommitsURL)
builder.WriteString(", ")
builder.WriteString("git_refs_url=")
builder.WriteString(r.GitRefsURL)
builder.WriteString(", ")
builder.WriteString("git_tags_url=")
builder.WriteString(r.GitTagsURL)
builder.WriteString(", ")
builder.WriteString("git_url=")
builder.WriteString(r.GitURL)
builder.WriteString(", ")
builder.WriteString("issue_comment_url=")
builder.WriteString(r.IssueCommentURL)
builder.WriteString(", ")
builder.WriteString("issue_events_url=")
builder.WriteString(r.IssueEventsURL)
builder.WriteString(", ")
builder.WriteString("issues_url=")
builder.WriteString(r.IssuesURL)
builder.WriteString(", ")
builder.WriteString("keys_url=")
builder.WriteString(r.KeysURL)
builder.WriteString(", ")
builder.WriteString("labels_url=")
builder.WriteString(r.LabelsURL)
builder.WriteString(", ")
builder.WriteString("languages_url=")
builder.WriteString(r.LanguagesURL)
builder.WriteString(", ")
builder.WriteString("merges_url=")
builder.WriteString(r.MergesURL)
builder.WriteString(", ")
builder.WriteString("milestones_url=")
builder.WriteString(r.MilestonesURL)
builder.WriteString(", ")
builder.WriteString("notifications_url=")
builder.WriteString(r.NotificationsURL)
builder.WriteString(", ")
builder.WriteString("pulls_url=")
builder.WriteString(r.PullsURL)
builder.WriteString(", ")
builder.WriteString("releases_url=")
builder.WriteString(r.ReleasesURL)
builder.WriteString(", ")
builder.WriteString("ssh_url=")
builder.WriteString(r.SSHURL)
builder.WriteString(", ")
builder.WriteString("stargazers_url=")
builder.WriteString(r.StargazersURL)
builder.WriteString(", ")
builder.WriteString("statuses_url=")
builder.WriteString(r.StatusesURL)
builder.WriteString(", ")
builder.WriteString("subscribers_url=")
builder.WriteString(r.SubscribersURL)
builder.WriteString(", ")
builder.WriteString("subscription_url=")
builder.WriteString(r.SubscriptionURL)
builder.WriteString(", ")
builder.WriteString("tags_url=")
builder.WriteString(r.TagsURL)
builder.WriteString(", ")
builder.WriteString("teams_url=")
builder.WriteString(r.TeamsURL)
builder.WriteString(", ")
builder.WriteString("trees_url=")
builder.WriteString(r.TreesURL)
builder.WriteString(", ")
builder.WriteString("clone_url=")
builder.WriteString(r.CloneURL)
builder.WriteString(", ")
if v := r.MirrorURL; v != nil {
builder.WriteString("mirror_url=")
builder.WriteString(*v)
}
builder.WriteString(", ")
builder.WriteString("hooks_url=")
builder.WriteString(r.HooksURL)
builder.WriteString(", ")
builder.WriteString("svn_url=")
builder.WriteString(r.SvnURL)
builder.WriteString(", ")
builder.WriteString("homepage=")
builder.WriteString(r.Homepage)
builder.WriteString(", ")
builder.WriteString("language=")
builder.WriteString(r.Language)
builder.WriteString(", ")
builder.WriteString("forks_count=")
builder.WriteString(fmt.Sprintf("%v", r.ForksCount))
builder.WriteString(", ")
builder.WriteString("stargazers_count=")
builder.WriteString(fmt.Sprintf("%v", r.StargazersCount))
builder.WriteString(", ")
builder.WriteString("watchers_count=")
builder.WriteString(fmt.Sprintf("%v", r.WatchersCount))
builder.WriteString(", ")
builder.WriteString("size=")
builder.WriteString(fmt.Sprintf("%v", r.Size))
builder.WriteString(", ")
builder.WriteString("default_branch=")
builder.WriteString(r.DefaultBranch)
builder.WriteString(", ")
builder.WriteString("open_issues_count=")
builder.WriteString(fmt.Sprintf("%v", r.OpenIssuesCount))
builder.WriteString(", ")
builder.WriteString("is_template=")
builder.WriteString(fmt.Sprintf("%v", r.IsTemplate))
builder.WriteString(", ")
builder.WriteString("topics=")
builder.WriteString(fmt.Sprintf("%v", r.Topics))
builder.WriteString(", ")
builder.WriteString("has_issues_enabled=")
builder.WriteString(fmt.Sprintf("%v", r.HasIssuesEnabled))
builder.WriteString(", ")
builder.WriteString("has_projects=")
builder.WriteString(fmt.Sprintf("%v", r.HasProjects))
builder.WriteString(", ")
builder.WriteString("has_wiki=")
builder.WriteString(fmt.Sprintf("%v", r.HasWiki))
builder.WriteString(", ")
builder.WriteString("has_pages=")
builder.WriteString(fmt.Sprintf("%v", r.HasPages))
builder.WriteString(", ")
builder.WriteString("has_downloads=")
builder.WriteString(fmt.Sprintf("%v", r.HasDownloads))
builder.WriteString(", ")
builder.WriteString("has_discussions=")
builder.WriteString(fmt.Sprintf("%v", r.HasDiscussions))
builder.WriteString(", ")
builder.WriteString("archived=")
builder.WriteString(fmt.Sprintf("%v", r.Archived))
builder.WriteString(", ")
builder.WriteString("disabled=")
builder.WriteString(fmt.Sprintf("%v", r.Disabled))
builder.WriteString(", ")
if v := r.Visibility; v != nil {
builder.WriteString("visibility=")
builder.WriteString(fmt.Sprintf("%v", *v))
}
builder.WriteString(", ")
builder.WriteString("pushed_at=")
builder.WriteString(r.PushedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("created_at=")
builder.WriteString(r.CreatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("updated_at=")
builder.WriteString(r.UpdatedAt.Format(time.ANSIC))
builder.WriteString(", ")
builder.WriteString("subscribers_count=")
builder.WriteString(fmt.Sprintf("%v", r.SubscribersCount))
builder.WriteString(", ")
builder.WriteString("network_count=")
builder.WriteString(fmt.Sprintf("%v", r.NetworkCount))
builder.WriteString(", ")
builder.WriteString("forks=")
builder.WriteString(fmt.Sprintf("%v", r.Forks))
builder.WriteString(", ")
builder.WriteString("open_issues=")