Files
threshold/internal/authtoken/gorm.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1.3 KiB
Go
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
2023-02-02 17:15:17 -08:00
2020-07-07 07:44:49 -07:00
package authtoken
const (
// defaultAuthTokenTableName is the table where auth tokens are stored.
defaultAuthTokenTableName = "auth_token"
// defaultAuthTokenViewName is a view that includes all the auth_token
// columns plus the auth_account columns of: scope_id, iam_user_id and
// auth_method_id. These additional columns are returned via the API for
// auth tokens, so the view's handy
defaultAuthTokenViewName = "auth_token_account"
)
2020-07-07 07:44:49 -07:00
// TableName returns the table name for the auth token.
func (s *AuthToken) TableName() string {
if s.tableName != "" {
return s.tableName
}
return defaultAuthTokenTableName
2020-07-07 07:44:49 -07: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-07-07 07:44:49 -07:00
func (s *AuthToken) SetTableName(n string) {
2020-07-23 17:58:41 -04:00
s.tableName = n
2020-07-07 07:44:49 -07:00
}
// TableName returns the table name for the authTokenView.
func (s *authTokenView) TableName() string {
if s.tableName != "" {
return s.tableName
}
return defaultAuthTokenViewName
}
// SetTableName sets the table name. If the caller attempts to
// set the name to "" the name will be reset to the default name.
func (s *authTokenView) SetTableName(n string) {
2020-07-23 17:58:41 -04:00
s.tableName = n
}