-
Notifications
You must be signed in to change notification settings - Fork 0
/
tableid.go
43 lines (34 loc) · 915 Bytes
/
tableid.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
package debefix
// TableID is a table identification, usually a table name.
// Users of the library may want to add more fields, like a database name.
type TableID interface {
TableID() string
TableName() string
}
// TableName implements TableID with a simple table name.
type TableName string
func (t TableName) TableID() string {
return string(t)
}
func (t TableName) TableName() string {
return string(t)
}
// TableNameID implement TableID with separate id and table name values.
type TableNameID struct {
id string
tableName string
}
var _ TableID = TableNameID{}
// NewTableNameID implement TableID with separate id and table name values.
func NewTableNameID(id string, tableName string) TableNameID {
return TableNameID{
id: id,
tableName: tableName,
}
}
func (t TableNameID) TableID() string {
return t.id
}
func (t TableNameID) TableName() string {
return t.tableName
}