Files
threshold/internal/host/static/gorm.go
T

84 lines
2.0 KiB
Go
Raw Normal View History

2020-05-27 18:16:43 -04:00
package static
const (
defaultHostCatalogTableName = "static_host_catalog"
defaultHostTableName = "static_host"
defaultHostSetTableName = "static_host_set"
defaultHostSetMemberTableName = "static_host_set_member"
)
2020-05-27 18:16:43 -04:00
// TableName returns the table name for the host catalog.
func (c *HostCatalog) TableName() string {
if c.tableName != "" {
return c.tableName
}
return defaultHostCatalogTableName
2020-05-27 18:16:43 -04:00
}
// SetTableName sets the table name. If the caller attempts to
// set the name to "" the name will be reset to the default name.
2020-05-27 18:16:43 -04:00
func (c *HostCatalog) SetTableName(n string) {
switch n {
case "":
c.tableName = defaultHostCatalogTableName
default:
2020-05-27 18:16:43 -04:00
c.tableName = n
}
}
// TableName returns the table name for the host.
func (h *Host) TableName() string {
if h.tableName != "" {
return h.tableName
}
return defaultHostTableName
2020-05-27 18:16:43 -04:00
}
// SetTableName sets the table name. If the caller attempts to
// set the name to "" the name will be reset to the default name.
2020-05-27 18:16:43 -04:00
func (h *Host) SetTableName(n string) {
switch n {
case "":
h.tableName = defaultHostTableName
default:
2020-05-27 18:16:43 -04:00
h.tableName = n
}
}
// TableName returns the table name for the host set.
func (s *HostSet) TableName() string {
if s.tableName != "" {
return s.tableName
}
return defaultHostSetTableName
2020-05-27 18:16:43 -04:00
}
// SetTableName sets the table name. If the caller attempts to
// set the name to "" the name will be reset to the default name.
2020-05-27 18:16:43 -04:00
func (s *HostSet) SetTableName(n string) {
switch n {
case "":
s.tableName = defaultHostSetTableName
default:
2020-05-27 18:16:43 -04:00
s.tableName = n
}
}
// TableName returns the table name for the host set.
func (m *HostSetMember) TableName() string {
if m.tableName != "" {
return m.tableName
}
return defaultHostSetMemberTableName
2020-05-27 18:16:43 -04:00
}
// SetTableName sets the table name. If the caller attempts to
// set the name to "" the name will be reset to the default name.
2020-05-27 18:16:43 -04:00
func (m *HostSetMember) SetTableName(n string) {
switch n {
case "":
m.tableName = defaultHostSetMemberTableName
default:
2020-05-27 18:16:43 -04:00
m.tableName = n
}
}