Documentation
¶
Overview ¶
Copyright (c) 2020-present Mattermost, Inc. All Rights Reserved. See LICENSE.txt for license information.
Index ¶
- Constants
- Variables
- func PrepareNewTestDatabase() (dbType string, connectionString string, err error)
- type BlockDoesntBelongToBoardsErr
- type ErrInvalidDBType
- type ErrStoreParam
- type MutexFactory
- type Number
- type Params
- type RetentionTableDeletionInfo
- type SQLStore
- func (s *SQLStore) AddUpdateCategoryBoard(userID string, categoryID string, boardIDs []string) error
- func (s *SQLStore) CanSeeUser(seerID string, seenID string) (bool, error)
- func (s *SQLStore) CloseRows(rows *sql.Rows)
- func (s *SQLStore) CreateBoardsAndBlocks(bab *model.BoardsAndBlocks, userID string) (*model.BoardsAndBlocks, error)
- func (s *SQLStore) CreateBoardsAndBlocksWithAdmin(bab *model.BoardsAndBlocks, userID string) (*model.BoardsAndBlocks, []*model.BoardMember, error)
- func (s *SQLStore) CreateCategory(category model.Category) error
- func (s *SQLStore) CreateSubscription(sub *model.Subscription) (*model.Subscription, error)
- func (s *SQLStore) DBHandle() *sql.DB
- func (s *SQLStore) DBType() string
- func (s *SQLStore) DBVersion() string
- func (s *SQLStore) DeleteBlock(blockID string, modifiedBy string) error
- func (s *SQLStore) DeleteBlockRecord(blockID string, modifiedBy string) error
- func (s *SQLStore) DeleteBoard(boardID string, userID string) error
- func (s *SQLStore) DeleteBoardRecord(boardID string, modifiedBy string) error
- func (s *SQLStore) DeleteBoardsAndBlocks(dbab *model.DeleteBoardsAndBlocks, userID string) error
- func (s *SQLStore) DeleteCategory(categoryID string, userID string, teamID string) error
- func (s *SQLStore) DeleteMember(boardID string, userID string) error
- func (s *SQLStore) DeleteNotificationHint(blockID string) error
- func (s *SQLStore) DeleteSubscription(blockID string, subscriberID string) error
- func (s *SQLStore) DuplicateBlock(boardID string, blockID string, userID string, asTemplate bool) ([]*model.Block, error)
- func (s *SQLStore) DuplicateBoard(boardID string, userID string, toTeam string, asTemplate bool) (*model.BoardsAndBlocks, []*model.BoardMember, error)
- func (s *SQLStore) EnsureSchemaMigrationFormat() error
- func (s *SQLStore) GetActiveUserCount(updatedSecondsAgo int64) (int, error)
- func (s *SQLStore) GetAllTeams() ([]*model.Team, error)
- func (s *SQLStore) GetBlock(blockID string) (*model.Block, error)
- func (s *SQLStore) GetBlockCountsByType() (map[string]int64, error)
- func (s *SQLStore) GetBlockHistory(blockID string, opts model.QueryBlockHistoryOptions) ([]*model.Block, error)
- func (s *SQLStore) GetBlockHistoryDescendants(boardID string, opts model.QueryBlockHistoryOptions) ([]*model.Block, error)
- func (s *SQLStore) GetBlockHistoryNewestChildren(parentID string, opts model.QueryBlockHistoryChildOptions) ([]*model.Block, bool, error)
- func (s *SQLStore) GetBlocks(opts model.QueryBlocksOptions) ([]*model.Block, error)
- func (s *SQLStore) GetBlocksByIDs(ids []string) ([]*model.Block, error)
- func (s *SQLStore) GetBlocksComplianceHistory(opts model.QueryBlocksComplianceHistoryOptions) ([]*model.BlockHistory, bool, error)
- func (s *SQLStore) GetBlocksForBoard(boardID string) ([]*model.Block, error)
- func (s *SQLStore) GetBlocksWithParent(boardID string, parentID string) ([]*model.Block, error)
- func (s *SQLStore) GetBlocksWithParentAndType(boardID string, parentID string, blockType string) ([]*model.Block, error)
- func (s *SQLStore) GetBlocksWithType(boardID string, blockType string) ([]*model.Block, error)
- func (s *SQLStore) GetBoard(id string) (*model.Board, error)
- func (s *SQLStore) GetBoardAndCard(block *model.Block) (*model.Board, *model.Block, error)
- func (s *SQLStore) GetBoardAndCardByID(blockID string) (*model.Board, *model.Block, error)
- func (s *SQLStore) GetBoardCount(includeDeleted bool) (int64, error)
- func (s *SQLStore) GetBoardHistory(boardID string, opts model.QueryBoardHistoryOptions) ([]*model.Board, error)
- func (s *SQLStore) GetBoardMemberHistory(boardID string, userID string, limit uint64) ([]*model.BoardMemberHistoryEntry, error)
- func (s *SQLStore) GetBoardsComplianceHistory(opts model.QueryBoardsComplianceHistoryOptions) ([]*model.BoardHistory, bool, error)
- func (s *SQLStore) GetBoardsForCompliance(opts model.QueryBoardsForComplianceOptions) ([]*model.Board, bool, error)
- func (s *SQLStore) GetBoardsForUserAndTeam(userID string, teamID string, includePublicBoards bool) ([]*model.Board, error)
- func (s *SQLStore) GetBoardsInTeamByIds(boardIDs []string, teamID string) ([]*model.Board, error)
- func (s *SQLStore) GetCardLimitTimestamp() (int64, error)
- func (s *SQLStore) GetCardsCount() (int64, error)
- func (s *SQLStore) GetCategory(id string) (*model.Category, error)
- func (s *SQLStore) GetChannel(teamID string, channelID string) (*mmModel.Channel, error)
- func (s *SQLStore) GetFileInfo(id string) (*mmModel.FileInfo, error)
- func (s *SQLStore) GetLicense() *mmModel.License
- func (s *SQLStore) GetMemberForBoard(boardID string, userID string) (*model.BoardMember, error)
- func (s *SQLStore) GetMembersForBoard(boardID string) ([]*model.BoardMember, error)
- func (s *SQLStore) GetMembersForUser(userID string) ([]*model.BoardMember, error)
- func (s *SQLStore) GetNextNotificationHint(remove bool) (*model.NotificationHint, error)
- func (s *SQLStore) GetNotificationHint(blockID string) (*model.NotificationHint, error)
- func (s *SQLStore) GetRegisteredUserCount() (int, error)
- func (s *SQLStore) GetSchemaName() (string, error)
- func (s *SQLStore) GetSharing(rootID string) (*model.Sharing, error)
- func (s *SQLStore) GetSubTree2(boardID string, blockID string, opts model.QuerySubtreeOptions) ([]*model.Block, error)
- func (s *SQLStore) GetSubscribersCountForBlock(blockID string) (int, error)
- func (s *SQLStore) GetSubscribersForBlock(blockID string) ([]*model.Subscriber, error)
- func (s *SQLStore) GetSubscription(blockID string, subscriberID string) (*model.Subscription, error)
- func (s *SQLStore) GetSubscriptions(subscriberID string) ([]*model.Subscription, error)
- func (s *SQLStore) GetSystemSetting(key string) (string, error)
- func (s *SQLStore) GetSystemSettings() (map[string]string, error)
- func (s *SQLStore) GetTeam(ID string) (*model.Team, error)
- func (s *SQLStore) GetTeamCount() (int64, error)
- func (s *SQLStore) GetTeamsForUser(userID string) ([]*model.Team, error)
- func (s *SQLStore) GetTemplateBoards(teamID string, userID string) ([]*model.Board, error)
- func (s *SQLStore) GetTemplateHelperFuncs() template.FuncMap
- func (s *SQLStore) GetUsedCardsCount() (int64, error)
- func (s *SQLStore) GetUserByEmail(email string) (*model.User, error)
- func (s *SQLStore) GetUserByID(userID string) (*model.User, error)
- func (s *SQLStore) GetUserByUsername(username string) (*model.User, error)
- func (s *SQLStore) GetUserCategories(userID string, teamID string) ([]model.Category, error)
- func (s *SQLStore) GetUserCategoryBoards(userID string, teamID string) ([]model.CategoryBoards, error)
- func (s *SQLStore) GetUserPreferences(userID string) (mmModel.Preferences, error)
- func (s *SQLStore) GetUserTimezone(userID string) (string, error)
- func (s *SQLStore) GetUsersByTeam(teamID string, asGuestID string, showEmail bool, showName bool) ([]*model.User, error)
- func (s *SQLStore) GetUsersList(userIDs []string, showEmail bool, showName bool) ([]*model.User, error)
- func (s *SQLStore) InsertBlock(block *model.Block, userID string) error
- func (s *SQLStore) InsertBlocks(blocks []*model.Block, userID string) error
- func (s *SQLStore) InsertBoard(board *model.Board, userID string) (*model.Board, error)
- func (s *SQLStore) InsertBoardWithAdmin(board *model.Board, userID string) (*model.Board, *model.BoardMember, error)
- func (s *SQLStore) IsErrNotFound(err error) bool
- func (s *SQLStore) IsMariaDB() bool
- func (s *SQLStore) MarshalJSONB(data interface{}) ([]byte, error)
- func (s *SQLStore) Migrate() error
- func (s *SQLStore) PatchBlock(blockID string, blockPatch *model.BlockPatch, userID string) error
- func (s *SQLStore) PatchBlocks(blockPatches *model.BlockPatchBatch, userID string) error
- func (s *SQLStore) PatchBoard(boardID string, boardPatch *model.BoardPatch, userID string) (*model.Board, error)
- func (s *SQLStore) PatchBoardsAndBlocks(pbab *model.PatchBoardsAndBlocks, userID string) (*model.BoardsAndBlocks, error)
- func (s *SQLStore) PatchUserPreferences(userID string, patch model.UserPreferencesPatch) (mmModel.Preferences, error)
- func (s *SQLStore) PostMessage(message string, postType string, channelID string) error
- func (s *SQLStore) RemoveDefaultTemplates(boards []*model.Board) error
- func (s *SQLStore) ReorderCategories(userID string, teamID string, newCategoryOrder []string) ([]string, error)
- func (s *SQLStore) ReorderCategoryBoards(categoryID string, newBoardsOrder []string) ([]string, error)
- func (s *SQLStore) RestoreFiles(fileIDs []string) error
- func (s *SQLStore) RunCategoryUUIDIDMigration() error
- func (s *SQLStore) RunDataRetention(globalRetentionDate int64, batchSize int64) (int64, error)
- func (s *SQLStore) RunDeDuplicateCategoryBoardsMigration(currentMigration int) error
- func (s *SQLStore) RunDeletedMembershipBoardsMigration() error
- func (s *SQLStore) RunFixCollationsAndCharsetsMigration() error
- func (s *SQLStore) RunTeamLessBoardsMigration() error
- func (s *SQLStore) RunUniqueIDsMigration() error
- func (s *SQLStore) SaveFileInfo(fileInfo *mmModel.FileInfo) error
- func (s *SQLStore) SaveMember(bm *model.BoardMember) (*model.BoardMember, error)
- func (s *SQLStore) SearchBoardsForUser(term string, searchField model.BoardSearchField, userID string, ...) ([]*model.Board, error)
- func (s *SQLStore) SearchBoardsForUserInTeam(teamID string, term string, userID string) ([]*model.Board, error)
- func (s *SQLStore) SearchUserChannels(teamID string, userID string, query string) ([]*mmModel.Channel, error)
- func (s *SQLStore) SearchUsersByTeam(teamID string, searchQuery string, asGuestID string, excludeBots bool, ...) ([]*model.User, error)
- func (s *SQLStore) SendMessage(message string, postType string, receipts []string) error
- func (s *SQLStore) SetBoardVisibility(userID string, categoryID string, boardID string, visible bool) error
- func (s *SQLStore) SetSystemSetting(key string, value string) error
- func (s *SQLStore) Shutdown() error
- func (s *SQLStore) UndeleteBlock(blockID string, modifiedBy string) error
- func (s *SQLStore) UndeleteBoard(boardID string, modifiedBy string) error
- func (s *SQLStore) UpdateCardLimitTimestamp(cardLimit int) (int64, error)
- func (s *SQLStore) UpdateCategory(category model.Category) error
- func (s *SQLStore) UpdateSubscribersNotifiedAt(blockID string, notifiedAt int64) error
- func (s *SQLStore) UpsertNotificationHint(hint *model.NotificationHint, notificationFreq time.Duration) (*model.NotificationHint, error)
- func (s *SQLStore) UpsertSharing(sharing model.Sharing) error
- func (s *SQLStore) UpsertTeamSettings(team model.Team) error
- func (s *SQLStore) UpsertTeamSignupToken(team model.Team) error
- type UserNotFoundError
Constants ¶
const ( // we group the inserts on batches of 1000 because PostgreSQL // supports a limit of around 64K values (not rows) on an insert // query, so we want to stay safely below. CategoryInsertBatch = 1000 TemplatesToTeamsMigrationKey = "TemplatesToTeamsMigrationComplete" UniqueIDsMigrationKey = "UniqueIDsMigrationComplete" CategoryUUIDIDMigrationKey = "CategoryUuidIdMigrationComplete" TeamLessBoardsMigrationKey = "TeamLessBoardsMigrationComplete" DeletedMembershipBoardsMigrationKey = "DeletedMembershipBoardsMigrationComplete" DeDuplicateCategoryBoardTableMigrationKey = "DeDuplicateCategoryBoardTableComplete" )
Variables ¶
var Assets embed.FS
var ErrInvalidCardLimitValue = errors.New("card limit value is invalid")
var (
ErrUnsupportedDatabaseType = errors.New("database type is unsupported")
)
Functions ¶
func PrepareNewTestDatabase ¶
Types ¶
type BlockDoesntBelongToBoardsErr ¶
type BlockDoesntBelongToBoardsErr struct {
// contains filtered or unexported fields
}
func (BlockDoesntBelongToBoardsErr) Error ¶
func (e BlockDoesntBelongToBoardsErr) Error() string
type ErrInvalidDBType ¶
type ErrInvalidDBType struct {
// contains filtered or unexported fields
}
func (ErrInvalidDBType) Error ¶
func (e ErrInvalidDBType) Error() string
type ErrStoreParam ¶
type ErrStoreParam struct {
// contains filtered or unexported fields
}
func (ErrStoreParam) Error ¶
func (e ErrStoreParam) Error() string
type MutexFactory ¶
MutexFactory is used by the store in plugin mode to generate a cluster mutex.
type Params ¶
type Params struct {
DBType string
ConnectionString string
DBPingAttempts int
TablePrefix string
Logger mlog.LoggerIFace
DB *sql.DB
NewMutexFn MutexFactory
ServicesAPI servicesAPI
SkipMigrations bool
ConfigFn func() *mmModel.Config
}
func (Params) CheckValid ¶
type SQLStore ¶
type SQLStore struct {
NewMutexFn MutexFactory
// contains filtered or unexported fields
}
SQLStore is a SQL database.
func (*SQLStore) AddUpdateCategoryBoard ¶
func (*SQLStore) CanSeeUser ¶
func (*SQLStore) CreateBoardsAndBlocks ¶
func (s *SQLStore) CreateBoardsAndBlocks(bab *model.BoardsAndBlocks, userID string) (*model.BoardsAndBlocks, error)
func (*SQLStore) CreateBoardsAndBlocksWithAdmin ¶
func (s *SQLStore) CreateBoardsAndBlocksWithAdmin(bab *model.BoardsAndBlocks, userID string) (*model.BoardsAndBlocks, []*model.BoardMember, error)
func (*SQLStore) CreateSubscription ¶
func (s *SQLStore) CreateSubscription(sub *model.Subscription) (*model.Subscription, error)
func (*SQLStore) DBHandle ¶
DBHandle returns the raw sql.DB handle. It is used by the mattermostauthlayer to run their own raw SQL queries.
func (*SQLStore) DeleteBlock ¶
func (*SQLStore) DeleteBlockRecord ¶
func (*SQLStore) DeleteBoardRecord ¶
func (*SQLStore) DeleteBoardsAndBlocks ¶
func (s *SQLStore) DeleteBoardsAndBlocks(dbab *model.DeleteBoardsAndBlocks, userID string) error
func (*SQLStore) DeleteCategory ¶
func (*SQLStore) DeleteMember ¶
func (*SQLStore) DeleteNotificationHint ¶
func (*SQLStore) DeleteSubscription ¶
func (*SQLStore) DuplicateBlock ¶
func (*SQLStore) DuplicateBoard ¶
func (s *SQLStore) DuplicateBoard(boardID string, userID string, toTeam string, asTemplate bool) (*model.BoardsAndBlocks, []*model.BoardMember, error)
func (*SQLStore) EnsureSchemaMigrationFormat ¶
EnsureSchemaMigrationFormat checks the schema migrations table format and, if it's not using the new shape, it migrates the old one's status before initializing the migrations engine.
func (*SQLStore) GetActiveUserCount ¶
func (*SQLStore) GetBlockCountsByType ¶
func (*SQLStore) GetBlockHistory ¶
func (*SQLStore) GetBlockHistoryDescendants ¶
func (*SQLStore) GetBlockHistoryNewestChildren ¶
func (*SQLStore) GetBlocksByIDs ¶
func (*SQLStore) GetBlocksComplianceHistory ¶
func (s *SQLStore) GetBlocksComplianceHistory(opts model.QueryBlocksComplianceHistoryOptions) ([]*model.BlockHistory, bool, error)
func (*SQLStore) GetBlocksForBoard ¶
func (*SQLStore) GetBlocksWithParent ¶
func (*SQLStore) GetBlocksWithParentAndType ¶
func (*SQLStore) GetBlocksWithType ¶
func (*SQLStore) GetBoardAndCard ¶
func (*SQLStore) GetBoardAndCardByID ¶
func (*SQLStore) GetBoardCount ¶
func (*SQLStore) GetBoardHistory ¶
func (*SQLStore) GetBoardMemberHistory ¶
func (*SQLStore) GetBoardsComplianceHistory ¶
func (s *SQLStore) GetBoardsComplianceHistory(opts model.QueryBoardsComplianceHistoryOptions) ([]*model.BoardHistory, bool, error)
func (*SQLStore) GetBoardsForCompliance ¶
func (*SQLStore) GetBoardsForUserAndTeam ¶
func (*SQLStore) GetBoardsInTeamByIds ¶
func (*SQLStore) GetCardLimitTimestamp ¶
func (*SQLStore) GetCardsCount ¶
func (*SQLStore) GetChannel ¶
func (*SQLStore) GetLicense ¶
func (*SQLStore) GetMemberForBoard ¶
func (*SQLStore) GetMembersForBoard ¶
func (s *SQLStore) GetMembersForBoard(boardID string) ([]*model.BoardMember, error)
func (*SQLStore) GetMembersForUser ¶
func (s *SQLStore) GetMembersForUser(userID string) ([]*model.BoardMember, error)
func (*SQLStore) GetNextNotificationHint ¶
func (s *SQLStore) GetNextNotificationHint(remove bool) (*model.NotificationHint, error)
func (*SQLStore) GetNotificationHint ¶
func (s *SQLStore) GetNotificationHint(blockID string) (*model.NotificationHint, error)
func (*SQLStore) GetRegisteredUserCount ¶
func (*SQLStore) GetSchemaName ¶
func (*SQLStore) GetSubTree2 ¶
func (*SQLStore) GetSubscribersCountForBlock ¶
func (*SQLStore) GetSubscribersForBlock ¶
func (s *SQLStore) GetSubscribersForBlock(blockID string) ([]*model.Subscriber, error)
func (*SQLStore) GetSubscription ¶
func (*SQLStore) GetSubscriptions ¶
func (s *SQLStore) GetSubscriptions(subscriberID string) ([]*model.Subscription, error)
func (*SQLStore) GetSystemSettings ¶
func (*SQLStore) GetTeamCount ¶
func (*SQLStore) GetTeamsForUser ¶
func (*SQLStore) GetTemplateBoards ¶
func (*SQLStore) GetTemplateHelperFuncs ¶
func (*SQLStore) GetUsedCardsCount ¶
func (*SQLStore) GetUserByEmail ¶
func (*SQLStore) GetUserByUsername ¶
func (*SQLStore) GetUserCategories ¶
func (*SQLStore) GetUserCategoryBoards ¶
func (*SQLStore) GetUserPreferences ¶
func (s *SQLStore) GetUserPreferences(userID string) (mmModel.Preferences, error)
func (*SQLStore) GetUserTimezone ¶
func (*SQLStore) GetUsersByTeam ¶
func (*SQLStore) GetUsersList ¶
func (*SQLStore) InsertBlock ¶
func (*SQLStore) InsertBlocks ¶
func (*SQLStore) InsertBoard ¶
func (*SQLStore) InsertBoardWithAdmin ¶
func (*SQLStore) IsErrNotFound ¶
func (*SQLStore) MarshalJSONB ¶
func (*SQLStore) PatchBlock ¶
func (*SQLStore) PatchBlocks ¶
func (s *SQLStore) PatchBlocks(blockPatches *model.BlockPatchBatch, userID string) error
func (*SQLStore) PatchBoard ¶
func (*SQLStore) PatchBoardsAndBlocks ¶
func (s *SQLStore) PatchBoardsAndBlocks(pbab *model.PatchBoardsAndBlocks, userID string) (*model.BoardsAndBlocks, error)
func (*SQLStore) PatchUserPreferences ¶
func (s *SQLStore) PatchUserPreferences(userID string, patch model.UserPreferencesPatch) (mmModel.Preferences, error)
func (*SQLStore) PostMessage ¶
func (*SQLStore) RemoveDefaultTemplates ¶
func (*SQLStore) ReorderCategories ¶
func (*SQLStore) ReorderCategoryBoards ¶
func (*SQLStore) RestoreFiles ¶
func (*SQLStore) RunCategoryUUIDIDMigration ¶
RunCategoryUUIDIDMigration takes care of deriving the categories from the boards and its memberships. The name references UUID because of the preexisting purpose of this migration, and has been preserved for compatibility with already migrated instances.
func (*SQLStore) RunDataRetention ¶
func (*SQLStore) RunDeDuplicateCategoryBoardsMigration ¶
func (*SQLStore) RunDeletedMembershipBoardsMigration ¶
func (*SQLStore) RunFixCollationsAndCharsetsMigration ¶
func (*SQLStore) RunTeamLessBoardsMigration ¶
We no longer support boards existing in DMs and private group messages. This function migrates all boards belonging to a DM to the best possible team.
func (*SQLStore) RunUniqueIDsMigration ¶
func (*SQLStore) SaveMember ¶
func (s *SQLStore) SaveMember(bm *model.BoardMember) (*model.BoardMember, error)
func (*SQLStore) SearchBoardsForUser ¶
func (*SQLStore) SearchBoardsForUserInTeam ¶
func (*SQLStore) SearchUserChannels ¶
func (*SQLStore) SearchUsersByTeam ¶
func (*SQLStore) SendMessage ¶
func (*SQLStore) SetBoardVisibility ¶
func (*SQLStore) SetSystemSetting ¶
func (*SQLStore) UndeleteBlock ¶
func (*SQLStore) UndeleteBoard ¶
func (*SQLStore) UpdateCardLimitTimestamp ¶
func (*SQLStore) UpdateSubscribersNotifiedAt ¶
func (*SQLStore) UpsertNotificationHint ¶
func (s *SQLStore) UpsertNotificationHint(hint *model.NotificationHint, notificationFreq time.Duration) (*model.NotificationHint, error)
type UserNotFoundError ¶
type UserNotFoundError struct {
// contains filtered or unexported fields
}
func (UserNotFoundError) Error ¶
func (unf UserNotFoundError) Error() string
Source Files
¶
- blocks.go
- board.go
- boards_and_blocks.go
- category.go
- category_boards.go
- channels.go
- cloud.go
- compliance.go
- data_migrations.go
- data_retention.go
- files.go
- legacy_blocks.go
- licenses.go
- messages.go
- migrate.go
- notificationhints.go
- params.go
- public_methods.go
- schema_table_migration.go
- sharing.go
- sqlstore.go
- subscriptions.go
- system.go
- team.go
- templates.go
- user.go
- util.go