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 IBM Corp. 2020, 2026
// 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.
2024-01-04 12:51:21 -08:00
func (at *AuthToken) TableName() string {
if at.tableName != "" {
return at.tableName
2020-07-07 07:44:49 -07:00
}
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.
2024-01-04 12:51:21 -08:00
func (at *AuthToken) SetTableName(n string) {
at.tableName = n
2020-07-07 07:44:49 -07:00
}
// TableName returns the table name for the authTokenView.
2024-01-04 12:51:21 -08:00
func (atv *authTokenView) TableName() string {
if atv.tableName != "" {
return atv.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.
2024-01-04 12:51:21 -08:00
func (atv *authTokenView) SetTableName(n string) {
atv.tableName = n
2020-07-23 17:58:41 -04:00
}