-
Notifications
You must be signed in to change notification settings - Fork 42
/
mirror.go
108 lines (100 loc) · 3.88 KB
/
mirror.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
// Code generated by ent, DO NOT EDIT.
package mirror
import (
"time"
"github.com/google/uuid"
)
const (
// Label holds the string label denoting the mirror type in the database.
Label = "mirror"
// FieldID holds the string denoting the id field in the database.
FieldID = "oid"
// FieldURL holds the string denoting the url field in the database.
FieldURL = "url"
// FieldRef holds the string denoting the ref field in the database.
FieldRef = "ref"
// FieldCron holds the string denoting the cron field in the database.
FieldCron = "cron"
// FieldPublicKey holds the string denoting the public_key field in the database.
FieldPublicKey = "public_key"
// FieldPrivateKey holds the string denoting the private_key field in the database.
FieldPrivateKey = "private_key"
// FieldPassphrase holds the string denoting the passphrase field in the database.
FieldPassphrase = "passphrase"
// FieldCommit holds the string denoting the commit field in the database.
FieldCommit = "commit"
// FieldLastSync holds the string denoting the last_sync field in the database.
FieldLastSync = "last_sync"
// FieldUpdatedAt holds the string denoting the updated_at field in the database.
FieldUpdatedAt = "updated_at"
// EdgeNamespace holds the string denoting the namespace edge name in mutations.
EdgeNamespace = "namespace"
// EdgeInode holds the string denoting the inode edge name in mutations.
EdgeInode = "inode"
// EdgeActivities holds the string denoting the activities edge name in mutations.
EdgeActivities = "activities"
// Table holds the table name of the mirror in the database.
Table = "mirrors"
// NamespaceTable is the table that holds the namespace relation/edge.
NamespaceTable = "mirrors"
// NamespaceInverseTable is the table name for the Namespace entity.
// It exists in this package in order to avoid circular dependency with the "namespace" package.
NamespaceInverseTable = "namespaces"
// NamespaceColumn is the table column denoting the namespace relation/edge.
NamespaceColumn = "namespace_mirrors"
// InodeTable is the table that holds the inode relation/edge.
InodeTable = "mirrors"
// InodeInverseTable is the table name for the Inode entity.
// It exists in this package in order to avoid circular dependency with the "inode" package.
InodeInverseTable = "inodes"
// InodeColumn is the table column denoting the inode relation/edge.
InodeColumn = "inode_mirror"
// ActivitiesTable is the table that holds the activities relation/edge.
ActivitiesTable = "mirror_activities"
// ActivitiesInverseTable is the table name for the MirrorActivity entity.
// It exists in this package in order to avoid circular dependency with the "mirroractivity" package.
ActivitiesInverseTable = "mirror_activities"
// ActivitiesColumn is the table column denoting the activities relation/edge.
ActivitiesColumn = "mirror_activities"
)
// Columns holds all SQL columns for mirror fields.
var Columns = []string{
FieldID,
FieldURL,
FieldRef,
FieldCron,
FieldPublicKey,
FieldPrivateKey,
FieldPassphrase,
FieldCommit,
FieldLastSync,
FieldUpdatedAt,
}
// ForeignKeys holds the SQL foreign-keys that are owned by the "mirrors"
// table and are not defined as standalone fields in the schema.
var ForeignKeys = []string{
"inode_mirror",
"namespace_mirrors",
}
// ValidColumn reports if the column name is valid (part of the table columns).
func ValidColumn(column string) bool {
for i := range Columns {
if column == Columns[i] {
return true
}
}
for i := range ForeignKeys {
if column == ForeignKeys[i] {
return true
}
}
return false
}
var (
// DefaultUpdatedAt holds the default value on creation for the "updated_at" field.
DefaultUpdatedAt func() time.Time
// UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field.
UpdateDefaultUpdatedAt func() time.Time
// DefaultID holds the default value on creation for the "id" field.
DefaultID func() uuid.UUID
)