-
Notifications
You must be signed in to change notification settings - Fork 247
/
tables.go
57 lines (48 loc) · 1.5 KB
/
tables.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
package migrations
const (
tableNamespaceDefault = "namespace_config"
tableTransactionDefault = "relation_tuple_transaction"
tableTupleDefault = "relation_tuple"
tableMigrationVersion = "mysql_migration_version"
tableMetadataDefault = "mysql_metadata"
tableCaveatDefault = "caveat"
)
type tables struct {
tableMigrationVersion string
tableTransaction string
tableTuple string
tableNamespace string
tableMetadata string
tableCaveat string
}
func newTables(prefix string) *tables {
return &tables{
tableMigrationVersion: prefix + tableMigrationVersion,
tableTransaction: prefix + tableTransactionDefault,
tableTuple: prefix + tableTupleDefault,
tableNamespace: prefix + tableNamespaceDefault,
tableMetadata: prefix + tableMetadataDefault,
tableCaveat: prefix + tableCaveatDefault,
}
}
func (tn *tables) migrationVersion() string {
return tn.tableMigrationVersion
}
// RelationTupleTransaction returns the prefixed transaction table name.
func (tn *tables) RelationTupleTransaction() string {
return tn.tableTransaction
}
// RelationTuple returns the prefixed relationship tuple table name.
func (tn *tables) RelationTuple() string {
return tn.tableTuple
}
// Namespace returns the prefixed namespace table name.
func (tn *tables) Namespace() string {
return tn.tableNamespace
}
func (tn *tables) Metadata() string {
return tn.tableMetadata
}
func (tn *tables) Caveat() string {
return tn.tableCaveat
}