Documentation ¶
Index ¶
- Constants
- func IsUniqueConstraintError(err string, indexName []string) bool
- func Must(sc StoreChannel) interface{}
- func UpgradeDatabase(sqlStore SqlStore)
- func UpgradeDatabaseToVersion1(sqlStore SqlStore)
- type LayeredStore
- func (s *LayeredStore) Close()
- func (s *LayeredStore) DropAllTables()
- func (s *LayeredStore) MarkSystemRanUnitTests()
- func (s *LayeredStore) System() SystemStore
- func (s *LayeredStore) Token() TokenStore
- func (s *LayeredStore) TotalMasterDbConnections() int
- func (s *LayeredStore) TotalReadDbConnections() int
- func (s *LayeredStore) TotalSearchDbConnections() int
- func (s *LayeredStore) User() UserStore
- type SqlStore
- type SqlSupplier
- func (ss *SqlSupplier) AlterColumnTypeIfExists(tableName string, columnName string, mySqlColType string, ...) bool
- func (ss *SqlSupplier) Close()
- func (ss *SqlSupplier) CreateColumnIfNotExists(tableName string, columnName string, mySqlColType string, ...) bool
- func (ss *SqlSupplier) CreateFullTextIndexIfNotExists(indexName string, tableName string, columnName string) bool
- func (ss *SqlSupplier) CreateIndexIfNotExists(indexName string, tableName string, columnName string) bool
- func (ss *SqlSupplier) CreateUniqueIndexIfNotExists(indexName string, tableName string, columnName string) bool
- func (ss *SqlSupplier) DoesColumnExist(tableName string, columnName string) bool
- func (ss *SqlSupplier) DoesTableExist(tableName string) bool
- func (ss *SqlSupplier) DropAllTables()
- func (ss *SqlSupplier) GetAllConns() []*gorp.DbMap
- func (ss *SqlSupplier) GetCurrentSchemaVersion() string
- func (ss *SqlSupplier) GetMaster() *gorp.DbMap
- func (ss *SqlSupplier) GetMaxLengthOfColumnIfExists(tableName string, columnName string) string
- func (ss *SqlSupplier) GetReplica() *gorp.DbMap
- func (ss *SqlSupplier) GetSearchReplica() *gorp.DbMap
- func (ss *SqlSupplier) MarkSystemRanUnitTests()
- func (ss *SqlSupplier) RemoveColumnIfExists(tableName string, columnName string) bool
- func (ss *SqlSupplier) RemoveIndexIfExists(indexName string, tableName string) bool
- func (ss *SqlSupplier) RemoveTableIfExists(tableName string) bool
- func (ss *SqlSupplier) RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool
- func (ss *SqlSupplier) System() SystemStore
- func (ss *SqlSupplier) Token() TokenStore
- func (ss *SqlSupplier) TotalMasterDbConnections() int
- func (ss *SqlSupplier) TotalReadDbConnections() int
- func (ss *SqlSupplier) TotalSearchDbConnections() int
- func (ss *SqlSupplier) User() UserStore
- type SqlSupplierOldStores
- type SqlSupplierResult
- type SqlSystemStore
- func (s SqlSystemStore) CreateIndexesIfNotExists()
- func (s SqlSystemStore) Get() StoreChannel
- func (s SqlSystemStore) GetByName(name string) StoreChannel
- func (s SqlSystemStore) Save(system *model.System) StoreChannel
- func (s SqlSystemStore) SaveOrUpdate(system *model.System) StoreChannel
- func (s SqlSystemStore) Update(system *model.System) StoreChannel
- type SqlTokenStore
- func (s SqlTokenStore) Cleanup()
- func (s SqlTokenStore) CreateIndexesIfNotExists()
- func (s SqlTokenStore) Delete(token string) StoreChannel
- func (s SqlTokenStore) GetByExtra(extra string) StoreChannel
- func (s SqlTokenStore) GetByToken(tokenString string) StoreChannel
- func (s SqlTokenStore) GetTokenCountByExtra(extra string) StoreChannel
- func (s SqlTokenStore) Save(token *model.Token) StoreChannel
- type SqlUserStore
- func (us SqlUserStore) CreateIndexesIfNotExists()
- func (us SqlUserStore) Get(id string) StoreChannel
- func (us SqlUserStore) GetByAuth(authData *string, authService string) StoreChannel
- func (us SqlUserStore) GetByEmail(email string) StoreChannel
- func (us SqlUserStore) GetByUsername(username string) StoreChannel
- func (us SqlUserStore) GetForLogin(loginId string, ...) StoreChannel
- func (us SqlUserStore) GetProfileByMobile(mobile string) StoreChannel
- func (us SqlUserStore) GetTotalUsersCount() StoreChannel
- func (us SqlUserStore) Save(user *model.User) StoreChannel
- func (us SqlUserStore) SearchUsers(term string, options map[string]bool) StoreChannel
- func (us SqlUserStore) Update(user *model.User, trustedUpdateData bool) StoreChannel
- func (us SqlUserStore) UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel
- func (us SqlUserStore) UpdateLastPictureUpdate(userId string) StoreChannel
- func (us SqlUserStore) UpdatePassword(userId, hashedPassword string) StoreChannel
- type Store
- type StoreChannel
- type StoreResult
- type SystemStore
- type TokenStore
- type UserStore
Constants ¶
View Source
const ( INDEX_TYPE_FULL_TEXT = "full_text" INDEX_TYPE_DEFAULT = "default" MAX_DB_CONN_LIFETIME = 60 DB_PING_ATTEMPTS = 18 DB_PING_TIMEOUT_SECS = 10 )
View Source
const ( EXIT_CREATE_TABLE = 100 EXIT_DB_OPEN = 101 EXIT_PING = 102 EXIT_NO_DRIVER = 103 EXIT_TABLE_EXISTS = 104 EXIT_TABLE_EXISTS_MYSQL = 105 EXIT_COLUMN_EXISTS = 106 EXIT_DOES_COLUMN_EXISTS_POSTGRES = 107 EXIT_DOES_COLUMN_EXISTS_MYSQL = 108 EXIT_DOES_COLUMN_EXISTS_MISSING = 109 EXIT_CREATE_COLUMN_POSTGRES = 110 EXIT_CREATE_COLUMN_MYSQL = 111 EXIT_CREATE_COLUMN_MISSING = 112 EXIT_REMOVE_COLUMN = 113 EXIT_RENAME_COLUMN = 114 EXIT_MAX_COLUMN = 115 EXIT_ALTER_COLUMN = 116 EXIT_CREATE_INDEX_POSTGRES = 117 EXIT_CREATE_INDEX_MYSQL = 118 EXIT_CREATE_INDEX_FULL_MYSQL = 119 EXIT_CREATE_INDEX_MISSING = 120 EXIT_REMOVE_INDEX_POSTGRES = 121 EXIT_REMOVE_INDEX_MYSQL = 122 EXIT_REMOVE_INDEX_MISSING = 123 EXIT_REMOVE_TABLE = 134 )
View Source
const ( VERSION_0_0_0 = "0.0.0" VERSION_4_0_0 = "4.0.0" OLDEST_SUPPORTED_VERSION = "0.0.0" )
View Source
const ( EXIT_VERSION_SAVE_MISSING = 1001 EXIT_TOO_OLD = 1002 EXIT_VERSION_SAVE = 1003 EXIT_THEME_MIGRATION = 1004 )
View Source
const ( MISSING_ACCOUNT_ERROR = "store.sql_user.missing_account.const" MISSING_AUTH_ACCOUNT_ERROR = "store.sql_user.get_by_auth.missing_account.app_error" USER_SEARCH_TYPE_NAMES_NO_FULL_NAME = "Username, Nickname" USER_SEARCH_OPTION_ALLOW_INACTIVE = "allow_inactive" USER_SEARCH_TYPE_NAMES = "Username, FirstName, LastName, Nickname" USER_SEARCH_TYPE_ALL_NO_FULL_NAME = "Username, Nickname, Email" USER_SEARCH_TYPE_ALL = "Username, FirstName, LastName, Nickname, Email, Mobile" )
Variables ¶
This section is empty.
Functions ¶
func IsUniqueConstraintError ¶
func Must ¶
func Must(sc StoreChannel) interface{}
func UpgradeDatabase ¶
func UpgradeDatabase(sqlStore SqlStore)
func UpgradeDatabaseToVersion1 ¶
func UpgradeDatabaseToVersion1(sqlStore SqlStore)
Types ¶
type LayeredStore ¶
type LayeredStore struct { TmpContext context.Context DatabaseLayer *SqlSupplier }
func (*LayeredStore) Close ¶
func (s *LayeredStore) Close()
func (*LayeredStore) DropAllTables ¶
func (s *LayeredStore) DropAllTables()
func (*LayeredStore) MarkSystemRanUnitTests ¶
func (s *LayeredStore) MarkSystemRanUnitTests()
func (*LayeredStore) System ¶
func (s *LayeredStore) System() SystemStore
func (*LayeredStore) Token ¶
func (s *LayeredStore) Token() TokenStore
func (*LayeredStore) TotalMasterDbConnections ¶
func (s *LayeredStore) TotalMasterDbConnections() int
func (*LayeredStore) TotalReadDbConnections ¶
func (s *LayeredStore) TotalReadDbConnections() int
func (*LayeredStore) TotalSearchDbConnections ¶
func (s *LayeredStore) TotalSearchDbConnections() int
func (*LayeredStore) User ¶
func (s *LayeredStore) User() UserStore
type SqlStore ¶
type SqlStore interface { GetCurrentSchemaVersion() string GetMaster() *gorp.DbMap GetSearchReplica() *gorp.DbMap GetReplica() *gorp.DbMap TotalMasterDbConnections() int TotalReadDbConnections() int TotalSearchDbConnections() int MarkSystemRanUnitTests() DoesTableExist(tablename string) bool DoesColumnExist(tableName string, columName string) bool CreateColumnIfNotExists(tableName string, columnName string, mySqlColType string, postgresColType string, defaultValue string) bool RemoveColumnIfExists(tableName string, columnName string) bool RemoveTableIfExists(tableName string) bool RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool GetMaxLengthOfColumnIfExists(tableName string, columnName string) string AlterColumnTypeIfExists(tableName string, columnName string, mySqlColType string, postgresColType string) bool CreateUniqueIndexIfNotExists(indexName string, tableName string, columnName string) bool CreateIndexIfNotExists(indexName string, tableName string, columnName string) bool CreateFullTextIndexIfNotExists(indexName string, tableName string, columnName string) bool RemoveIndexIfExists(indexName string, tableName string) bool GetAllConns() []*gorp.DbMap Close() User() UserStore System() SystemStore Token() TokenStore }
type SqlSupplier ¶
type SqlSupplier struct {
// contains filtered or unexported fields
}
func NewSqlSupplier ¶
func NewSqlSupplier() *SqlSupplier
func (*SqlSupplier) AlterColumnTypeIfExists ¶
func (*SqlSupplier) Close ¶
func (ss *SqlSupplier) Close()
func (*SqlSupplier) CreateColumnIfNotExists ¶
func (*SqlSupplier) CreateFullTextIndexIfNotExists ¶
func (ss *SqlSupplier) CreateFullTextIndexIfNotExists(indexName string, tableName string, columnName string) bool
func (*SqlSupplier) CreateIndexIfNotExists ¶
func (ss *SqlSupplier) CreateIndexIfNotExists(indexName string, tableName string, columnName string) bool
func (*SqlSupplier) CreateUniqueIndexIfNotExists ¶
func (ss *SqlSupplier) CreateUniqueIndexIfNotExists(indexName string, tableName string, columnName string) bool
func (*SqlSupplier) DoesColumnExist ¶
func (ss *SqlSupplier) DoesColumnExist(tableName string, columnName string) bool
func (*SqlSupplier) DoesTableExist ¶
func (ss *SqlSupplier) DoesTableExist(tableName string) bool
func (*SqlSupplier) DropAllTables ¶
func (ss *SqlSupplier) DropAllTables()
func (*SqlSupplier) GetAllConns ¶
func (ss *SqlSupplier) GetAllConns() []*gorp.DbMap
func (*SqlSupplier) GetCurrentSchemaVersion ¶
func (ss *SqlSupplier) GetCurrentSchemaVersion() string
func (*SqlSupplier) GetMaster ¶
func (ss *SqlSupplier) GetMaster() *gorp.DbMap
func (*SqlSupplier) GetMaxLengthOfColumnIfExists ¶
func (ss *SqlSupplier) GetMaxLengthOfColumnIfExists(tableName string, columnName string) string
func (*SqlSupplier) GetReplica ¶
func (ss *SqlSupplier) GetReplica() *gorp.DbMap
func (*SqlSupplier) GetSearchReplica ¶
func (ss *SqlSupplier) GetSearchReplica() *gorp.DbMap
func (*SqlSupplier) MarkSystemRanUnitTests ¶
func (ss *SqlSupplier) MarkSystemRanUnitTests()
func (*SqlSupplier) RemoveColumnIfExists ¶
func (ss *SqlSupplier) RemoveColumnIfExists(tableName string, columnName string) bool
func (*SqlSupplier) RemoveIndexIfExists ¶
func (ss *SqlSupplier) RemoveIndexIfExists(indexName string, tableName string) bool
func (*SqlSupplier) RemoveTableIfExists ¶
func (ss *SqlSupplier) RemoveTableIfExists(tableName string) bool
func (*SqlSupplier) RenameColumnIfExists ¶
func (*SqlSupplier) System ¶
func (ss *SqlSupplier) System() SystemStore
func (*SqlSupplier) Token ¶
func (ss *SqlSupplier) Token() TokenStore
func (*SqlSupplier) TotalMasterDbConnections ¶
func (ss *SqlSupplier) TotalMasterDbConnections() int
func (*SqlSupplier) TotalReadDbConnections ¶
func (ss *SqlSupplier) TotalReadDbConnections() int
func (*SqlSupplier) TotalSearchDbConnections ¶
func (ss *SqlSupplier) TotalSearchDbConnections() int
func (*SqlSupplier) User ¶
func (ss *SqlSupplier) User() UserStore
type SqlSupplierOldStores ¶
type SqlSupplierOldStores struct {
// contains filtered or unexported fields
}
type SqlSupplierResult ¶
type SqlSystemStore ¶
type SqlSystemStore struct {
SqlStore
}
func (SqlSystemStore) CreateIndexesIfNotExists ¶
func (s SqlSystemStore) CreateIndexesIfNotExists()
func (SqlSystemStore) Get ¶
func (s SqlSystemStore) Get() StoreChannel
func (SqlSystemStore) GetByName ¶
func (s SqlSystemStore) GetByName(name string) StoreChannel
func (SqlSystemStore) Save ¶
func (s SqlSystemStore) Save(system *model.System) StoreChannel
func (SqlSystemStore) SaveOrUpdate ¶
func (s SqlSystemStore) SaveOrUpdate(system *model.System) StoreChannel
func (SqlSystemStore) Update ¶
func (s SqlSystemStore) Update(system *model.System) StoreChannel
type SqlTokenStore ¶
type SqlTokenStore struct {
SqlStore
}
func (SqlTokenStore) Cleanup ¶
func (s SqlTokenStore) Cleanup()
func (SqlTokenStore) CreateIndexesIfNotExists ¶
func (s SqlTokenStore) CreateIndexesIfNotExists()
func (SqlTokenStore) Delete ¶
func (s SqlTokenStore) Delete(token string) StoreChannel
func (SqlTokenStore) GetByExtra ¶
func (s SqlTokenStore) GetByExtra(extra string) StoreChannel
func (SqlTokenStore) GetByToken ¶
func (s SqlTokenStore) GetByToken(tokenString string) StoreChannel
func (SqlTokenStore) GetTokenCountByExtra ¶
func (s SqlTokenStore) GetTokenCountByExtra(extra string) StoreChannel
func (SqlTokenStore) Save ¶
func (s SqlTokenStore) Save(token *model.Token) StoreChannel
type SqlUserStore ¶
type SqlUserStore struct {
SqlStore
}
func (SqlUserStore) CreateIndexesIfNotExists ¶
func (us SqlUserStore) CreateIndexesIfNotExists()
func (SqlUserStore) Get ¶
func (us SqlUserStore) Get(id string) StoreChannel
func (SqlUserStore) GetByAuth ¶
func (us SqlUserStore) GetByAuth(authData *string, authService string) StoreChannel
func (SqlUserStore) GetByEmail ¶
func (us SqlUserStore) GetByEmail(email string) StoreChannel
func (SqlUserStore) GetByUsername ¶
func (us SqlUserStore) GetByUsername(username string) StoreChannel
func (SqlUserStore) GetForLogin ¶
func (us SqlUserStore) GetForLogin(loginId string, allowSignInWithUsername, allowSignInWithEmail, allowSignInWithMobile, weixinEnabled bool) StoreChannel
func (SqlUserStore) GetProfileByMobile ¶
func (us SqlUserStore) GetProfileByMobile(mobile string) StoreChannel
func (SqlUserStore) GetTotalUsersCount ¶
func (us SqlUserStore) GetTotalUsersCount() StoreChannel
func (SqlUserStore) Save ¶
func (us SqlUserStore) Save(user *model.User) StoreChannel
func (SqlUserStore) SearchUsers ¶
func (us SqlUserStore) SearchUsers(term string, options map[string]bool) StoreChannel
func (SqlUserStore) Update ¶
func (us SqlUserStore) Update(user *model.User, trustedUpdateData bool) StoreChannel
func (SqlUserStore) UpdateFailedPasswordAttempts ¶
func (us SqlUserStore) UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel
func (SqlUserStore) UpdateLastPictureUpdate ¶
func (us SqlUserStore) UpdateLastPictureUpdate(userId string) StoreChannel
func (SqlUserStore) UpdatePassword ¶
func (us SqlUserStore) UpdatePassword(userId, hashedPassword string) StoreChannel
type Store ¶
type Store interface { User() UserStore System() SystemStore Token() TokenStore Close() }
func NewLayeredStore ¶
func NewLayeredStore() Store
type StoreChannel ¶
type StoreChannel chan StoreResult
type StoreResult ¶
type SystemStore ¶
type SystemStore interface { Save(system *model.System) StoreChannel SaveOrUpdate(system *model.System) StoreChannel Update(system *model.System) StoreChannel Get() StoreChannel GetByName(name string) StoreChannel }
func NewSqlSystemStore ¶
func NewSqlSystemStore(sqlStore SqlStore) SystemStore
type TokenStore ¶
type TokenStore interface { Save(recovery *model.Token) StoreChannel Delete(token string) StoreChannel GetByToken(token string) StoreChannel GetByExtra(extra string) StoreChannel GetTokenCountByExtra(extra string) StoreChannel Cleanup() }
func NewSqlTokenStore ¶
func NewSqlTokenStore(sqlStore SqlStore) TokenStore
type UserStore ¶
type UserStore interface { Save(user *model.User) StoreChannel Update(user *model.User, allowRoleUpdate bool) StoreChannel Get(id string) StoreChannel GetByEmail(email string) StoreChannel GetByUsername(username string) StoreChannel GetForLogin(loginId string, allowSignInWithUsername, allowSignInWithEmail, allowSignInWithMobile, weixinEnabled bool) StoreChannel GetTotalUsersCount() StoreChannel UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel GetByAuth(authData *string, authService string) StoreChannel UpdateLastPictureUpdate(userId string) StoreChannel GetProfileByMobile(mobile string) StoreChannel UpdatePassword(userId, hashedPassword string) StoreChannel SearchUsers(term string, options map[string]bool) StoreChannel }
func NewSqlUserStore ¶
Click to show internal directories.
Click to hide internal directories.