sqlstore

package
v5.39.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2021 License: AGPL-3.0, Apache-2.0 Imports: 40 Imported by: 10

Documentation

Index

Constants

View Source
const (
	AllChannelMembersForUserCacheSize     = model.SESSION_CACHE_SIZE
	AllChannelMembersForUserCacheDuration = 15 * time.Minute // 15 mins

	AllChannelMembersNotifyPropsForChannelCacheSize     = model.SESSION_CACHE_SIZE
	AllChannelMembersNotifyPropsForChannelCacheDuration = 30 * time.Minute // 30 mins

	ChannelCacheDuration = 15 * time.Minute // 15 mins
)
View Source
const (
	IndexTypeFullText                 = "full_text"
	IndexTypeFullTextFunc             = "full_text_func"
	IndexTypeDefault                  = "default"
	PGDupTableErrorCode               = "42P07"      // see https://github.com/lib/pq/blob/master/error.go#L268
	MySQLDupTableErrorCode            = uint16(1050) // see https://dev.mysql.com/doc/mysql-errors/5.7/en/server-error-reference.html#error_er_table_exists_error
	PGForeignKeyViolationErrorCode    = "23503"
	MySQLForeignKeyViolationErrorCode = 1452
	PGDuplicateObjectErrorCode        = "42710"
	MySQLDuplicateObjectErrorCode     = 1022
	DBPingAttempts                    = 18
	DBPingTimeoutSecs                 = 10
	// This is a numerical version string by postgres. The format is
	// 2 characters for major, minor, and patch version prior to 10.
	// After 10, it's major and minor only.
	// 10.1 would be 100001.
	// 9.6.3 would be 90603.
	MinimumRequiredPostgresVersion = 100000
)
View Source
const (
	ExitGenericFailure           = 1
	ExitCreateTable              = 100
	ExitDBOpen                   = 101
	ExitPing                     = 102
	ExitNoDriver                 = 103
	ExitTableExists              = 104
	ExitTableExistsMySQL         = 105
	ExitColumnExists             = 106
	ExitDoesColumnExistsPostgres = 107
	ExitDoesColumnExistsMySQL    = 108
	ExitDoesColumnExistsMissing  = 109
	ExitCreateColumnPostgres     = 110
	ExitCreateColumnMySQL        = 111
	ExitCreateColumnMissing      = 112
	ExitRemoveColumn             = 113
	ExitRenameColumn             = 114
	ExitMaxColumn                = 115
	ExitAlterColumn              = 116
	ExitCreateIndexPostgres      = 117
	ExitCreateIndexMySQL         = 118
	ExitCreateIndexFullMySQL     = 119
	ExitCreateIndexMissing       = 120
	ExitRemoveIndexPostgres      = 121
	ExitRemoveIndexMySQL         = 122
	ExitRemoveIndexMissing       = 123
	ExitDoesIndexExists          = 124
	ExitDoesIndexExistsMySQL     = 125
	ExitRemoveTable              = 134
	ExitAlterPrimaryKey          = 139
)
View Source
const (
	CurrentSchemaVersion   = Version5390
	Version5390            = "5.39.0"
	Version5380            = "5.38.0"
	Version5370            = "5.37.0"
	Version5360            = "5.36.0"
	Version5350            = "5.35.0"
	Version5340            = "5.34.0"
	Version5330            = "5.33.0"
	Version5320            = "5.32.0"
	Version5310            = "5.31.0"
	Version5300            = "5.30.0"
	Version5291            = "5.29.1"
	Version5290            = "5.29.0"
	Version5281            = "5.28.1"
	Version5280            = "5.28.0"
	Version5270            = "5.27.0"
	Version5260            = "5.26.0"
	Version5250            = "5.25.0"
	Version5240            = "5.24.0"
	Version5230            = "5.23.0"
	Version5220            = "5.22.0"
	Version5210            = "5.21.0"
	Version5200            = "5.20.0"
	Version5190            = "5.19.0"
	Version5180            = "5.18.0"
	Version5170            = "5.17.0"
	Version5160            = "5.16.0"
	Version5150            = "5.15.0"
	Version5140            = "5.14.0"
	Version5130            = "5.13.0"
	Version5120            = "5.12.0"
	Version5110            = "5.11.0"
	Version5100            = "5.10.0"
	Version590             = "5.9.0"
	Version580             = "5.8.0"
	Version570             = "5.7.0"
	Version560             = "5.6.0"
	Version550             = "5.5.0"
	Version540             = "5.4.0"
	Version530             = "5.3.0"
	Version520             = "5.2.0"
	Version510             = "5.1.0"
	Version500             = "5.0.0"
	Version4100            = "4.10.0"
	Version490             = "4.9.0"
	Version481             = "4.8.1"
	Version480             = "4.8.0"
	Version472             = "4.7.2"
	Version471             = "4.7.1"
	Version470             = "4.7.0"
	Version460             = "4.6.0"
	Version450             = "4.5.0"
	Version440             = "4.4.0"
	Version430             = "4.3.0"
	Version420             = "4.2.0"
	Version410             = "4.1.0"
	Version400             = "4.0.0"
	Version3100            = "3.10.0"
	Version390             = "3.9.0"
	Version380             = "3.8.0"
	Version370             = "3.7.0"
	Version360             = "3.6.0"
	Version350             = "3.5.0"
	Version340             = "3.4.0"
	Version330             = "3.3.0"
	Version320             = "3.2.0"
	Version310             = "3.1.0"
	Version300             = "3.0.0"
	OldestSupportedVersion = Version300
)
View Source
const (
	ExitVersionSave                 = 1003
	ExitThemeMigration              = 1004
	ExitTeamInviteIDMigrationFailed = 1006
)
View Source
const (
	DefaultGetUsersForSyncLimit = 100
)
View Source
const (
	MaxGroupChannelsForProfiles = 50
)
View Source
const RemoteClusterSiteURLUniqueIndex = "remote_clusters_site_url_unique"
View Source
const (
	SessionsCleanupDelayMilliseconds = 100
)
View Source
const (
	TeamMemberExistsError = "store.sql_team.save_member.exists.app_error"
)
View Source
const (
	UpdatePostHasReactionsOnDeleteQuery = `` /* 178-byte string literal not displayed */

)

Variables

View Source
var (
	UserSearchTypeNames_NO_FULL_NAME = []string{"Username", "Nickname"}
	UserSearchTypeNames              = []string{"Username", "FirstName", "LastName", "Nickname"}
	UserSearchTypeAll_NO_FULL_NAME   = []string{"Username", "Nickname", "Email"}
	UserSearchTypeAll                = []string{"Username", "FirstName", "LastName", "Nickname", "Email"}
)
View Source
var ChannelMembersWithSchemeSelectQuery = `` /* 710-byte string literal not displayed */

Functions

func CheckRelationalIntegrity

func CheckRelationalIntegrity(ss *SqlStore, results chan<- model.IntegrityCheckResult)

func IsConstraintAlreadyExistsError added in v5.36.0

func IsConstraintAlreadyExistsError(err error) bool

func IsDuplicate added in v5.31.0

func IsDuplicate(err error) bool

IsDuplicate checks whether an error is a duplicate key error, which comes when processes are competing on creating the same tables in the database.

func IsUniqueConstraintError

func IsUniqueConstraintError(err error, indexName []string) bool

func MapStringsToQueryParams

func MapStringsToQueryParams(list []string, paramPrefix string) (string, map[string]interface{})

Converts a list of strings into a list of query parameters and a named parameter map that can be used as part of a SQL query.

func NewChannelMemberFromModel

func NewChannelMemberFromModel(cm *model.ChannelMember) *channelMember

func NewTeamMemberFromModel

func NewTeamMemberFromModel(tm *model.TeamMember) *teamMember

func VersionString added in v5.32.0

func VersionString(v int) string

VersionString converts an integer representation of a DB version to a pretty-printed string. Postgres doesn't follow three-part version numbers from 10.0 onwards: https://www.postgresql.org/docs/13/libpq-status.html#LIBPQ-PQSERVERVERSION.

func WithMaster added in v5.31.2

func WithMaster(ctx context.Context) context.Context

WithMaster adds the context value that master DB should be selected for this request.

Types

type ColumnInfo added in v5.30.0

type ColumnInfo struct {
	DataType          string
	CharMaximumLength int
}

ColumnInfo holds information about a column.

type JSONSerializable

type JSONSerializable interface {
	ToJson() string
}

type RetentionPolicyBatchDeletionInfo added in v5.38.0

type RetentionPolicyBatchDeletionInfo struct {
	BaseBuilder         sq.SelectBuilder
	Table               string
	TimeColumn          string
	PrimaryKeys         []string
	ChannelIDTable      string
	NowMillis           int64
	GlobalPolicyEndTime int64
	Limit               int64
}

RetentionPolicyBatchDeletionInfo gives information on how to delete records under a retention policy; see `genericPermanentDeleteBatchForRetentionPolicies`.

`BaseBuilder` should already have selected the primary key(s) for the main table and should be joined to a table with a ChannelId column, which will be used to join on the Channels table. `Table` is the name of the table from which records are being deleted. `TimeColumn` is the name of the column which contains the timestamp of the record. `PrimaryKeys` contains the primary keys of `table`. It should be the same as the `From` clause in `baseBuilder`. `ChannelIDTable` is the table which contains the ChannelId column, it may be the same as `table`, or will be different if a join was used. `NowMillis` must be a Unix timestamp in milliseconds and is used by the granular policies; if `nowMillis - timestamp(record)` is greater than the post duration of a granular policy, than the record will be deleted. `GlobalPolicyEndTime` is used by the global policy; any record older than this time will be deleted by the global policy if it does not fall under a granular policy. To disable the granular policies, set `NowMillis` to 0. To disable the global policy, set `GlobalPolicyEndTime` to 0.

type Role

type Role struct {
	Id            string
	Name          string
	DisplayName   string
	Description   string
	CreateAt      int64
	UpdateAt      int64
	DeleteAt      int64
	Permissions   string
	SchemeManaged bool
	BuiltIn       bool
}

func NewRoleFromModel

func NewRoleFromModel(role *model.Role) *Role

func (Role) ToModel

func (role Role) ToModel() *model.Role

type SqlAuditStore

type SqlAuditStore struct {
	*SqlStore
}

func (SqlAuditStore) Get

func (s SqlAuditStore) Get(userId string, offset int, limit int) (model.Audits, error)

func (SqlAuditStore) PermanentDeleteByUser

func (s SqlAuditStore) PermanentDeleteByUser(userId string) error

func (SqlAuditStore) Save

func (s SqlAuditStore) Save(audit *model.Audit) error

type SqlBotStore

type SqlBotStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

SqlBotStore is a store for managing bots in the database. Bots are otherwise normal users with extra metadata record in the Bots table. The primary key for a bot matches the primary key value for corresponding User record.

func (SqlBotStore) Get

func (us SqlBotStore) Get(botUserId string, includeDeleted bool) (*model.Bot, error)

Get fetches the given bot in the database.

func (SqlBotStore) GetAll

func (us SqlBotStore) GetAll(options *model.BotGetOptions) ([]*model.Bot, error)

GetAll fetches from all bots in the database.

func (SqlBotStore) PermanentDelete

func (us SqlBotStore) PermanentDelete(botUserId string) error

PermanentDelete removes the bot from the database altogether. If the corresponding user is to be deleted, it must be done via the user store.

func (SqlBotStore) Save

func (us SqlBotStore) Save(bot *model.Bot) (*model.Bot, error)

Save persists a new bot to the database. It assumes the corresponding user was saved via the user store.

func (SqlBotStore) Update

func (us SqlBotStore) Update(bot *model.Bot) (*model.Bot, error)

Update persists an updated bot to the database. It assumes the corresponding user was updated via the user store.

type SqlChannelMemberHistoryStore

type SqlChannelMemberHistoryStore struct {
	*SqlStore
}

func (SqlChannelMemberHistoryStore) DeleteOrphanedRows added in v5.38.0

func (s SqlChannelMemberHistoryStore) DeleteOrphanedRows(limit int) (deleted int64, err error)

DeleteOrphanedRows removes entries from ChannelMemberHistory when a corresponding channel no longer exists.

func (SqlChannelMemberHistoryStore) GetUsersInChannelDuring

func (s SqlChannelMemberHistoryStore) GetUsersInChannelDuring(startTime int64, endTime int64, channelId string) ([]*model.ChannelMemberHistoryResult, error)

func (SqlChannelMemberHistoryStore) LogJoinEvent

func (s SqlChannelMemberHistoryStore) LogJoinEvent(userId string, channelId string, joinTime int64) error

func (SqlChannelMemberHistoryStore) LogLeaveEvent

func (s SqlChannelMemberHistoryStore) LogLeaveEvent(userId string, channelId string, leaveTime int64) error

func (SqlChannelMemberHistoryStore) PermanentDeleteBatch

func (s SqlChannelMemberHistoryStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error)

func (SqlChannelMemberHistoryStore) PermanentDeleteBatchForRetentionPolicies added in v5.38.0

func (s SqlChannelMemberHistoryStore) PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error)

PermanentDeleteBatchForRetentionPolicies deletes a batch of records which are affected by the global or a granular retention policy. See `genericPermanentDeleteBatchForRetentionPolicies` for details.

type SqlChannelStore

type SqlChannelStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (SqlChannelStore) AnalyticsDeletedTypeCount

func (s SqlChannelStore) AnalyticsDeletedTypeCount(teamId string, channelType string) (int64, error)

func (SqlChannelStore) AnalyticsTypeCount

func (s SqlChannelStore) AnalyticsTypeCount(teamId string, channelType string) (int64, error)

func (SqlChannelStore) AutocompleteInTeam

func (s SqlChannelStore) AutocompleteInTeam(teamId string, term string, includeDeleted bool) (*model.ChannelList, error)

func (SqlChannelStore) AutocompleteInTeamForSearch

func (s SqlChannelStore) AutocompleteInTeamForSearch(teamId string, userId string, term string, includeDeleted bool) (*model.ChannelList, error)

func (SqlChannelStore) ClearAllCustomRoleAssignments

func (s SqlChannelStore) ClearAllCustomRoleAssignments() error

func (SqlChannelStore) ClearCaches

func (s SqlChannelStore) ClearCaches()

func (SqlChannelStore) ClearSidebarOnTeamLeave added in v5.26.0

func (s SqlChannelStore) ClearSidebarOnTeamLeave(userId, teamId string) error

func (SqlChannelStore) CountPostsAfter

func (s SqlChannelStore) CountPostsAfter(channelId string, timestamp int64, userId string) (int, int, error)

CountPostsAfter returns the number of posts in the given channel created after but not including the given timestamp. If given a non-empty user ID, only counts posts made by that user.

func (SqlChannelStore) CreateDirectChannel

func (s SqlChannelStore) CreateDirectChannel(user *model.User, otherUser *model.User, channelOptions ...model.ChannelOption) (*model.Channel, error)

func (SqlChannelStore) CreateInitialSidebarCategories added in v5.26.0

func (s SqlChannelStore) CreateInitialSidebarCategories(userId, teamId string) (*model.OrderedSidebarCategories, error)

func (SqlChannelStore) CreateSidebarCategory added in v5.26.0

func (s SqlChannelStore) CreateSidebarCategory(userId, teamId string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error)

func (SqlChannelStore) Delete

func (s SqlChannelStore) Delete(channelId string, time int64) error

Delete records the given deleted timestamp to the channel in question.

func (SqlChannelStore) DeleteSidebarCategory added in v5.26.0

func (s SqlChannelStore) DeleteSidebarCategory(categoryId string) error

DeleteSidebarCategory removes a custom category and moves any channels into it into the Channels and Direct Messages categories respectively. Assumes that the provided user ID and team ID match the given category ID.

func (SqlChannelStore) DeleteSidebarChannelsByPreferences added in v5.26.0

func (s SqlChannelStore) DeleteSidebarChannelsByPreferences(preferences *model.Preferences) error

DeleteSidebarChannelsByPreferences is called when the Preference table is being updated to keep SidebarCategories in sync At the moment, it's only handling Favorites and NOT DMs/GMs (those will be handled client side)

func (SqlChannelStore) Get

func (s SqlChannelStore) Get(id string, allowFromCache bool) (*model.Channel, error)

func (SqlChannelStore) GetAll

func (s SqlChannelStore) GetAll(teamId string) ([]*model.Channel, error)

func (SqlChannelStore) GetAllChannelMembersForUser

func (s SqlChannelStore) GetAllChannelMembersForUser(userId string, allowFromCache bool, includeDeleted bool) (map[string]string, error)

func (SqlChannelStore) GetAllChannelMembersNotifyPropsForChannel

func (s SqlChannelStore) GetAllChannelMembersNotifyPropsForChannel(channelId string, allowFromCache bool) (map[string]model.StringMap, error)

func (SqlChannelStore) GetAllChannels

func (s SqlChannelStore) GetAllChannels(offset, limit int, opts store.ChannelSearchOpts) (*model.ChannelListWithTeamData, error)

func (SqlChannelStore) GetAllChannelsCount

func (s SqlChannelStore) GetAllChannelsCount(opts store.ChannelSearchOpts) (int64, error)

func (SqlChannelStore) GetAllChannelsForExportAfter

func (s SqlChannelStore) GetAllChannelsForExportAfter(limit int, afterId string) ([]*model.ChannelForExport, error)

func (SqlChannelStore) GetAllDirectChannelsForExportAfter

func (s SqlChannelStore) GetAllDirectChannelsForExportAfter(limit int, afterId string) ([]*model.DirectChannelForExport, error)

func (SqlChannelStore) GetByName

func (s SqlChannelStore) GetByName(teamId string, name string, allowFromCache bool) (*model.Channel, error)

func (SqlChannelStore) GetByNameIncludeDeleted

func (s SqlChannelStore) GetByNameIncludeDeleted(teamId string, name string, allowFromCache bool) (*model.Channel, error)

func (SqlChannelStore) GetByNames

func (s SqlChannelStore) GetByNames(teamId string, names []string, allowFromCache bool) ([]*model.Channel, error)

func (SqlChannelStore) GetChannelCounts

func (s SqlChannelStore) GetChannelCounts(teamId string, userId string) (*model.ChannelCounts, error)

func (SqlChannelStore) GetChannelMembersForExport

func (s SqlChannelStore) GetChannelMembersForExport(userId string, teamId string) ([]*model.ChannelMemberForExport, error)

func (SqlChannelStore) GetChannelMembersTimezones

func (s SqlChannelStore) GetChannelMembersTimezones(channelId string) ([]model.StringMap, error)

func (SqlChannelStore) GetChannelUnread

func (s SqlChannelStore) GetChannelUnread(channelId, userId string) (*model.ChannelUnread, error)

func (SqlChannelStore) GetChannels

func (s SqlChannelStore) GetChannels(teamId string, userId string, includeDeleted bool, lastDeleteAt int) (*model.ChannelList, error)

func (SqlChannelStore) GetChannelsBatchForIndexing

func (s SqlChannelStore) GetChannelsBatchForIndexing(startTime, endTime int64, limit int) ([]*model.Channel, error)

func (SqlChannelStore) GetChannelsByIds

func (s SqlChannelStore) GetChannelsByIds(channelIds []string, includeDeleted bool) ([]*model.Channel, error)

func (SqlChannelStore) GetChannelsByScheme

func (s SqlChannelStore) GetChannelsByScheme(schemeId string, offset int, limit int) (model.ChannelList, error)

func (SqlChannelStore) GetDeleted

func (s SqlChannelStore) GetDeleted(teamId string, offset int, limit int, userId string) (*model.ChannelList, error)

func (SqlChannelStore) GetDeletedByName

func (s SqlChannelStore) GetDeletedByName(teamId string, name string) (*model.Channel, error)

func (SqlChannelStore) GetForPost

func (s SqlChannelStore) GetForPost(postId string) (*model.Channel, error)

func (SqlChannelStore) GetFromMaster

func (s SqlChannelStore) GetFromMaster(id string) (*model.Channel, error)

func (SqlChannelStore) GetGuestCount

func (s SqlChannelStore) GetGuestCount(channelId string, allowFromCache bool) (int64, error)

func (SqlChannelStore) GetMember

func (s SqlChannelStore) GetMember(ctx context.Context, channelId string, userId string) (*model.ChannelMember, error)

func (SqlChannelStore) GetMemberCount

func (s SqlChannelStore) GetMemberCount(channelId string, allowFromCache bool) (int64, error)

func (SqlChannelStore) GetMemberCountFromCache

func (s SqlChannelStore) GetMemberCountFromCache(channelId string) int64

func (SqlChannelStore) GetMemberCountsByGroup added in v5.24.0

func (s SqlChannelStore) GetMemberCountsByGroup(ctx context.Context, channelID string, includeTimezones bool) ([]*model.ChannelMemberCountByGroup, error)

GetMemberCountsByGroup returns a slice of ChannelMemberCountByGroup for a given channel which contains the number of channel members for each group and optionally the number of unique timezones present for each group in the channel

func (SqlChannelStore) GetMemberForPost

func (s SqlChannelStore) GetMemberForPost(postId string, userId string) (*model.ChannelMember, error)

func (SqlChannelStore) GetMembers

func (s SqlChannelStore) GetMembers(channelId string, offset, limit int) (*model.ChannelMembers, error)

func (SqlChannelStore) GetMembersByChannelIds added in v5.30.0

func (s SqlChannelStore) GetMembersByChannelIds(channelIds []string, userId string) (*model.ChannelMembers, error)

func (SqlChannelStore) GetMembersByIds

func (s SqlChannelStore) GetMembersByIds(channelId string, userIds []string) (*model.ChannelMembers, error)

func (SqlChannelStore) GetMembersForUser

func (s SqlChannelStore) GetMembersForUser(teamId string, userId string) (*model.ChannelMembers, error)

func (SqlChannelStore) GetMembersForUserWithPagination

func (s SqlChannelStore) GetMembersForUserWithPagination(teamId, userId string, page, perPage int) (*model.ChannelMembers, error)

func (SqlChannelStore) GetMoreChannels

func (s SqlChannelStore) GetMoreChannels(teamId string, userId string, offset int, limit int) (*model.ChannelList, error)

func (SqlChannelStore) GetPinnedPostCount

func (s SqlChannelStore) GetPinnedPostCount(channelId string, allowFromCache bool) (int64, error)

func (SqlChannelStore) GetPinnedPosts

func (s SqlChannelStore) GetPinnedPosts(channelId string) (*model.PostList, error)

func (SqlChannelStore) GetPrivateChannelsForTeam added in v5.26.0

func (s SqlChannelStore) GetPrivateChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, error)

func (SqlChannelStore) GetPublicChannelsByIdsForTeam

func (s SqlChannelStore) GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) (*model.ChannelList, error)

func (SqlChannelStore) GetPublicChannelsForTeam

func (s SqlChannelStore) GetPublicChannelsForTeam(teamId string, offset int, limit int) (*model.ChannelList, error)

func (SqlChannelStore) GetSidebarCategories added in v5.26.0

func (s SqlChannelStore) GetSidebarCategories(userId, teamId string) (*model.OrderedSidebarCategories, error)

func (SqlChannelStore) GetSidebarCategory added in v5.26.0

func (s SqlChannelStore) GetSidebarCategory(categoryId string) (*model.SidebarCategoryWithChannels, error)

func (SqlChannelStore) GetSidebarCategoryOrder added in v5.26.0

func (s SqlChannelStore) GetSidebarCategoryOrder(userId, teamId string) ([]string, error)

func (SqlChannelStore) GetTeamChannels

func (s SqlChannelStore) GetTeamChannels(teamId string) (*model.ChannelList, error)

func (SqlChannelStore) GetTeamForChannel added in v5.35.0

func (s SqlChannelStore) GetTeamForChannel(channelID string) (*model.Team, error)

GetTeamForChannel returns the team for a given channelID.

func (SqlChannelStore) GroupSyncedChannelCount added in v5.22.0

func (s SqlChannelStore) GroupSyncedChannelCount() (int64, error)

func (SqlChannelStore) IncrementMentionCount

func (s SqlChannelStore) IncrementMentionCount(channelId string, userId string, updateThreads, isRoot bool) error

func (SqlChannelStore) InvalidateAllChannelMembersForUser

func (s SqlChannelStore) InvalidateAllChannelMembersForUser(userId string)

func (SqlChannelStore) InvalidateCacheForChannelMembersNotifyProps

func (s SqlChannelStore) InvalidateCacheForChannelMembersNotifyProps(channelId string)

func (SqlChannelStore) InvalidateChannel

func (s SqlChannelStore) InvalidateChannel(id string)

func (SqlChannelStore) InvalidateChannelByName

func (s SqlChannelStore) InvalidateChannelByName(teamId, name string)

func (SqlChannelStore) InvalidateGuestCount

func (s SqlChannelStore) InvalidateGuestCount(channelId string)

func (SqlChannelStore) InvalidateMemberCount

func (s SqlChannelStore) InvalidateMemberCount(channelId string)

func (SqlChannelStore) InvalidatePinnedPostCount

func (s SqlChannelStore) InvalidatePinnedPostCount(channelId string)

func (SqlChannelStore) IsUserInChannelUseCache

func (s SqlChannelStore) IsUserInChannelUseCache(userId string, channelId string) bool

func (SqlChannelStore) MigrateChannelMembers

func (s SqlChannelStore) MigrateChannelMembers(fromChannelId string, fromUserId string) (map[string]string, error)

This function does the Advanced Permissions Phase 2 migration for ChannelMember objects. It performs the migration in batches as a single transaction per batch to ensure consistency but to also minimise execution time to avoid causing unnecessary table locks. **THIS FUNCTION SHOULD NOT BE USED FOR ANY OTHER PURPOSE.** Executing this function *after* the new Schemes functionality has been used on an installation will have unintended consequences.

func (SqlChannelStore) MigrateFavoritesToSidebarChannels added in v5.26.0

func (s SqlChannelStore) MigrateFavoritesToSidebarChannels(lastUserId string, runningOrder int64) (map[string]interface{}, error)

MigrateFavoritesToSidebarChannels populates the SidebarChannels table by analyzing existing user preferences for favorites **IMPORTANT** This function should only be called from the migration task and shouldn't be used by itself

func (SqlChannelStore) MigratePublicChannels

func (s SqlChannelStore) MigratePublicChannels() error

MigratePublicChannels initializes the PublicChannels table with data created before this version of the Mattermost server kept it up-to-date.

func (SqlChannelStore) PermanentDelete

func (s SqlChannelStore) PermanentDelete(channelId string) error

PermanentDelete removes the given channel from the database.

func (SqlChannelStore) PermanentDeleteByTeam

func (s SqlChannelStore) PermanentDeleteByTeam(teamId string) error

PermanentDeleteByTeam removes all channels for the given team from the database.

func (SqlChannelStore) PermanentDeleteMembersByChannel

func (s SqlChannelStore) PermanentDeleteMembersByChannel(channelId string) error

func (SqlChannelStore) PermanentDeleteMembersByUser

func (s SqlChannelStore) PermanentDeleteMembersByUser(userId string) error

func (SqlChannelStore) RemoveAllDeactivatedMembers

func (s SqlChannelStore) RemoveAllDeactivatedMembers(channelId string) error

func (SqlChannelStore) RemoveMember

func (s SqlChannelStore) RemoveMember(channelId string, userId string) error

func (SqlChannelStore) RemoveMembers added in v5.24.0

func (s SqlChannelStore) RemoveMembers(channelId string, userIds []string) error

func (SqlChannelStore) ResetAllChannelSchemes

func (s SqlChannelStore) ResetAllChannelSchemes() error

func (SqlChannelStore) Restore

func (s SqlChannelStore) Restore(channelId string, time int64) error

Restore reverts a previous deleted timestamp from the channel in question.

func (SqlChannelStore) Save

func (s SqlChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error)

Save writes the (non-direct) channel channel to the database.

func (SqlChannelStore) SaveDirectChannel

func (s SqlChannelStore) SaveDirectChannel(directChannel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) (*model.Channel, error)

func (SqlChannelStore) SaveMember

func (s SqlChannelStore) SaveMember(member *model.ChannelMember) (*model.ChannelMember, error)

func (SqlChannelStore) SaveMultipleMembers added in v5.24.0

func (s SqlChannelStore) SaveMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error)

func (SqlChannelStore) SearchAllChannels

func (SqlChannelStore) SearchArchivedInTeam

func (s SqlChannelStore) SearchArchivedInTeam(teamId string, term string, userId string) (*model.ChannelList, error)

func (SqlChannelStore) SearchForUserInTeam

func (s SqlChannelStore) SearchForUserInTeam(userId string, teamId string, term string, includeDeleted bool) (*model.ChannelList, error)

func (SqlChannelStore) SearchGroupChannels

func (s SqlChannelStore) SearchGroupChannels(userId, term string) (*model.ChannelList, error)

func (SqlChannelStore) SearchInTeam

func (s SqlChannelStore) SearchInTeam(teamId string, term string, includeDeleted bool) (*model.ChannelList, error)

func (SqlChannelStore) SearchMore

func (s SqlChannelStore) SearchMore(userId string, teamId string, term string) (*model.ChannelList, error)

func (SqlChannelStore) SetDeleteAt

func (s SqlChannelStore) SetDeleteAt(channelId string, deleteAt, updateAt int64) error

SetDeleteAt records the given deleted and updated timestamp to the channel in question.

func (SqlChannelStore) SetShared added in v5.35.0

func (s SqlChannelStore) SetShared(channelId string, shared bool) error

SetShared sets the Shared flag true/false

func (SqlChannelStore) Update

func (s SqlChannelStore) Update(channel *model.Channel) (*model.Channel, error)

Update writes the updated channel to the database.

func (SqlChannelStore) UpdateLastViewedAt

func (s SqlChannelStore) UpdateLastViewedAt(channelIds []string, userId string, updateThreads bool) (map[string]int64, error)

func (SqlChannelStore) UpdateLastViewedAtPost

func (s SqlChannelStore) UpdateLastViewedAtPost(unreadPost *model.Post, userID string, mentionCount, mentionCountRoot int, updateThreads bool, setUnreadCountRoot bool) (*model.ChannelUnreadAt, error)

UpdateLastViewedAtPost updates a ChannelMember as if the user last read the channel at the time of the given post. If the provided mentionCount is -1, the given post and all posts after it are considered to be mentions. Returns an updated model.ChannelUnreadAt that can be returned to the client.

func (SqlChannelStore) UpdateMember

func (s SqlChannelStore) UpdateMember(member *model.ChannelMember) (*model.ChannelMember, error)

func (SqlChannelStore) UpdateMembersRole added in v5.20.0

func (s SqlChannelStore) UpdateMembersRole(channelID string, userIDs []string) error

func (SqlChannelStore) UpdateMultipleMembers added in v5.24.0

func (s SqlChannelStore) UpdateMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error)

func (SqlChannelStore) UpdateSidebarCategories added in v5.26.0

func (s SqlChannelStore) UpdateSidebarCategories(userId, teamId string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error)

func (SqlChannelStore) UpdateSidebarCategoryOrder added in v5.26.0

func (s SqlChannelStore) UpdateSidebarCategoryOrder(userId, teamId string, categoryOrder []string) error

func (SqlChannelStore) UpdateSidebarChannelCategoryOnMove added in v5.26.0

func (s SqlChannelStore) UpdateSidebarChannelCategoryOnMove(channel *model.Channel, newTeamId string) error

func (SqlChannelStore) UpdateSidebarChannelsByPreferences added in v5.26.0

func (s SqlChannelStore) UpdateSidebarChannelsByPreferences(preferences *model.Preferences) error

UpdateSidebarChannelsByPreferences is called when the Preference table is being updated to keep SidebarCategories in sync At the moment, it's only handling Favorites and NOT DMs/GMs (those will be handled client side)

func (SqlChannelStore) UserBelongsToChannels

func (s SqlChannelStore) UserBelongsToChannels(userId string, channelIds []string) (bool, error)

type SqlCommandStore

type SqlCommandStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (SqlCommandStore) AnalyticsCommandCount

func (s SqlCommandStore) AnalyticsCommandCount(teamId string) (int64, error)

func (SqlCommandStore) Delete

func (s SqlCommandStore) Delete(commandId string, time int64) error

func (SqlCommandStore) Get

func (s SqlCommandStore) Get(id string) (*model.Command, error)

func (SqlCommandStore) GetByTeam

func (s SqlCommandStore) GetByTeam(teamId string) ([]*model.Command, error)

func (SqlCommandStore) GetByTrigger

func (s SqlCommandStore) GetByTrigger(teamId string, trigger string) (*model.Command, error)

func (SqlCommandStore) PermanentDeleteByTeam

func (s SqlCommandStore) PermanentDeleteByTeam(teamId string) error

func (SqlCommandStore) PermanentDeleteByUser

func (s SqlCommandStore) PermanentDeleteByUser(userId string) error

func (SqlCommandStore) Save

func (s SqlCommandStore) Save(command *model.Command) (*model.Command, error)

func (SqlCommandStore) Update

func (s SqlCommandStore) Update(cmd *model.Command) (*model.Command, error)

type SqlCommandWebhookStore

type SqlCommandWebhookStore struct {
	*SqlStore
}

func (SqlCommandWebhookStore) Cleanup

func (s SqlCommandWebhookStore) Cleanup()

func (SqlCommandWebhookStore) Get

func (SqlCommandWebhookStore) Save

func (SqlCommandWebhookStore) TryUse

func (s SqlCommandWebhookStore) TryUse(id string, limit int) error

type SqlComplianceStore

type SqlComplianceStore struct {
	*SqlStore
}

func (SqlComplianceStore) ComplianceExport

func (SqlComplianceStore) Get

func (SqlComplianceStore) GetAll

func (s SqlComplianceStore) GetAll(offset, limit int) (model.Compliances, error)

func (SqlComplianceStore) MessageExport

func (SqlComplianceStore) Save

func (s SqlComplianceStore) Save(compliance *model.Compliance) (*model.Compliance, error)

func (SqlComplianceStore) Update

func (s SqlComplianceStore) Update(compliance *model.Compliance) (*model.Compliance, error)

type SqlEmojiStore

type SqlEmojiStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (SqlEmojiStore) Delete

func (es SqlEmojiStore) Delete(emoji *model.Emoji, time int64) error

func (SqlEmojiStore) Get

func (es SqlEmojiStore) Get(ctx context.Context, id string, allowFromCache bool) (*model.Emoji, error)

func (SqlEmojiStore) GetByName

func (es SqlEmojiStore) GetByName(ctx context.Context, name string, allowFromCache bool) (*model.Emoji, error)

func (SqlEmojiStore) GetList

func (es SqlEmojiStore) GetList(offset, limit int, sort string) ([]*model.Emoji, error)

func (SqlEmojiStore) GetMultipleByName

func (es SqlEmojiStore) GetMultipleByName(names []string) ([]*model.Emoji, error)

func (SqlEmojiStore) Save

func (es SqlEmojiStore) Save(emoji *model.Emoji) (*model.Emoji, error)

func (SqlEmojiStore) Search

func (es SqlEmojiStore) Search(name string, prefixOnly bool, limit int) ([]*model.Emoji, error)

type SqlFileInfoStore

type SqlFileInfoStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (SqlFileInfoStore) AttachToPost

func (fs SqlFileInfoStore) AttachToPost(fileId, postId, creatorId string) error

func (SqlFileInfoStore) ClearCaches

func (fs SqlFileInfoStore) ClearCaches()

func (SqlFileInfoStore) CountAll added in v5.34.0

func (fs SqlFileInfoStore) CountAll() (int64, error)

func (SqlFileInfoStore) DeleteForPost

func (fs SqlFileInfoStore) DeleteForPost(postId string) (string, error)

func (SqlFileInfoStore) Get

func (fs SqlFileInfoStore) Get(id string) (*model.FileInfo, error)

func (SqlFileInfoStore) GetByIds added in v5.32.0

func (fs SqlFileInfoStore) GetByIds(ids []string) ([]*model.FileInfo, error)

func (SqlFileInfoStore) GetByPath

func (fs SqlFileInfoStore) GetByPath(path string) (*model.FileInfo, error)

func (SqlFileInfoStore) GetFilesBatchForIndexing added in v5.34.0

func (fs SqlFileInfoStore) GetFilesBatchForIndexing(startTime, endTime int64, limit int) ([]*model.FileForIndexing, error)

func (SqlFileInfoStore) GetForPost

func (fs SqlFileInfoStore) GetForPost(postId string, readFromMaster, includeDeleted, allowFromCache bool) ([]*model.FileInfo, error)

func (SqlFileInfoStore) GetForUser

func (fs SqlFileInfoStore) GetForUser(userId string) ([]*model.FileInfo, error)

func (SqlFileInfoStore) GetFromMaster added in v5.35.0

func (fs SqlFileInfoStore) GetFromMaster(id string) (*model.FileInfo, error)

func (SqlFileInfoStore) GetWithOptions added in v5.22.0

func (fs SqlFileInfoStore) GetWithOptions(page, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, error)

func (SqlFileInfoStore) InvalidateFileInfosForPostCache

func (fs SqlFileInfoStore) InvalidateFileInfosForPostCache(postId string, deleted bool)

func (SqlFileInfoStore) PermanentDelete

func (fs SqlFileInfoStore) PermanentDelete(fileId string) error

func (SqlFileInfoStore) PermanentDeleteBatch

func (fs SqlFileInfoStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error)

func (SqlFileInfoStore) PermanentDeleteByUser

func (fs SqlFileInfoStore) PermanentDeleteByUser(userId string) (int64, error)

func (SqlFileInfoStore) Save

func (fs SqlFileInfoStore) Save(info *model.FileInfo) (*model.FileInfo, error)

func (SqlFileInfoStore) Search added in v5.32.0

func (fs SqlFileInfoStore) Search(paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.FileInfoList, error)

func (SqlFileInfoStore) SetContent added in v5.30.0

func (fs SqlFileInfoStore) SetContent(fileId, content string) error

func (SqlFileInfoStore) Upsert added in v5.30.0

func (fs SqlFileInfoStore) Upsert(info *model.FileInfo) (*model.FileInfo, error)

type SqlGroupStore

type SqlGroupStore struct {
	*SqlStore
}

func (*SqlGroupStore) AdminRoleGroupsForSyncableMember added in v5.20.0

func (s *SqlGroupStore) AdminRoleGroupsForSyncableMember(userID, syncableID string, syncableType model.GroupSyncableType) ([]string, error)

func (*SqlGroupStore) ChannelMembersMinusGroupMembers

func (s *SqlGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, error)

ChannelMembersMinusGroupMembers returns the set of users in the given channel minus the set of users in the given groups.

func (*SqlGroupStore) ChannelMembersToAdd

func (s *SqlGroupStore) ChannelMembersToAdd(since int64, channelID *string, includeRemovedMembers bool) ([]*model.UserChannelIDPair, error)

func (*SqlGroupStore) ChannelMembersToRemove

func (s *SqlGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, error)

func (*SqlGroupStore) CountChannelMembersMinusGroupMembers

func (s *SqlGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, error)

CountChannelMembersMinusGroupMembers returns the count of the set of users in the given channel minus the set of users in the given groups.

func (*SqlGroupStore) CountGroupsByChannel

func (s *SqlGroupStore) CountGroupsByChannel(channelId string, opts model.GroupSearchOpts) (int64, error)

func (*SqlGroupStore) CountGroupsByTeam

func (s *SqlGroupStore) CountGroupsByTeam(teamId string, opts model.GroupSearchOpts) (int64, error)

func (*SqlGroupStore) CountTeamMembersMinusGroupMembers

func (s *SqlGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, error)

CountTeamMembersMinusGroupMembers returns the count of the set of users on the given team minus the set of users in the given groups.

func (*SqlGroupStore) Create

func (s *SqlGroupStore) Create(group *model.Group) (*model.Group, error)

func (*SqlGroupStore) CreateGroupSyncable

func (s *SqlGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error)

func (*SqlGroupStore) Delete

func (s *SqlGroupStore) Delete(groupID string) (*model.Group, error)

func (*SqlGroupStore) DeleteGroupSyncable

func (s *SqlGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error)

func (*SqlGroupStore) DeleteMember

func (s *SqlGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, error)

func (*SqlGroupStore) DistinctGroupMemberCount added in v5.22.0

func (s *SqlGroupStore) DistinctGroupMemberCount() (int64, error)

func (*SqlGroupStore) Get

func (s *SqlGroupStore) Get(groupId string) (*model.Group, error)

func (*SqlGroupStore) GetAllBySource

func (s *SqlGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, error)

func (*SqlGroupStore) GetAllGroupSyncablesByGroupId

func (s *SqlGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, error)

func (*SqlGroupStore) GetByIDs

func (s *SqlGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, error)

func (*SqlGroupStore) GetByName

func (s *SqlGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, error)

func (*SqlGroupStore) GetByRemoteID

func (s *SqlGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, error)

func (*SqlGroupStore) GetByUser

func (s *SqlGroupStore) GetByUser(userId string) ([]*model.Group, error)

func (*SqlGroupStore) GetGroupSyncable

func (s *SqlGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error)

func (*SqlGroupStore) GetGroups

func (s *SqlGroupStore) GetGroups(page, perPage int, opts model.GroupSearchOpts) ([]*model.Group, error)

func (*SqlGroupStore) GetGroupsAssociatedToChannelsByTeam added in v5.24.0

func (s *SqlGroupStore) GetGroupsAssociatedToChannelsByTeam(teamId string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, error)

func (*SqlGroupStore) GetGroupsByChannel

func (s *SqlGroupStore) GetGroupsByChannel(channelId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error)

func (*SqlGroupStore) GetGroupsByTeam

func (s *SqlGroupStore) GetGroupsByTeam(teamId string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error)

func (*SqlGroupStore) GetMemberCount

func (s *SqlGroupStore) GetMemberCount(groupID string) (int64, error)

func (*SqlGroupStore) GetMemberUsers

func (s *SqlGroupStore) GetMemberUsers(groupID string) ([]*model.User, error)

func (*SqlGroupStore) GetMemberUsersInTeam added in v5.24.0

func (s *SqlGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, error)

func (*SqlGroupStore) GetMemberUsersNotInChannel added in v5.24.0

func (s *SqlGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, error)

func (*SqlGroupStore) GetMemberUsersPage

func (s *SqlGroupStore) GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, error)

func (*SqlGroupStore) GroupChannelCount added in v5.22.0

func (s *SqlGroupStore) GroupChannelCount() (int64, error)

func (*SqlGroupStore) GroupCount added in v5.22.0

func (s *SqlGroupStore) GroupCount() (int64, error)

func (*SqlGroupStore) GroupCountWithAllowReference added in v5.24.0

func (s *SqlGroupStore) GroupCountWithAllowReference() (int64, error)

func (*SqlGroupStore) GroupMemberCount added in v5.22.0

func (s *SqlGroupStore) GroupMemberCount() (int64, error)

func (*SqlGroupStore) GroupTeamCount added in v5.22.0

func (s *SqlGroupStore) GroupTeamCount() (int64, error)

func (*SqlGroupStore) PermanentDeleteMembersByUser

func (s *SqlGroupStore) PermanentDeleteMembersByUser(userId string) error

func (*SqlGroupStore) PermittedSyncableAdmins added in v5.20.0

func (s *SqlGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, error)

func (*SqlGroupStore) TeamMembersMinusGroupMembers

func (s *SqlGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page, perPage int) ([]*model.UserWithGroups, error)

TeamMembersMinusGroupMembers returns the set of users on the given team minus the set of users in the given groups.

func (*SqlGroupStore) TeamMembersToAdd

func (s *SqlGroupStore) TeamMembersToAdd(since int64, teamID *string, includeRemovedMembers bool) ([]*model.UserTeamIDPair, error)

func (*SqlGroupStore) TeamMembersToRemove

func (s *SqlGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, error)

func (*SqlGroupStore) Update

func (s *SqlGroupStore) Update(group *model.Group) (*model.Group, error)

func (*SqlGroupStore) UpdateGroupSyncable

func (s *SqlGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error)

func (*SqlGroupStore) UpsertMember

func (s *SqlGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, error)

type SqlJobStore

type SqlJobStore struct {
	*SqlStore
}

func (SqlJobStore) Delete

func (jss SqlJobStore) Delete(id string) (string, error)

func (SqlJobStore) Get

func (jss SqlJobStore) Get(id string) (*model.Job, error)

func (SqlJobStore) GetAllByStatus

func (jss SqlJobStore) GetAllByStatus(status string) ([]*model.Job, error)

func (SqlJobStore) GetAllByType

func (jss SqlJobStore) GetAllByType(jobType string) ([]*model.Job, error)

func (SqlJobStore) GetAllByTypePage

func (jss SqlJobStore) GetAllByTypePage(jobType string, offset int, limit int) ([]*model.Job, error)

func (SqlJobStore) GetAllByTypesPage added in v5.35.0

func (jss SqlJobStore) GetAllByTypesPage(jobTypes []string, offset int, limit int) ([]*model.Job, error)

func (SqlJobStore) GetAllPage

func (jss SqlJobStore) GetAllPage(offset int, limit int) ([]*model.Job, error)

func (SqlJobStore) GetCountByStatusAndType

func (jss SqlJobStore) GetCountByStatusAndType(status string, jobType string) (int64, error)

func (SqlJobStore) GetNewestJobByStatusAndType

func (jss SqlJobStore) GetNewestJobByStatusAndType(status string, jobType string) (*model.Job, error)

func (SqlJobStore) GetNewestJobByStatusesAndType added in v5.27.0

func (jss SqlJobStore) GetNewestJobByStatusesAndType(status []string, jobType string) (*model.Job, error)

func (SqlJobStore) Save

func (jss SqlJobStore) Save(job *model.Job) (*model.Job, error)

func (SqlJobStore) UpdateOptimistically

func (jss SqlJobStore) UpdateOptimistically(job *model.Job, currentStatus string) (bool, error)

func (SqlJobStore) UpdateStatus

func (jss SqlJobStore) UpdateStatus(id string, status string) (*model.Job, error)

func (SqlJobStore) UpdateStatusOptimistically

func (jss SqlJobStore) UpdateStatusOptimistically(id string, currentStatus string, newStatus string) (bool, error)

type SqlLicenseStore

type SqlLicenseStore struct {
	*SqlStore
}

SqlLicenseStore encapsulates the database writes and reads for model.LicenseRecord objects.

func (SqlLicenseStore) Get

Get obtains the license with the provided id parameter from the database. If the license doesn't exist it returns a model.AppError with http.StatusNotFound in the StatusCode field.

func (SqlLicenseStore) GetAll added in v5.37.0

func (ls SqlLicenseStore) GetAll() ([]*model.LicenseRecord, error)

func (SqlLicenseStore) Save

Save validates and stores the license instance in the database. The Id and Bytes fields are mandatory. The Bytes field is limited to a maximum of 10000 bytes. If the license ID matches an existing license in the database it returns the license stored in the database. If not, it saves the new database and returns the created license with the CreateAt field updated.

type SqlLinkMetadataStore

type SqlLinkMetadataStore struct {
	*SqlStore
}

func (SqlLinkMetadataStore) Get

func (s SqlLinkMetadataStore) Get(url string, timestamp int64) (*model.LinkMetadata, error)

func (SqlLinkMetadataStore) Save

type SqlOAuthStore

type SqlOAuthStore struct {
	*SqlStore
}

func (SqlOAuthStore) DeleteApp

func (as SqlOAuthStore) DeleteApp(id string) error

func (SqlOAuthStore) GetAccessData

func (as SqlOAuthStore) GetAccessData(token string) (*model.AccessData, error)

func (SqlOAuthStore) GetAccessDataByRefreshToken

func (as SqlOAuthStore) GetAccessDataByRefreshToken(token string) (*model.AccessData, error)

func (SqlOAuthStore) GetAccessDataByUserForApp

func (as SqlOAuthStore) GetAccessDataByUserForApp(userId, clientId string) ([]*model.AccessData, error)

func (SqlOAuthStore) GetApp

func (as SqlOAuthStore) GetApp(id string) (*model.OAuthApp, error)

func (SqlOAuthStore) GetAppByUser

func (as SqlOAuthStore) GetAppByUser(userId string, offset, limit int) ([]*model.OAuthApp, error)

func (SqlOAuthStore) GetApps

func (as SqlOAuthStore) GetApps(offset, limit int) ([]*model.OAuthApp, error)

func (SqlOAuthStore) GetAuthData

func (as SqlOAuthStore) GetAuthData(code string) (*model.AuthData, error)

func (SqlOAuthStore) GetAuthorizedApps

func (as SqlOAuthStore) GetAuthorizedApps(userId string, offset, limit int) ([]*model.OAuthApp, error)

func (SqlOAuthStore) GetPreviousAccessData

func (as SqlOAuthStore) GetPreviousAccessData(userId, clientId string) (*model.AccessData, error)

func (SqlOAuthStore) PermanentDeleteAuthDataByUser

func (as SqlOAuthStore) PermanentDeleteAuthDataByUser(userId string) error

func (SqlOAuthStore) RemoveAccessData

func (as SqlOAuthStore) RemoveAccessData(token string) error

func (SqlOAuthStore) RemoveAllAccessData

func (as SqlOAuthStore) RemoveAllAccessData() error

func (SqlOAuthStore) RemoveAuthData

func (as SqlOAuthStore) RemoveAuthData(code string) error

func (SqlOAuthStore) SaveAccessData

func (as SqlOAuthStore) SaveAccessData(accessData *model.AccessData) (*model.AccessData, error)

func (SqlOAuthStore) SaveApp

func (as SqlOAuthStore) SaveApp(app *model.OAuthApp) (*model.OAuthApp, error)

func (SqlOAuthStore) SaveAuthData

func (as SqlOAuthStore) SaveAuthData(authData *model.AuthData) (*model.AuthData, error)

func (SqlOAuthStore) UpdateAccessData

func (as SqlOAuthStore) UpdateAccessData(accessData *model.AccessData) (*model.AccessData, error)

func (SqlOAuthStore) UpdateApp

func (as SqlOAuthStore) UpdateApp(app *model.OAuthApp) (*model.OAuthApp, error)

type SqlPluginStore

type SqlPluginStore struct {
	*SqlStore
}

func (SqlPluginStore) CompareAndDelete

func (ps SqlPluginStore) CompareAndDelete(kv *model.PluginKeyValue, oldValue []byte) (bool, error)

func (SqlPluginStore) CompareAndSet

func (ps SqlPluginStore) CompareAndSet(kv *model.PluginKeyValue, oldValue []byte) (bool, error)

func (SqlPluginStore) Delete

func (ps SqlPluginStore) Delete(pluginId, key string) error

func (SqlPluginStore) DeleteAllExpired

func (ps SqlPluginStore) DeleteAllExpired() error

func (SqlPluginStore) DeleteAllForPlugin

func (ps SqlPluginStore) DeleteAllForPlugin(pluginId string) error

func (SqlPluginStore) Get

func (ps SqlPluginStore) Get(pluginId, key string) (*model.PluginKeyValue, error)

func (SqlPluginStore) List

func (ps SqlPluginStore) List(pluginId string, offset int, limit int) ([]string, error)

func (SqlPluginStore) SaveOrUpdate

func (ps SqlPluginStore) SaveOrUpdate(kv *model.PluginKeyValue) (*model.PluginKeyValue, error)

func (SqlPluginStore) SetWithOptions

func (ps SqlPluginStore) SetWithOptions(pluginId string, key string, value []byte, opt model.PluginKVSetOptions) (bool, error)

type SqlPostStore

type SqlPostStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (*SqlPostStore) AnalyticsPostCount

func (s *SqlPostStore) AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) (int64, error)

func (*SqlPostStore) AnalyticsPostCountsByDay

func (s *SqlPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error)

func (*SqlPostStore) AnalyticsUserCountsWithPostsByDay

func (s *SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) (model.AnalyticsRows, error)

func (*SqlPostStore) ClearCaches

func (s *SqlPostStore) ClearCaches()

func (*SqlPostStore) Delete

func (s *SqlPostStore) Delete(postId string, time int64, deleteByID string) error

func (*SqlPostStore) DeleteOrphanedRows added in v5.38.0

func (s *SqlPostStore) DeleteOrphanedRows(limit int) (deleted int64, err error)

DeleteOrphanedRows removes entries from Posts when a corresponding channel no longer exists.

func (*SqlPostStore) Get

func (s *SqlPostStore) Get(ctx context.Context, id string, skipFetchThreads, collapsedThreads, collapsedThreadsExtended bool, userID string) (*model.PostList, error)

func (*SqlPostStore) GetDirectPostParentsForExportAfter

func (s *SqlPostStore) GetDirectPostParentsForExportAfter(limit int, afterId string) ([]*model.DirectPostForExport, error)

func (*SqlPostStore) GetEtag

func (s *SqlPostStore) GetEtag(channelId string, allowFromCache, collapsedThreads bool) string

func (*SqlPostStore) GetFlaggedPosts

func (s *SqlPostStore) GetFlaggedPosts(userId string, offset int, limit int) (*model.PostList, error)

func (*SqlPostStore) GetFlaggedPostsForChannel

func (s *SqlPostStore) GetFlaggedPostsForChannel(userId, channelId string, offset int, limit int) (*model.PostList, error)

func (*SqlPostStore) GetFlaggedPostsForTeam

func (s *SqlPostStore) GetFlaggedPostsForTeam(userId, teamId string, offset int, limit int) (*model.PostList, error)

func (*SqlPostStore) GetMaxPostSize

func (s *SqlPostStore) GetMaxPostSize() int

GetMaxPostSize returns the maximum number of runes that may be stored in a post.

func (*SqlPostStore) GetOldest

func (s *SqlPostStore) GetOldest() (*model.Post, error)

func (*SqlPostStore) GetOldestEntityCreationTime added in v5.26.0

func (s *SqlPostStore) GetOldestEntityCreationTime() (int64, error)

func (*SqlPostStore) GetParentsForExportAfter

func (s *SqlPostStore) GetParentsForExportAfter(limit int, afterId string) ([]*model.PostForExport, error)

func (*SqlPostStore) GetPostAfterTime

func (s *SqlPostStore) GetPostAfterTime(channelId string, time int64, collapsedThreads bool) (*model.Post, error)

func (*SqlPostStore) GetPostIdAfterTime

func (s *SqlPostStore) GetPostIdAfterTime(channelId string, time int64, collapsedThreads bool) (string, error)

func (*SqlPostStore) GetPostIdBeforeTime

func (s *SqlPostStore) GetPostIdBeforeTime(channelId string, time int64, collapsedThreads bool) (string, error)

func (*SqlPostStore) GetPosts

func (s *SqlPostStore) GetPosts(options model.GetPostsOptions, _ bool) (*model.PostList, error)

func (*SqlPostStore) GetPostsAfter

func (s *SqlPostStore) GetPostsAfter(options model.GetPostsOptions) (*model.PostList, error)

func (*SqlPostStore) GetPostsBatchForIndexing

func (s *SqlPostStore) GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) ([]*model.PostForIndexing, error)

func (*SqlPostStore) GetPostsBefore

func (s *SqlPostStore) GetPostsBefore(options model.GetPostsOptions) (*model.PostList, error)

func (*SqlPostStore) GetPostsByIds

func (s *SqlPostStore) GetPostsByIds(postIds []string) ([]*model.Post, error)

func (*SqlPostStore) GetPostsCreatedAt

func (s *SqlPostStore) GetPostsCreatedAt(channelId string, time int64) ([]*model.Post, error)

func (*SqlPostStore) GetPostsSince

func (s *SqlPostStore) GetPostsSince(options model.GetPostsSinceOptions, allowFromCache bool) (*model.PostList, error)

func (*SqlPostStore) GetPostsSinceForSync added in v5.35.0

func (*SqlPostStore) GetRepliesForExport

func (s *SqlPostStore) GetRepliesForExport(rootId string) ([]*model.ReplyForExport, error)

func (*SqlPostStore) GetSingle

func (s *SqlPostStore) GetSingle(id string, inclDeleted bool) (*model.Post, error)

func (*SqlPostStore) HasAutoResponsePostByUserSince added in v5.36.0

func (s *SqlPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error)

func (*SqlPostStore) InvalidateLastPostTimeCache

func (s *SqlPostStore) InvalidateLastPostTimeCache(channelId string)

func (*SqlPostStore) Overwrite

func (s *SqlPostStore) Overwrite(post *model.Post) (*model.Post, error)

func (*SqlPostStore) OverwriteMultiple added in v5.22.0

func (s *SqlPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error)

func (*SqlPostStore) PermanentDeleteBatch

func (s *SqlPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error)

func (*SqlPostStore) PermanentDeleteBatchForRetentionPolicies added in v5.38.0

func (s *SqlPostStore) PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error)

PermanentDeleteBatchForRetentionPolicies deletes a batch of records which are affected by the global or a granular retention policy. See `genericPermanentDeleteBatchForRetentionPolicies` for details.

func (*SqlPostStore) PermanentDeleteByChannel

func (s *SqlPostStore) PermanentDeleteByChannel(channelId string) error

func (*SqlPostStore) PermanentDeleteByUser

func (s *SqlPostStore) PermanentDeleteByUser(userId string) error

func (*SqlPostStore) Save

func (s *SqlPostStore) Save(post *model.Post) (*model.Post, error)

func (*SqlPostStore) SaveMultiple added in v5.22.0

func (s *SqlPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post, int, error)

func (*SqlPostStore) Search

func (s *SqlPostStore) Search(teamId string, userId string, params *model.SearchParams) (*model.PostList, error)

func (*SqlPostStore) SearchPostsInTeamForUser added in v5.22.0

func (s *SqlPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userId, teamId string, page, perPage int) (*model.PostSearchResults, error)

func (*SqlPostStore) Update

func (s *SqlPostStore) Update(newPost *model.Post, oldPost *model.Post) (*model.Post, error)

type SqlPreferenceStore

type SqlPreferenceStore struct {
	*SqlStore
}

func (SqlPreferenceStore) CleanupFlagsBatch

func (s SqlPreferenceStore) CleanupFlagsBatch(limit int64) (int64, error)

func (SqlPreferenceStore) Delete

func (s SqlPreferenceStore) Delete(userId, category, name string) error

func (SqlPreferenceStore) DeleteCategory

func (s SqlPreferenceStore) DeleteCategory(userId string, category string) error

func (SqlPreferenceStore) DeleteCategoryAndName

func (s SqlPreferenceStore) DeleteCategoryAndName(category string, name string) error

func (*SqlPreferenceStore) DeleteOrphanedRows added in v5.38.0

func (s *SqlPreferenceStore) DeleteOrphanedRows(limit int) (deleted int64, err error)

DeleteOrphanedRows removes entries from Preferences (flagged post) when a corresponding post no longer exists.

func (SqlPreferenceStore) Get

func (s SqlPreferenceStore) Get(userId string, category string, name string) (*model.Preference, error)

func (SqlPreferenceStore) GetAll

func (s SqlPreferenceStore) GetAll(userId string) (model.Preferences, error)

func (SqlPreferenceStore) GetCategory

func (s SqlPreferenceStore) GetCategory(userId string, category string) (model.Preferences, error)

func (SqlPreferenceStore) PermanentDeleteByUser

func (s SqlPreferenceStore) PermanentDeleteByUser(userId string) error

func (SqlPreferenceStore) Save

func (s SqlPreferenceStore) Save(preferences *model.Preferences) error

type SqlProductNoticesStore added in v5.28.0

type SqlProductNoticesStore struct {
	*SqlStore
}

func (SqlProductNoticesStore) Clear added in v5.28.0

func (s SqlProductNoticesStore) Clear(notices []string) error

func (SqlProductNoticesStore) ClearOldNotices added in v5.28.0

func (s SqlProductNoticesStore) ClearOldNotices(currentNotices *model.ProductNotices) error

func (SqlProductNoticesStore) GetViews added in v5.28.0

func (SqlProductNoticesStore) View added in v5.28.0

func (s SqlProductNoticesStore) View(userId string, notices []string) error

type SqlReactionStore

type SqlReactionStore struct {
	*SqlStore
}

func (*SqlReactionStore) BulkGetForPosts

func (s *SqlReactionStore) BulkGetForPosts(postIds []string) ([]*model.Reaction, error)

func (*SqlReactionStore) Delete

func (s *SqlReactionStore) Delete(reaction *model.Reaction) (*model.Reaction, error)

func (*SqlReactionStore) DeleteAllWithEmojiName

func (s *SqlReactionStore) DeleteAllWithEmojiName(emojiName string) error

func (*SqlReactionStore) DeleteOrphanedRows added in v5.38.0

func (s *SqlReactionStore) DeleteOrphanedRows(limit int) (deleted int64, err error)

DeleteOrphanedRows removes entries from Reactions when a corresponding post no longer exists.

func (*SqlReactionStore) GetForPost

func (s *SqlReactionStore) GetForPost(postId string, allowFromCache bool) ([]*model.Reaction, error)

GetForPost returns all reactions associated with `postId` that are not deleted.

func (*SqlReactionStore) GetForPostSince added in v5.35.0

func (s *SqlReactionStore) GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error)

GetForPostSince returns all reactions associated with `postId` updated after `since`.

func (*SqlReactionStore) PermanentDeleteBatch

func (s *SqlReactionStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error)

func (*SqlReactionStore) Save

func (s *SqlReactionStore) Save(reaction *model.Reaction) (*model.Reaction, error)

type SqlRetentionPolicyStore added in v5.36.0

type SqlRetentionPolicyStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (*SqlRetentionPolicyStore) AddChannels added in v5.36.0

func (s *SqlRetentionPolicyStore) AddChannels(policyId string, channelIds []string) error

func (*SqlRetentionPolicyStore) AddTeams added in v5.36.0

func (s *SqlRetentionPolicyStore) AddTeams(policyId string, teamIds []string) error

func (*SqlRetentionPolicyStore) Delete added in v5.36.0

func (s *SqlRetentionPolicyStore) Delete(id string) error

func (*SqlRetentionPolicyStore) DeleteOrphanedRows added in v5.38.0

func (s *SqlRetentionPolicyStore) DeleteOrphanedRows(limit int) (deleted int64, err error)

DeleteOrphanedRows removes entries from RetentionPoliciesChannels and RetentionPoliciesTeams where a channel or team no longer exists.

func (*SqlRetentionPolicyStore) Get added in v5.36.0

func (*SqlRetentionPolicyStore) GetAll added in v5.36.0

func (s *SqlRetentionPolicyStore) GetAll(offset, limit int) (policies []*model.RetentionPolicyWithTeamAndChannelCounts, err error)

func (*SqlRetentionPolicyStore) GetChannelPoliciesCountForUser added in v5.36.0

func (s *SqlRetentionPolicyStore) GetChannelPoliciesCountForUser(userID string) (int64, error)

func (*SqlRetentionPolicyStore) GetChannelPoliciesForUser added in v5.36.0

func (s *SqlRetentionPolicyStore) GetChannelPoliciesForUser(userID string, offset, limit int) (policies []*model.RetentionPolicyForChannel, err error)

func (*SqlRetentionPolicyStore) GetChannels added in v5.36.0

func (s *SqlRetentionPolicyStore) GetChannels(policyId string, offset, limit int) (channels model.ChannelListWithTeamData, err error)

func (*SqlRetentionPolicyStore) GetChannelsCount added in v5.36.0

func (s *SqlRetentionPolicyStore) GetChannelsCount(policyId string) (int64, error)

func (*SqlRetentionPolicyStore) GetCount added in v5.36.0

func (s *SqlRetentionPolicyStore) GetCount() (int64, error)

func (*SqlRetentionPolicyStore) GetTeamPoliciesCountForUser added in v5.36.0

func (s *SqlRetentionPolicyStore) GetTeamPoliciesCountForUser(userID string) (int64, error)

func (*SqlRetentionPolicyStore) GetTeamPoliciesForUser added in v5.36.0

func (s *SqlRetentionPolicyStore) GetTeamPoliciesForUser(userID string, offset, limit int) (policies []*model.RetentionPolicyForTeam, err error)

func (*SqlRetentionPolicyStore) GetTeams added in v5.36.0

func (s *SqlRetentionPolicyStore) GetTeams(policyId string, offset, limit int) (teams []*model.Team, err error)

func (*SqlRetentionPolicyStore) GetTeamsCount added in v5.36.0

func (s *SqlRetentionPolicyStore) GetTeamsCount(policyId string) (int64, error)

func (*SqlRetentionPolicyStore) Patch added in v5.36.0

func (*SqlRetentionPolicyStore) RemoveChannels added in v5.36.0

func (s *SqlRetentionPolicyStore) RemoveChannels(policyId string, channelIds []string) error

func (*SqlRetentionPolicyStore) RemoveTeams added in v5.36.0

func (s *SqlRetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) error

func (*SqlRetentionPolicyStore) Save added in v5.36.0

type SqlRoleStore

type SqlRoleStore struct {
	*SqlStore
}

func (*SqlRoleStore) AllChannelSchemeRoles added in v5.22.0

func (s *SqlRoleStore) AllChannelSchemeRoles() ([]*model.Role, error)

func (*SqlRoleStore) ChannelHigherScopedPermissions added in v5.22.0

func (s *SqlRoleStore) ChannelHigherScopedPermissions(roleNames []string) (map[string]*model.RolePermissions, error)

func (*SqlRoleStore) ChannelRolesUnderTeamRole added in v5.22.0

func (s *SqlRoleStore) ChannelRolesUnderTeamRole(roleName string) ([]*model.Role, error)

ChannelRolesUnderTeamRole finds all of the channel-scheme roles under the team of the given team-scheme role.

func (*SqlRoleStore) Delete

func (s *SqlRoleStore) Delete(roleId string) (*model.Role, error)

func (*SqlRoleStore) Get

func (s *SqlRoleStore) Get(roleId string) (*model.Role, error)

func (*SqlRoleStore) GetAll

func (s *SqlRoleStore) GetAll() ([]*model.Role, error)

func (*SqlRoleStore) GetByName

func (s *SqlRoleStore) GetByName(ctx context.Context, name string) (*model.Role, error)

func (*SqlRoleStore) GetByNames

func (s *SqlRoleStore) GetByNames(names []string) ([]*model.Role, error)

func (*SqlRoleStore) PermanentDeleteAll

func (s *SqlRoleStore) PermanentDeleteAll() error

func (*SqlRoleStore) Save

func (s *SqlRoleStore) Save(role *model.Role) (*model.Role, error)

type SqlSchemeStore

type SqlSchemeStore struct {
	*SqlStore
}

func (*SqlSchemeStore) CountByScope added in v5.22.0

func (s *SqlSchemeStore) CountByScope(scope string) (int64, error)

func (*SqlSchemeStore) CountWithoutPermission added in v5.22.0

func (s *SqlSchemeStore) CountWithoutPermission(schemeScope, permissionID string, roleScope model.RoleScope, roleType model.RoleType) (int64, error)

func (*SqlSchemeStore) Delete

func (s *SqlSchemeStore) Delete(schemeId string) (*model.Scheme, error)

func (*SqlSchemeStore) Get

func (s *SqlSchemeStore) Get(schemeId string) (*model.Scheme, error)

func (*SqlSchemeStore) GetAllPage

func (s *SqlSchemeStore) GetAllPage(scope string, offset int, limit int) ([]*model.Scheme, error)

func (*SqlSchemeStore) GetByName

func (s *SqlSchemeStore) GetByName(schemeName string) (*model.Scheme, error)

func (*SqlSchemeStore) PermanentDeleteAll

func (s *SqlSchemeStore) PermanentDeleteAll() error

func (*SqlSchemeStore) Save

func (s *SqlSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, error)

type SqlSessionStore

type SqlSessionStore struct {
	*SqlStore
}

func (SqlSessionStore) AnalyticsSessionCount

func (me SqlSessionStore) AnalyticsSessionCount() (int64, error)

func (SqlSessionStore) Cleanup

func (me SqlSessionStore) Cleanup(expiryTime int64, batchSize int64)

func (SqlSessionStore) Get

func (me SqlSessionStore) Get(ctx context.Context, sessionIdOrToken string) (*model.Session, error)

func (SqlSessionStore) GetSessions

func (me SqlSessionStore) GetSessions(userId string) ([]*model.Session, error)

func (SqlSessionStore) GetSessionsExpired added in v5.26.0

func (me SqlSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error)

func (SqlSessionStore) GetSessionsWithActiveDeviceIds

func (me SqlSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, error)

func (SqlSessionStore) PermanentDeleteSessionsByUser

func (me SqlSessionStore) PermanentDeleteSessionsByUser(userId string) error

func (SqlSessionStore) Remove

func (me SqlSessionStore) Remove(sessionIdOrToken string) error

func (SqlSessionStore) RemoveAllSessions

func (me SqlSessionStore) RemoveAllSessions() error

func (SqlSessionStore) Save

func (me SqlSessionStore) Save(session *model.Session) (*model.Session, error)

func (SqlSessionStore) UpdateDeviceId

func (me SqlSessionStore) UpdateDeviceId(id string, deviceId string, expiresAt int64) (string, error)

func (SqlSessionStore) UpdateExpiredNotify added in v5.26.0

func (me SqlSessionStore) UpdateExpiredNotify(sessionId string, notified bool) error

func (SqlSessionStore) UpdateExpiresAt added in v5.24.0

func (me SqlSessionStore) UpdateExpiresAt(sessionId string, time int64) error

func (SqlSessionStore) UpdateLastActivityAt

func (me SqlSessionStore) UpdateLastActivityAt(sessionId string, time int64) error

func (SqlSessionStore) UpdateProps

func (me SqlSessionStore) UpdateProps(session *model.Session) error

func (SqlSessionStore) UpdateRoles

func (me SqlSessionStore) UpdateRoles(userId, roles string) (string, error)

type SqlSharedChannelStore added in v5.35.0

type SqlSharedChannelStore struct {
	*SqlStore
}

func (SqlSharedChannelStore) Delete added in v5.35.0

func (s SqlSharedChannelStore) Delete(channelId string) (bool, error)

Delete deletes a single shared channel plus associated SharedChannelRemotes. Returns true if shared channel found and deleted, false if not found.

func (SqlSharedChannelStore) DeleteRemote added in v5.35.0

func (s SqlSharedChannelStore) DeleteRemote(id string) (bool, error)

DeleteRemote deletes a single shared channel remote. Returns true if remote found and deleted, false if not found.

func (SqlSharedChannelStore) Get added in v5.35.0

func (s SqlSharedChannelStore) Get(channelId string) (*model.SharedChannel, error)

Get fetches a shared channel by channel_id.

func (SqlSharedChannelStore) GetAll added in v5.35.0

func (s SqlSharedChannelStore) GetAll(offset, limit int, opts model.SharedChannelFilterOpts) ([]*model.SharedChannel, error)

GetAll fetches a paginated list of shared channels filtered by SharedChannelSearchOpts.

func (SqlSharedChannelStore) GetAllCount added in v5.35.0

GetAllCount returns the number of shared channels that would be fetched using SharedChannelSearchOpts.

func (SqlSharedChannelStore) GetAttachment added in v5.35.0

func (s SqlSharedChannelStore) GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error)

GetAttachment fetches a shared channel file attachment record based on file_id and remoteId.

func (SqlSharedChannelStore) GetRemote added in v5.35.0

GetRemote fetches a shared channel remote by id.

func (SqlSharedChannelStore) GetRemoteByIds added in v5.35.0

func (s SqlSharedChannelStore) GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error)

GetRemoteByIds fetches a shared channel remote by channel id and remote cluster id.

func (SqlSharedChannelStore) GetRemoteForUser added in v5.35.0

func (s SqlSharedChannelStore) GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error)

GetRemoteForUser returns a remote cluster for the given userId only if the user belongs to at least one channel shared with the remote.

func (SqlSharedChannelStore) GetRemotes added in v5.35.0

GetRemotes fetches all shared channel remotes associated with channel_id.

func (SqlSharedChannelStore) GetRemotesStatus added in v5.35.0

func (s SqlSharedChannelStore) GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error)

GetRemotesStatus returns the status for each remote invited to the specified shared channel.

func (SqlSharedChannelStore) GetSingleUser added in v5.36.0

func (s SqlSharedChannelStore) GetSingleUser(userID string, channelID string, remoteID string) (*model.SharedChannelUser, error)

GetSingleUser fetches a shared channel user based on userID, channelID and remoteID.

func (SqlSharedChannelStore) GetUsersForSync added in v5.36.0

func (s SqlSharedChannelStore) GetUsersForSync(filter model.GetUsersForSyncFilter) ([]*model.User, error)

GetUsersForSync fetches all shared channel users that need to be synchronized, meaning their `SharedChannelUsers.LastSyncAt` is less than or equal to `User.UpdateAt`.

func (SqlSharedChannelStore) GetUsersForUser added in v5.36.0

func (s SqlSharedChannelStore) GetUsersForUser(userID string) ([]*model.SharedChannelUser, error)

GetUsersForUser fetches all shared channel user records based on userID.

func (SqlSharedChannelStore) HasChannel added in v5.35.0

func (s SqlSharedChannelStore) HasChannel(channelID string) (bool, error)

HasChannel returns whether a given channelID is a shared channel or not.

func (SqlSharedChannelStore) HasRemote added in v5.35.0

func (s SqlSharedChannelStore) HasRemote(channelID string, remoteId string) (bool, error)

HasRemote returns whether a given remoteId and channelId are present in the shared channel remotes or not.

func (SqlSharedChannelStore) Save added in v5.35.0

Save inserts a new shared channel record.

func (SqlSharedChannelStore) SaveAttachment added in v5.35.0

SaveAttachment inserts a new shared channel file attachment record to the SharedChannelFiles table.

func (SqlSharedChannelStore) SaveRemote added in v5.35.0

SaveRemote inserts a new shared channel remote record.

func (SqlSharedChannelStore) SaveUser added in v5.35.0

SaveUser inserts a new shared channel user record to the SharedChannelUsers table.

func (SqlSharedChannelStore) Update added in v5.35.0

Update updates the shared channel.

func (SqlSharedChannelStore) UpdateAttachmentLastSyncAt added in v5.35.0

func (s SqlSharedChannelStore) UpdateAttachmentLastSyncAt(id string, syncTime int64) error

UpdateAttachmentLastSyncAt updates the LastSyncAt timestamp for the specified SharedChannelAttachment.

func (SqlSharedChannelStore) UpdateRemote added in v5.35.0

Update updates the shared channel remote.

func (SqlSharedChannelStore) UpdateRemoteCursor added in v5.36.0

func (s SqlSharedChannelStore) UpdateRemoteCursor(id string, cursor model.GetPostsSinceForSyncCursor) error

UpdateRemoteCursor updates the LastPostUpdateAt timestamp and LastPostId for the specified SharedChannelRemote.

func (SqlSharedChannelStore) UpdateUserLastSyncAt added in v5.35.0

func (s SqlSharedChannelStore) UpdateUserLastSyncAt(userID string, channelID string, remoteID string) error

UpdateUserLastSyncAt updates the LastSyncAt timestamp for the specified SharedChannelUser.

func (SqlSharedChannelStore) UpsertAttachment added in v5.35.0

func (s SqlSharedChannelStore) UpsertAttachment(attachment *model.SharedChannelAttachment) (string, error)

UpsertAttachment inserts a new shared channel file attachment record to the SharedChannelFiles table or updates its LastSyncAt.

type SqlStatusStore

type SqlStatusStore struct {
	*SqlStore
}

func (SqlStatusStore) Get

func (s SqlStatusStore) Get(userId string) (*model.Status, error)

func (SqlStatusStore) GetByIds

func (s SqlStatusStore) GetByIds(userIds []string) ([]*model.Status, error)

func (SqlStatusStore) GetTotalActiveUsersCount

func (s SqlStatusStore) GetTotalActiveUsersCount() (int64, error)

func (SqlStatusStore) ResetAll

func (s SqlStatusStore) ResetAll() error

func (SqlStatusStore) SaveOrUpdate

func (s SqlStatusStore) SaveOrUpdate(st *model.Status) error

func (SqlStatusStore) UpdateExpiredDNDStatuses added in v5.37.0

func (s SqlStatusStore) UpdateExpiredDNDStatuses() ([]*model.Status, error)

func (SqlStatusStore) UpdateLastActivityAt

func (s SqlStatusStore) UpdateLastActivityAt(userId string, lastActivityAt int64) error

type SqlStore

type SqlStore struct {
	Replicas []*gorp.DbMap
	// contains filtered or unexported fields
}

func New added in v5.32.0

func New(settings model.SqlSettings, metrics einterfaces.MetricsInterface) *SqlStore

func (*SqlStore) AlterColumnTypeIfExists

func (ss *SqlStore) AlterColumnTypeIfExists(tableName string, columnName string, mySqlColType string, postgresColType string) bool

func (*SqlStore) AlterDefaultIfColumnExists added in v5.37.0

func (ss *SqlStore) AlterDefaultIfColumnExists(tableName string, columnName string, mySqlColDefault *string, postgresColDefault *string) bool

func (*SqlStore) AlterPrimaryKey added in v5.22.0

func (ss *SqlStore) AlterPrimaryKey(tableName string, columnNames []string) bool

func (*SqlStore) Audit

func (ss *SqlStore) Audit() store.AuditStore

func (*SqlStore) Bot

func (ss *SqlStore) Bot() store.BotStore

func (*SqlStore) Channel

func (ss *SqlStore) Channel() store.ChannelStore

func (*SqlStore) ChannelMemberHistory added in v5.32.0

func (ss *SqlStore) ChannelMemberHistory() store.ChannelMemberHistoryStore

func (*SqlStore) CheckIntegrity added in v5.32.0

func (ss *SqlStore) CheckIntegrity() <-chan model.IntegrityCheckResult

func (*SqlStore) Close

func (ss *SqlStore) Close()

func (*SqlStore) ClusterDiscovery

func (ss *SqlStore) ClusterDiscovery() store.ClusterDiscoveryStore

func (*SqlStore) Command

func (ss *SqlStore) Command() store.CommandStore

func (*SqlStore) CommandWebhook

func (ss *SqlStore) CommandWebhook() store.CommandWebhookStore

func (*SqlStore) Compliance

func (ss *SqlStore) Compliance() store.ComplianceStore

func (*SqlStore) Context added in v5.32.0

func (ss *SqlStore) Context() context.Context

func (*SqlStore) CreateColumnIfNotExists

func (ss *SqlStore) CreateColumnIfNotExists(tableName string, columnName string, mySqlColType string, postgresColType string, defaultValue string) bool

func (*SqlStore) CreateColumnIfNotExistsNoDefault

func (ss *SqlStore) CreateColumnIfNotExistsNoDefault(tableName string, columnName string, mySqlColType string, postgresColType string) bool

func (*SqlStore) CreateCompositeIndexIfNotExists

func (ss *SqlStore) CreateCompositeIndexIfNotExists(indexName string, tableName string, columnNames []string) bool

func (*SqlStore) CreateForeignKeyIfNotExists added in v5.36.0

func (ss *SqlStore) CreateForeignKeyIfNotExists(
	tableName, columnName, refTableName, refColumnName string,
	onDeleteCascade bool,
) (err error)

func (*SqlStore) CreateFullTextFuncIndexIfNotExists added in v5.35.0

func (ss *SqlStore) CreateFullTextFuncIndexIfNotExists(indexName string, tableName string, function string) bool

func (*SqlStore) CreateFullTextIndexIfNotExists

func (ss *SqlStore) CreateFullTextIndexIfNotExists(indexName string, tableName string, columnName string) bool

func (*SqlStore) CreateIndexIfNotExists

func (ss *SqlStore) CreateIndexIfNotExists(indexName string, tableName string, columnName string) bool

func (*SqlStore) CreateUniqueCompositeIndexIfNotExists added in v5.26.0

func (ss *SqlStore) CreateUniqueCompositeIndexIfNotExists(indexName string, tableName string, columnNames []string) bool

func (*SqlStore) CreateUniqueIndexIfNotExists

func (ss *SqlStore) CreateUniqueIndexIfNotExists(indexName string, tableName string, columnName string) bool

func (*SqlStore) DBFromContext added in v5.33.0

func (ss *SqlStore) DBFromContext(ctx context.Context) *gorp.DbMap

DBFromContext is a helper utility that returns the DB handle from a given context.

func (*SqlStore) DoesColumnExist

func (ss *SqlStore) DoesColumnExist(tableName string, columnName string) bool

func (*SqlStore) DoesIndexExist added in v5.38.0

func (ss *SqlStore) DoesIndexExist(indexName string, tableName string) bool

func (*SqlStore) DoesTableExist

func (ss *SqlStore) DoesTableExist(tableName string) bool

func (*SqlStore) DoesTriggerExist

func (ss *SqlStore) DoesTriggerExist(triggerName string) bool

func (*SqlStore) DriverName

func (ss *SqlStore) DriverName() string

func (*SqlStore) DropAllTables added in v5.32.0

func (ss *SqlStore) DropAllTables()

func (*SqlStore) Emoji

func (ss *SqlStore) Emoji() store.EmojiStore

func (*SqlStore) FileInfo

func (ss *SqlStore) FileInfo() store.FileInfoStore

func (*SqlStore) GetAllConns

func (ss *SqlStore) GetAllConns() []*gorp.DbMap

func (*SqlStore) GetColumnInfo added in v5.30.0

func (ss *SqlStore) GetColumnInfo(tableName, columnName string) (*ColumnInfo, error)

GetColumnInfo returns data type information about the given column.

func (*SqlStore) GetCurrentSchemaVersion

func (ss *SqlStore) GetCurrentSchemaVersion() string

func (*SqlStore) GetDbVersion added in v5.23.0

func (ss *SqlStore) GetDbVersion(numerical bool) (string, error)

GetDbVersion returns the version of the database being used. If numerical is set to true, it attempts to return a numerical version string that can be parsed by callers.

func (*SqlStore) GetLicense added in v5.34.0

func (ss *SqlStore) GetLicense() *model.License

func (*SqlStore) GetMaster

func (ss *SqlStore) GetMaster() *gorp.DbMap

func (*SqlStore) GetMaxLengthOfColumnIfExists

func (ss *SqlStore) GetMaxLengthOfColumnIfExists(tableName string, columnName string) string

func (*SqlStore) GetReplica

func (ss *SqlStore) GetReplica() *gorp.DbMap

func (*SqlStore) GetSearchReplica

func (ss *SqlStore) GetSearchReplica() *gorp.DbMap

func (*SqlStore) Group added in v5.32.0

func (ss *SqlStore) Group() store.GroupStore

func (*SqlStore) IsVarchar added in v5.30.0

func (ss *SqlStore) IsVarchar(columnType string) bool

IsVarchar returns true if the column type matches one of the varchar types either in MySQL or PostgreSQL.

func (*SqlStore) Job

func (ss *SqlStore) Job() store.JobStore

func (*SqlStore) License

func (ss *SqlStore) License() store.LicenseStore

func (*SqlStore) LinkMetadata

func (ss *SqlStore) LinkMetadata() store.LinkMetadataStore

func (*SqlStore) LockToMaster

func (ss *SqlStore) LockToMaster()

func (*SqlStore) MarkSystemRanUnitTests

func (ss *SqlStore) MarkSystemRanUnitTests()

func (*SqlStore) OAuth

func (ss *SqlStore) OAuth() store.OAuthStore

func (*SqlStore) Plugin

func (ss *SqlStore) Plugin() store.PluginStore

func (*SqlStore) Post

func (ss *SqlStore) Post() store.PostStore

func (*SqlStore) Preference

func (ss *SqlStore) Preference() store.PreferenceStore

func (*SqlStore) ProductNotices added in v5.32.0

func (ss *SqlStore) ProductNotices() store.ProductNoticesStore

func (*SqlStore) Reaction

func (ss *SqlStore) Reaction() store.ReactionStore

func (*SqlStore) RecycleDBConnections added in v5.32.0

func (ss *SqlStore) RecycleDBConnections(d time.Duration)

RecycleDBConnections closes active connections by setting the max conn lifetime to d, and then resets them back to their original duration.

func (*SqlStore) RemoteCluster added in v5.35.0

func (ss *SqlStore) RemoteCluster() store.RemoteClusterStore

func (*SqlStore) RemoveColumnIfExists

func (ss *SqlStore) RemoveColumnIfExists(tableName string, columnName string) bool

func (*SqlStore) RemoveDefaultIfColumnExists added in v5.37.0

func (ss *SqlStore) RemoveDefaultIfColumnExists(tableName, columnName string) bool

func (*SqlStore) RemoveIndexIfExists

func (ss *SqlStore) RemoveIndexIfExists(indexName string, tableName string) bool

func (*SqlStore) RemoveTableIfExists

func (ss *SqlStore) RemoveTableIfExists(tableName string) bool

func (*SqlStore) RenameColumnIfExists

func (ss *SqlStore) RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool

func (*SqlStore) ReplicaLagAbs added in v5.35.0

func (ss *SqlStore) ReplicaLagAbs() error

ReplicaLagAbs queries all the replica databases to get the absolute replica lag value and updates the Prometheus metric with it.

func (*SqlStore) ReplicaLagTime added in v5.35.0

func (ss *SqlStore) ReplicaLagTime() error

ReplicaLagAbs queries all the replica databases to get the time-based replica lag value and updates the Prometheus metric with it.

func (*SqlStore) RetentionPolicy added in v5.36.0

func (ss *SqlStore) RetentionPolicy() store.RetentionPolicyStore

func (*SqlStore) Role

func (ss *SqlStore) Role() store.RoleStore

func (*SqlStore) Scheme

func (ss *SqlStore) Scheme() store.SchemeStore

func (*SqlStore) Session

func (ss *SqlStore) Session() store.SessionStore

func (*SqlStore) SetContext added in v5.32.0

func (ss *SqlStore) SetContext(context context.Context)

func (*SqlStore) SharedChannel added in v5.35.0

func (ss *SqlStore) SharedChannel() store.SharedChannelStore

func (*SqlStore) Status

func (ss *SqlStore) Status() store.StatusStore

func (*SqlStore) System

func (ss *SqlStore) System() store.SystemStore

func (*SqlStore) Team

func (ss *SqlStore) Team() store.TeamStore

func (*SqlStore) TermsOfService

func (ss *SqlStore) TermsOfService() store.TermsOfServiceStore

func (*SqlStore) Thread added in v5.29.0

func (ss *SqlStore) Thread() store.ThreadStore

func (*SqlStore) Token

func (ss *SqlStore) Token() store.TokenStore

func (*SqlStore) TotalMasterDbConnections

func (ss *SqlStore) TotalMasterDbConnections() int

func (*SqlStore) TotalReadDbConnections

func (ss *SqlStore) TotalReadDbConnections() int

func (*SqlStore) TotalSearchDbConnections

func (ss *SqlStore) TotalSearchDbConnections() int

func (*SqlStore) UnlockFromMaster

func (ss *SqlStore) UnlockFromMaster()

func (*SqlStore) UpdateLicense added in v5.32.0

func (ss *SqlStore) UpdateLicense(license *model.License)

func (*SqlStore) UploadSession added in v5.28.0

func (ss *SqlStore) UploadSession() store.UploadSessionStore

func (*SqlStore) User

func (ss *SqlStore) User() store.UserStore

func (*SqlStore) UserAccessToken

func (ss *SqlStore) UserAccessToken() store.UserAccessTokenStore

func (*SqlStore) UserTermsOfService

func (ss *SqlStore) UserTermsOfService() store.UserTermsOfServiceStore

func (*SqlStore) Webhook

func (ss *SqlStore) Webhook() store.WebhookStore

type SqlStoreStores added in v5.32.0

type SqlStoreStores struct {
	TermsOfService store.TermsOfServiceStore

	UserTermsOfService store.UserTermsOfServiceStore
	// contains filtered or unexported fields
}

type SqlSystemStore

type SqlSystemStore struct {
	*SqlStore
}

func (SqlSystemStore) Get

func (s SqlSystemStore) Get() (model.StringMap, error)

func (SqlSystemStore) GetByName

func (s SqlSystemStore) GetByName(name string) (*model.System, error)

func (SqlSystemStore) InsertIfExists added in v5.26.0

func (s SqlSystemStore) InsertIfExists(system *model.System) (*model.System, error)

InsertIfExists inserts a given system value if it does not already exist. If a value already exists, it returns the old one, else returns the new one.

func (SqlSystemStore) PermanentDeleteByName

func (s SqlSystemStore) PermanentDeleteByName(name string) (*model.System, error)

func (SqlSystemStore) Save

func (s SqlSystemStore) Save(system *model.System) error

func (SqlSystemStore) SaveOrUpdate

func (s SqlSystemStore) SaveOrUpdate(system *model.System) error

func (SqlSystemStore) SaveOrUpdateWithWarnMetricHandling added in v5.28.0

func (s SqlSystemStore) SaveOrUpdateWithWarnMetricHandling(system *model.System) error

func (SqlSystemStore) Update

func (s SqlSystemStore) Update(system *model.System) error

type SqlTeamStore

type SqlTeamStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (SqlTeamStore) AnalyticsGetTeamCountForScheme

func (s SqlTeamStore) AnalyticsGetTeamCountForScheme(schemeId string) (int64, error)

AnalyticsGetTeamCountForScheme returns the number of active teams that match the schemeId passed as parameter.

func (SqlTeamStore) AnalyticsTeamCount

func (s SqlTeamStore) AnalyticsTeamCount(opts *model.TeamSearch) (int64, error)

AnalyticsTeamCount returns the total number of teams.

func (SqlTeamStore) ClearAllCustomRoleAssignments

func (s SqlTeamStore) ClearAllCustomRoleAssignments() error

ClearAllCustomRoleAssignments removes all custom role assignments from TeamMembers.

func (SqlTeamStore) ClearCaches

func (s SqlTeamStore) ClearCaches()

ClearCaches method not implemented.

func (SqlTeamStore) Get

func (s SqlTeamStore) Get(id string) (*model.Team, error)

Get returns from the database the team that matches the id provided as parameter. If the team doesn't exist it returns a model.AppError with a http.StatusNotFound in the StatusCode field.

func (SqlTeamStore) GetActiveMemberCount

func (s SqlTeamStore) GetActiveMemberCount(teamId string, restrictions *model.ViewUsersRestrictions) (int64, error)

GetActiveMemberCount returns the number of active members in a team for the teamId passed as a parameter i.e. members with 'DeleteAt = 0' Expects a restrictions parameter of type ViewUsersRestrictions that defines a set of Teams and Channels that are visible to the caller of the query, and applies restrictions with a filtered result.

func (SqlTeamStore) GetAll

func (s SqlTeamStore) GetAll() ([]*model.Team, error)

GetAll returns all teams

func (SqlTeamStore) GetAllForExportAfter

func (s SqlTeamStore) GetAllForExportAfter(limit int, afterId string) ([]*model.TeamForExport, error)

GetAllForExportAfter returns teams for export, up to a total limit passed as paramater where Teams.Id is greater than the afterId passed as parameter.

func (SqlTeamStore) GetAllPage

func (s SqlTeamStore) GetAllPage(offset int, limit int, opts *model.TeamSearch) ([]*model.Team, error)

GetAllPage returns teams, up to a total limit passed as parameter and paginated by offset number passed as parameter.

func (SqlTeamStore) GetAllPrivateTeamListing

func (s SqlTeamStore) GetAllPrivateTeamListing() ([]*model.Team, error)

GetAllPrivateTeamListing returns all private teams.

func (SqlTeamStore) GetAllTeamListing

func (s SqlTeamStore) GetAllTeamListing() ([]*model.Team, error)

GetAllTeamListing returns all public teams.

func (SqlTeamStore) GetByInviteId

func (s SqlTeamStore) GetByInviteId(inviteId string) (*model.Team, error)

GetByInviteId returns from the database the team that matches the inviteId provided as parameter. If the parameter provided is empty or if there is no match in the database, it returns a model.AppError with a http.StatusNotFound in the StatusCode field.

func (SqlTeamStore) GetByName

func (s SqlTeamStore) GetByName(name string) (*model.Team, error)

GetByName returns from the database the team that matches the name provided as parameter. If there is no match in the database, it returns a model.AppError with a http.StatusNotFound in the StatusCode field.

func (SqlTeamStore) GetByNames added in v5.22.0

func (s SqlTeamStore) GetByNames(names []string) ([]*model.Team, error)

func (SqlTeamStore) GetChannelUnreadsForAllTeams

func (s SqlTeamStore) GetChannelUnreadsForAllTeams(excludeTeamId, userId string) ([]*model.ChannelUnread, error)

GetChannelUnreadsForAllTeams returns unreads msg count, mention counts, and notifyProps for all the channels in all the teams except the excluded ones.

func (SqlTeamStore) GetChannelUnreadsForTeam

func (s SqlTeamStore) GetChannelUnreadsForTeam(teamId, userId string) ([]*model.ChannelUnread, error)

GetChannelUnreadsForTeam returns unreads msg count, mention counts and notifyProps for all the channels in a single team.

func (SqlTeamStore) GetCommonTeamIDsForTwoUsers added in v5.36.0

func (s SqlTeamStore) GetCommonTeamIDsForTwoUsers(userID, otherUserID string) ([]string, error)

GetCommonTeamIDsForTwoUsers returns the intersection of all the teams to which the specified users belong.

func (SqlTeamStore) GetMember

func (s SqlTeamStore) GetMember(ctx context.Context, teamId string, userId string) (*model.TeamMember, error)

GetMember returns a single member of the team that matches the teamId and userId provided as parameters.

func (SqlTeamStore) GetMembers

func (s SqlTeamStore) GetMembers(teamId string, offset int, limit int, teamMembersGetOptions *model.TeamMembersGetOptions) ([]*model.TeamMember, error)

GetMembers returns a list of members from the database that matches the teamId passed as parameter and, also expects teamMembersGetOptions to be passed as a parameter which allows to further filter what to show in the result. TeamMembersGetOptions Model has following options-> 1. Sort through USERNAME [ if provided, which otherwise defaults to ID ] 2. Sort through USERNAME [ if provided, which otherwise defaults to ID ] and exclude deleted members. 3. Return all the members but, exclude deleted ones. 4. Apply ViewUsersRestrictions to restrict what is visible to the user.

func (SqlTeamStore) GetMembersByIds

func (s SqlTeamStore) GetMembersByIds(teamId string, userIds []string, restrictions *model.ViewUsersRestrictions) ([]*model.TeamMember, error)

GetMembersByIds returns a list of members from the database that matches the teamId and the list of userIds passed as parameters. Expects a restrictions parameter of type ViewUsersRestrictions that defines a set of Teams and Channels that are visible to the caller of the query, and applies restrictions with a filtered result.

func (SqlTeamStore) GetTeamMembersForExport

func (s SqlTeamStore) GetTeamMembersForExport(userId string) ([]*model.TeamMemberForExport, error)

GetTeamMembersForExport gets the various teams for which a user, denoted by userId, is a part of.

func (SqlTeamStore) GetTeamsByScheme

func (s SqlTeamStore) GetTeamsByScheme(schemeId string, offset int, limit int) ([]*model.Team, error)

GetTeamsByScheme returns from the database all teams that match the schemeId provided as parameter, up to a total limit passed as paramater and paginated by offset number passed as parameter.

func (SqlTeamStore) GetTeamsByUserId

func (s SqlTeamStore) GetTeamsByUserId(userId string) ([]*model.Team, error)

GetTeamsByUserId returns from the database all teams that userId belongs to.

func (SqlTeamStore) GetTeamsForUser

func (s SqlTeamStore) GetTeamsForUser(ctx context.Context, userId string) ([]*model.TeamMember, error)

GetTeamsForUser returns a list of teams that the user is a member of. Expects userId to be passed as a parameter.

func (SqlTeamStore) GetTeamsForUserWithPagination

func (s SqlTeamStore) GetTeamsForUserWithPagination(userId string, page, perPage int) ([]*model.TeamMember, error)

GetTeamsForUserWithPagination returns limited TeamMembers according to the perPage parameter specified. It also offsets the records as per the page parameter supplied.

func (SqlTeamStore) GetTotalMemberCount

func (s SqlTeamStore) GetTotalMemberCount(teamId string, restrictions *model.ViewUsersRestrictions) (int64, error)

GetTotalMemberCount returns the number of all members in a team for the teamId passed as a parameter. Expects a restrictions parameter of type ViewUsersRestrictions that defines a set of Teams and Channels that are visible to the caller of the query, and applies restrictions with a filtered result.

func (SqlTeamStore) GetUserTeamIds

func (s SqlTeamStore) GetUserTeamIds(userId string, allowFromCache bool) ([]string, error)

GetUserTeamIds get the team ids to which the user belongs to. allowFromCache parameter does not have any effect in this Store

func (SqlTeamStore) GroupSyncedTeamCount added in v5.22.0

func (s SqlTeamStore) GroupSyncedTeamCount() (int64, error)

GroupSyncedTeamCount returns the number of teams that are group constrained.

func (SqlTeamStore) InvalidateAllTeamIdsForUser

func (s SqlTeamStore) InvalidateAllTeamIdsForUser(userId string)

InvalidateAllTeamIdsForUser does not execute anything because the store does not handle the cache.

func (SqlTeamStore) MigrateTeamMembers

func (s SqlTeamStore) MigrateTeamMembers(fromTeamId string, fromUserId string) (map[string]string, error)

MigrateTeamMembers performs the Advanced Permissions Phase 2 migration for TeamMember objects. Migration is done in batches as a single transaction per batch to ensure consistency but to also minimise execution time to avoid causing unnecessary table locks. **THIS FUNCTION SHOULD NOT BE USED FOR ANY OTHER PURPOSE.** Executing this function *after* the new Schemes functionality has been used on an installation will have unintended consequences.

func (SqlTeamStore) PermanentDelete

func (s SqlTeamStore) PermanentDelete(teamId string) error

PermanentDelete permanently deletes from the database the team entry that matches the teamId passed as parameter. To soft-delete the team you can Update it with the DeleteAt field set to the current millisecond using model.GetMillis()

func (SqlTeamStore) RemoveAllMembersByTeam

func (s SqlTeamStore) RemoveAllMembersByTeam(teamId string) error

RemoveAllMembersByTeam removes from the database the team members that belong to the teamId passed as parameter.

func (SqlTeamStore) RemoveAllMembersByUser

func (s SqlTeamStore) RemoveAllMembersByUser(userId string) error

RemoveAllMembersByUser removes from the database the team members that match the userId passed as parameter.

func (SqlTeamStore) RemoveMember

func (s SqlTeamStore) RemoveMember(teamId string, userId string) error

RemoveMember remove from the database the team members that match the userId and teamId passed as parameter.

func (SqlTeamStore) RemoveMembers added in v5.24.0

func (s SqlTeamStore) RemoveMembers(teamId string, userIds []string) error

func (SqlTeamStore) ResetAllTeamSchemes

func (s SqlTeamStore) ResetAllTeamSchemes() error

ResetAllTeamSchemes Set all Team's SchemeId values to an empty string.

func (SqlTeamStore) Save

func (s SqlTeamStore) Save(team *model.Team) (*model.Team, error)

Save adds the team to the database if a team with the same name does not already exist in the database. It returns the team added if the operation is successful.

func (SqlTeamStore) SaveMember

func (s SqlTeamStore) SaveMember(member *model.TeamMember, maxUsersPerTeam int) (*model.TeamMember, error)

func (SqlTeamStore) SaveMultipleMembers added in v5.24.0

func (s SqlTeamStore) SaveMultipleMembers(members []*model.TeamMember, maxUsersPerTeam int) ([]*model.TeamMember, error)

func (SqlTeamStore) SearchAll

func (s SqlTeamStore) SearchAll(opts *model.TeamSearch) ([]*model.Team, error)

SearchAll returns from the database a list of teams that match the Name or DisplayName passed as the term search parameter.

func (SqlTeamStore) SearchAllPaged

func (s SqlTeamStore) SearchAllPaged(opts *model.TeamSearch) ([]*model.Team, int64, error)

SearchAllPaged returns a teams list and the total count of teams that matched the search.

func (SqlTeamStore) SearchOpen

func (s SqlTeamStore) SearchOpen(opts *model.TeamSearch) ([]*model.Team, error)

SearchOpen returns from the database a list of public teams that match the Name or DisplayName passed as the term search parameter.

func (SqlTeamStore) SearchPrivate

func (s SqlTeamStore) SearchPrivate(opts *model.TeamSearch) ([]*model.Team, error)

SearchPrivate returns from the database a list of private teams that match the Name or DisplayName passed as the term search parameter.

func (SqlTeamStore) Update

func (s SqlTeamStore) Update(team *model.Team) (*model.Team, error)

Update updates the details of the team passed as the parameter using the team Id if the team exists in the database. It returns the updated team if the operation is successful.

func (SqlTeamStore) UpdateLastTeamIconUpdate

func (s SqlTeamStore) UpdateLastTeamIconUpdate(teamId string, curTime int64) error

UpdateLastTeamIconUpdate sets the last updated time for the icon based on the parameter passed in teamId. The LastTeamIconUpdate and UpdateAt fields are set to the parameter passed in curTime. Returns nil on success and an error otherwise.

func (SqlTeamStore) UpdateMember

func (s SqlTeamStore) UpdateMember(member *model.TeamMember) (*model.TeamMember, error)

func (SqlTeamStore) UpdateMembersRole added in v5.20.0

func (s SqlTeamStore) UpdateMembersRole(teamID string, userIDs []string) error

UpdateMembersRole updates all the members of teamID in the userIds string array to be admins and sets all other users as not being admin.

func (SqlTeamStore) UpdateMultipleMembers added in v5.24.0

func (s SqlTeamStore) UpdateMultipleMembers(members []*model.TeamMember) ([]*model.TeamMember, error)

func (SqlTeamStore) UserBelongsToTeams

func (s SqlTeamStore) UserBelongsToTeams(userId string, teamIds []string) (bool, error)

UserBelongsToTeams returns true if the user denoted by userId is a member of the teams in the teamIds string array.

type SqlTermsOfServiceStore

type SqlTermsOfServiceStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (SqlTermsOfServiceStore) Get

func (s SqlTermsOfServiceStore) Get(id string, allowFromCache bool) (*model.TermsOfService, error)

func (SqlTermsOfServiceStore) GetLatest

func (s SqlTermsOfServiceStore) GetLatest(allowFromCache bool) (*model.TermsOfService, error)

func (SqlTermsOfServiceStore) Save

type SqlThreadStore added in v5.29.0

type SqlThreadStore struct {
	*SqlStore
}

func (*SqlThreadStore) ClearCaches added in v5.29.0

func (s *SqlThreadStore) ClearCaches()

func (*SqlThreadStore) CollectThreadsWithNewerReplies added in v5.29.0

func (s *SqlThreadStore) CollectThreadsWithNewerReplies(userId string, channelIds []string, timestamp int64) ([]string, error)

func (*SqlThreadStore) Delete added in v5.29.0

func (s *SqlThreadStore) Delete(threadId string) error

func (*SqlThreadStore) DeleteMembershipForUser added in v5.29.0

func (s *SqlThreadStore) DeleteMembershipForUser(userId string, postId string) error

func (*SqlThreadStore) DeleteOrphanedRows added in v5.38.0

func (s *SqlThreadStore) DeleteOrphanedRows(limit int) (deleted int64, err error)

DeleteOrphanedRows removes orphaned rows from Threads and ThreadMemberships

func (*SqlThreadStore) Get added in v5.29.0

func (s *SqlThreadStore) Get(id string) (*model.Thread, error)

func (*SqlThreadStore) GetMembershipForUser added in v5.29.0

func (s *SqlThreadStore) GetMembershipForUser(userId, postId string) (*model.ThreadMembership, error)

func (*SqlThreadStore) GetMembershipsForUser added in v5.29.0

func (s *SqlThreadStore) GetMembershipsForUser(userId, teamId string) ([]*model.ThreadMembership, error)

func (*SqlThreadStore) GetPosts added in v5.29.1

func (s *SqlThreadStore) GetPosts(threadId string, since int64) ([]*model.Post, error)

func (*SqlThreadStore) GetThreadFollowers added in v5.36.0

func (s *SqlThreadStore) GetThreadFollowers(threadID string) ([]string, error)

func (*SqlThreadStore) GetThreadForUser added in v5.33.0

func (s *SqlThreadStore) GetThreadForUser(teamId string, threadMembership *model.ThreadMembership, extended bool) (*model.ThreadResponse, error)

func (*SqlThreadStore) GetThreadsForUser added in v5.30.0

func (s *SqlThreadStore) GetThreadsForUser(userId, teamId string, opts model.GetUserThreadsOpts) (*model.Threads, error)

func (*SqlThreadStore) MaintainMembership added in v5.34.0

func (s *SqlThreadStore) MaintainMembership(userId, postId string, opts store.ThreadMembershipOpts) (*model.ThreadMembership, error)

MaintainMembership creates or updates a thread membership for the given user and post. This method is used to update the state of a membership in response to some events like: - post creation (mentions handling) - channel marked unread - user explicitly following a thread

func (*SqlThreadStore) MarkAllAsRead added in v5.30.0

func (s *SqlThreadStore) MarkAllAsRead(userId, teamId string) error

func (*SqlThreadStore) MarkAllAsReadInChannels added in v5.37.0

func (s *SqlThreadStore) MarkAllAsReadInChannels(userID string, channelIDs []string) error

func (*SqlThreadStore) MarkAsRead added in v5.30.0

func (s *SqlThreadStore) MarkAsRead(userId, threadId string, timestamp int64) error

func (*SqlThreadStore) PermanentDeleteBatchForRetentionPolicies added in v5.38.0

func (s *SqlThreadStore) PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error)

PermanentDeleteBatchForRetentionPolicies deletes a batch of records which are affected by the global or a granular retention policy. See `genericPermanentDeleteBatchForRetentionPolicies` for details.

func (*SqlThreadStore) PermanentDeleteBatchThreadMembershipsForRetentionPolicies added in v5.38.0

func (s *SqlThreadStore) PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error)

PermanentDeleteBatchThreadMembershipsForRetentionPolicies deletes a batch of records which are affected by the global or a granular retention policy. See `genericPermanentDeleteBatchForRetentionPolicies` for details.

func (*SqlThreadStore) Save added in v5.29.0

func (s *SqlThreadStore) Save(thread *model.Thread) (*model.Thread, error)

func (*SqlThreadStore) SaveMembership added in v5.29.0

func (s *SqlThreadStore) SaveMembership(membership *model.ThreadMembership) (*model.ThreadMembership, error)

func (*SqlThreadStore) SaveMultiple added in v5.29.0

func (s *SqlThreadStore) SaveMultiple(threads []*model.Thread) ([]*model.Thread, int, error)

func (*SqlThreadStore) Update added in v5.29.0

func (s *SqlThreadStore) Update(thread *model.Thread) (*model.Thread, error)

func (*SqlThreadStore) UpdateMembership added in v5.29.0

func (s *SqlThreadStore) UpdateMembership(membership *model.ThreadMembership) (*model.ThreadMembership, error)

func (*SqlThreadStore) UpdateUnreadsByChannel added in v5.29.0

func (s *SqlThreadStore) UpdateUnreadsByChannel(userId string, changedThreads []string, timestamp int64, updateViewedTimestamp bool) error

type SqlTokenStore

type SqlTokenStore struct {
	*SqlStore
}

func (SqlTokenStore) Cleanup

func (s SqlTokenStore) Cleanup()

func (SqlTokenStore) Delete

func (s SqlTokenStore) Delete(token string) error

func (SqlTokenStore) GetAllTokensByType added in v5.38.0

func (s SqlTokenStore) GetAllTokensByType(tokenType string) ([]*model.Token, error)

func (SqlTokenStore) GetByToken

func (s SqlTokenStore) GetByToken(tokenString string) (*model.Token, error)

func (SqlTokenStore) RemoveAllTokensByType

func (s SqlTokenStore) RemoveAllTokensByType(tokenType string) error

func (SqlTokenStore) Save

func (s SqlTokenStore) Save(token *model.Token) error

type SqlUploadSessionStore added in v5.28.0

type SqlUploadSessionStore struct {
	*SqlStore
}

func (SqlUploadSessionStore) Delete added in v5.28.0

func (us SqlUploadSessionStore) Delete(id string) error

func (SqlUploadSessionStore) Get added in v5.28.0

func (SqlUploadSessionStore) GetForUser added in v5.28.0

func (us SqlUploadSessionStore) GetForUser(userId string) ([]*model.UploadSession, error)

func (SqlUploadSessionStore) Save added in v5.28.0

func (SqlUploadSessionStore) Update added in v5.28.0

func (us SqlUploadSessionStore) Update(session *model.UploadSession) error

type SqlUserAccessTokenStore

type SqlUserAccessTokenStore struct {
	*SqlStore
}

func (SqlUserAccessTokenStore) Delete

func (s SqlUserAccessTokenStore) Delete(tokenId string) error

func (SqlUserAccessTokenStore) DeleteAllForUser

func (s SqlUserAccessTokenStore) DeleteAllForUser(userId string) error

func (SqlUserAccessTokenStore) Get

func (SqlUserAccessTokenStore) GetAll

func (s SqlUserAccessTokenStore) GetAll(offset, limit int) ([]*model.UserAccessToken, error)

func (SqlUserAccessTokenStore) GetByToken

func (s SqlUserAccessTokenStore) GetByToken(tokenString string) (*model.UserAccessToken, error)

func (SqlUserAccessTokenStore) GetByUser

func (s SqlUserAccessTokenStore) GetByUser(userId string, offset, limit int) ([]*model.UserAccessToken, error)

func (SqlUserAccessTokenStore) Save

func (SqlUserAccessTokenStore) Search

func (SqlUserAccessTokenStore) UpdateTokenDisable

func (s SqlUserAccessTokenStore) UpdateTokenDisable(tokenId string) error

func (SqlUserAccessTokenStore) UpdateTokenEnable

func (s SqlUserAccessTokenStore) UpdateTokenEnable(tokenId string) error

type SqlUserStore

type SqlUserStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (SqlUserStore) AnalyticsActiveCount

func (us SqlUserStore) AnalyticsActiveCount(timePeriod int64, options model.UserCountOptions) (int64, error)

func (SqlUserStore) AnalyticsActiveCountForPeriod added in v5.30.0

func (us SqlUserStore) AnalyticsActiveCountForPeriod(startTime int64, endTime int64, options model.UserCountOptions) (int64, error)

func (SqlUserStore) AnalyticsGetExternalUsers added in v5.28.0

func (us SqlUserStore) AnalyticsGetExternalUsers(hostDomain string) (bool, error)

func (SqlUserStore) AnalyticsGetGuestCount added in v5.24.0

func (us SqlUserStore) AnalyticsGetGuestCount() (int64, error)

func (SqlUserStore) AnalyticsGetInactiveUsersCount

func (us SqlUserStore) AnalyticsGetInactiveUsersCount() (int64, error)

func (SqlUserStore) AnalyticsGetSystemAdminCount

func (us SqlUserStore) AnalyticsGetSystemAdminCount() (int64, error)

func (SqlUserStore) AutocompleteUsersInChannel added in v5.22.0

func (us SqlUserStore) AutocompleteUsersInChannel(teamId, channelId, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, error)

func (SqlUserStore) ClearAllCustomRoleAssignments

func (us SqlUserStore) ClearAllCustomRoleAssignments() error

func (*SqlUserStore) ClearCaches

func (us *SqlUserStore) ClearCaches()

func (SqlUserStore) Count

func (us SqlUserStore) Count(options model.UserCountOptions) (int64, error)

func (SqlUserStore) DeactivateGuests

func (us SqlUserStore) DeactivateGuests() ([]string, error)

func (SqlUserStore) DemoteUserToGuest

func (us SqlUserStore) DemoteUserToGuest(userID string) (*model.User, error)

func (SqlUserStore) Get

func (us SqlUserStore) Get(ctx context.Context, id string) (*model.User, error)

func (SqlUserStore) GetAll

func (us SqlUserStore) GetAll() ([]*model.User, error)

func (SqlUserStore) GetAllAfter

func (us SqlUserStore) GetAllAfter(limit int, afterId string) ([]*model.User, error)

func (SqlUserStore) GetAllNotInAuthService added in v5.24.0

func (us SqlUserStore) GetAllNotInAuthService(authServices []string) ([]*model.User, error)

func (SqlUserStore) GetAllProfiles

func (us SqlUserStore) GetAllProfiles(options *model.UserGetOptions) ([]*model.User, error)

func (SqlUserStore) GetAllProfilesInChannel

func (us SqlUserStore) GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error)

func (SqlUserStore) GetAllUsingAuthService

func (us SqlUserStore) GetAllUsingAuthService(authService string) ([]*model.User, error)

func (SqlUserStore) GetAnyUnreadPostCountForChannel

func (us SqlUserStore) GetAnyUnreadPostCountForChannel(userId string, channelId string) (int64, error)

func (SqlUserStore) GetByAuth

func (us SqlUserStore) GetByAuth(authData *string, authService string) (*model.User, error)

func (SqlUserStore) GetByEmail

func (us SqlUserStore) GetByEmail(email string) (*model.User, error)

func (SqlUserStore) GetByUsername

func (us SqlUserStore) GetByUsername(username string) (*model.User, error)

func (SqlUserStore) GetChannelGroupUsers

func (us SqlUserStore) GetChannelGroupUsers(channelID string) ([]*model.User, error)

func (SqlUserStore) GetEtagForAllProfiles

func (us SqlUserStore) GetEtagForAllProfiles() string

func (SqlUserStore) GetEtagForProfiles

func (us SqlUserStore) GetEtagForProfiles(teamId string) string

func (SqlUserStore) GetEtagForProfilesNotInTeam

func (us SqlUserStore) GetEtagForProfilesNotInTeam(teamId string) string

func (SqlUserStore) GetForLogin

func (us SqlUserStore) GetForLogin(loginId string, allowSignInWithUsername, allowSignInWithEmail bool) (*model.User, error)

func (SqlUserStore) GetKnownUsers added in v5.23.0

func (us SqlUserStore) GetKnownUsers(userId string) ([]string, error)

GetKnownUsers returns the list of user ids of users with any direct relationship with a user. That means any user sharing any channel, including direct and group channels.

func (SqlUserStore) GetMany added in v5.33.0

func (us SqlUserStore) GetMany(ctx context.Context, ids []string) ([]*model.User, error)

GetMany returns a list of users for the provided list of ids

func (SqlUserStore) GetNewUsersForTeam

func (us SqlUserStore) GetNewUsersForTeam(teamId string, offset, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)

func (SqlUserStore) GetProfileByGroupChannelIdsForUser

func (us SqlUserStore) GetProfileByGroupChannelIdsForUser(userId string, channelIds []string) (map[string][]*model.User, error)

func (SqlUserStore) GetProfileByIds

func (us SqlUserStore) GetProfileByIds(ctx context.Context, userIds []string, options *store.UserGetByIdsOpts, allowFromCache bool) ([]*model.User, error)

func (SqlUserStore) GetProfiles

func (us SqlUserStore) GetProfiles(options *model.UserGetOptions) ([]*model.User, error)

func (SqlUserStore) GetProfilesByUsernames

func (us SqlUserStore) GetProfilesByUsernames(usernames []string, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)

func (SqlUserStore) GetProfilesInChannel

func (us SqlUserStore) GetProfilesInChannel(options *model.UserGetOptions) ([]*model.User, error)

func (SqlUserStore) GetProfilesInChannelByStatus

func (us SqlUserStore) GetProfilesInChannelByStatus(options *model.UserGetOptions) ([]*model.User, error)

func (SqlUserStore) GetProfilesNotInChannel

func (us SqlUserStore) GetProfilesNotInChannel(teamId string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)

func (SqlUserStore) GetProfilesNotInTeam

func (us SqlUserStore) GetProfilesNotInTeam(teamId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)

func (SqlUserStore) GetProfilesWithoutTeam

func (us SqlUserStore) GetProfilesWithoutTeam(options *model.UserGetOptions) ([]*model.User, error)

func (SqlUserStore) GetRecentlyActiveUsersForTeam

func (us SqlUserStore) GetRecentlyActiveUsersForTeam(teamId string, offset, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)

func (SqlUserStore) GetSystemAdminProfiles

func (us SqlUserStore) GetSystemAdminProfiles() (map[string]*model.User, error)

func (SqlUserStore) GetTeamGroupUsers

func (us SqlUserStore) GetTeamGroupUsers(teamID string) ([]*model.User, error)

func (SqlUserStore) GetUnreadCount

func (us SqlUserStore) GetUnreadCount(userId string) (int64, error)

func (SqlUserStore) GetUnreadCountForChannel

func (us SqlUserStore) GetUnreadCountForChannel(userId string, channelId string) (int64, error)

func (SqlUserStore) GetUsersBatchForIndexing

func (us SqlUserStore) GetUsersBatchForIndexing(startTime, endTime int64, limit int) ([]*model.UserForIndexing, error)

func (SqlUserStore) InferSystemInstallDate

func (us SqlUserStore) InferSystemInstallDate() (int64, error)

func (SqlUserStore) InvalidateProfileCacheForUser added in v5.20.0

func (us SqlUserStore) InvalidateProfileCacheForUser(userId string)

func (SqlUserStore) InvalidateProfilesInChannelCache

func (us SqlUserStore) InvalidateProfilesInChannelCache(channelId string)

func (SqlUserStore) InvalidateProfilesInChannelCacheByUser

func (us SqlUserStore) InvalidateProfilesInChannelCacheByUser(userId string)

func (SqlUserStore) PermanentDelete

func (us SqlUserStore) PermanentDelete(userId string) error

func (SqlUserStore) PromoteGuestToUser

func (us SqlUserStore) PromoteGuestToUser(userId string) error

func (SqlUserStore) ResetAuthDataToEmailForUsers added in v5.36.0

func (us SqlUserStore) ResetAuthDataToEmailForUsers(service string, userIDs []string, includeDeleted bool, dryRun bool) (int, error)

ResetAuthDataToEmailForUsers resets the AuthData of users whose AuthService is |service| to their Email. If userIDs is non-empty, only the users whose IDs are in userIDs will be affected. If dryRun is true, only the number of users who *would* be affected is returned; otherwise, the number of users who actually were affected is returned.

func (SqlUserStore) ResetLastPictureUpdate

func (us SqlUserStore) ResetLastPictureUpdate(userId string) error

func (SqlUserStore) Save

func (us SqlUserStore) Save(user *model.User) (*model.User, error)

func (SqlUserStore) Search

func (us SqlUserStore) Search(teamId string, term string, options *model.UserSearchOptions) ([]*model.User, error)

func (SqlUserStore) SearchInChannel

func (us SqlUserStore) SearchInChannel(channelId string, term string, options *model.UserSearchOptions) ([]*model.User, error)

func (SqlUserStore) SearchInGroup added in v5.26.0

func (us SqlUserStore) SearchInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, error)

func (SqlUserStore) SearchNotInChannel

func (us SqlUserStore) SearchNotInChannel(teamId string, channelId string, term string, options *model.UserSearchOptions) ([]*model.User, error)

func (SqlUserStore) SearchNotInTeam

func (us SqlUserStore) SearchNotInTeam(notInTeamId string, term string, options *model.UserSearchOptions) ([]*model.User, error)

func (SqlUserStore) SearchWithoutTeam

func (us SqlUserStore) SearchWithoutTeam(term string, options *model.UserSearchOptions) ([]*model.User, error)

func (SqlUserStore) Update

func (us SqlUserStore) Update(user *model.User, trustedUpdateData bool) (*model.UserUpdate, error)

func (SqlUserStore) UpdateAuthData

func (us SqlUserStore) UpdateAuthData(userId string, service string, authData *string, email string, resetMfa bool) (string, error)

func (SqlUserStore) UpdateFailedPasswordAttempts

func (us SqlUserStore) UpdateFailedPasswordAttempts(userId string, attempts int) error

func (SqlUserStore) UpdateLastPictureUpdate

func (us SqlUserStore) UpdateLastPictureUpdate(userId string) error

func (SqlUserStore) UpdateMfaActive

func (us SqlUserStore) UpdateMfaActive(userId string, active bool) error

func (SqlUserStore) UpdateMfaSecret

func (us SqlUserStore) UpdateMfaSecret(userId, secret string) error

func (SqlUserStore) UpdatePassword

func (us SqlUserStore) UpdatePassword(userId, hashedPassword string) error

func (SqlUserStore) UpdateUpdateAt

func (us SqlUserStore) UpdateUpdateAt(userId string) (int64, error)

func (SqlUserStore) VerifyEmail

func (us SqlUserStore) VerifyEmail(userId, email string) (string, error)

type SqlUserTermsOfServiceStore

type SqlUserTermsOfServiceStore struct {
	*SqlStore
}

func (SqlUserTermsOfServiceStore) Delete

func (s SqlUserTermsOfServiceStore) Delete(userId, termsOfServiceId string) error

func (SqlUserTermsOfServiceStore) GetByUser

func (SqlUserTermsOfServiceStore) Save

type SqlWebhookStore

type SqlWebhookStore struct {
	*SqlStore
	// contains filtered or unexported fields
}

func (SqlWebhookStore) AnalyticsIncomingCount

func (s SqlWebhookStore) AnalyticsIncomingCount(teamId string) (int64, error)

func (SqlWebhookStore) AnalyticsOutgoingCount

func (s SqlWebhookStore) AnalyticsOutgoingCount(teamId string) (int64, error)

func (SqlWebhookStore) ClearCaches

func (s SqlWebhookStore) ClearCaches()

func (SqlWebhookStore) DeleteIncoming

func (s SqlWebhookStore) DeleteIncoming(webhookId string, time int64) error

func (SqlWebhookStore) DeleteOutgoing

func (s SqlWebhookStore) DeleteOutgoing(webhookId string, time int64) error

func (SqlWebhookStore) GetIncoming

func (s SqlWebhookStore) GetIncoming(id string, allowFromCache bool) (*model.IncomingWebhook, error)

func (SqlWebhookStore) GetIncomingByChannel

func (s SqlWebhookStore) GetIncomingByChannel(channelId string) ([]*model.IncomingWebhook, error)

func (SqlWebhookStore) GetIncomingByTeam

func (s SqlWebhookStore) GetIncomingByTeam(teamId string, offset, limit int) ([]*model.IncomingWebhook, error)

func (SqlWebhookStore) GetIncomingByTeamByUser

func (s SqlWebhookStore) GetIncomingByTeamByUser(teamId string, userId string, offset, limit int) ([]*model.IncomingWebhook, error)

func (SqlWebhookStore) GetIncomingList

func (s SqlWebhookStore) GetIncomingList(offset, limit int) ([]*model.IncomingWebhook, error)

func (SqlWebhookStore) GetIncomingListByUser

func (s SqlWebhookStore) GetIncomingListByUser(userId string, offset, limit int) ([]*model.IncomingWebhook, error)

func (SqlWebhookStore) GetOutgoing

func (s SqlWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, error)

func (SqlWebhookStore) GetOutgoingByChannel

func (s SqlWebhookStore) GetOutgoingByChannel(channelId string, offset, limit int) ([]*model.OutgoingWebhook, error)

func (SqlWebhookStore) GetOutgoingByChannelByUser

func (s SqlWebhookStore) GetOutgoingByChannelByUser(channelId string, userId string, offset, limit int) ([]*model.OutgoingWebhook, error)

func (SqlWebhookStore) GetOutgoingByTeam

func (s SqlWebhookStore) GetOutgoingByTeam(teamId string, offset, limit int) ([]*model.OutgoingWebhook, error)

func (SqlWebhookStore) GetOutgoingByTeamByUser

func (s SqlWebhookStore) GetOutgoingByTeamByUser(teamId string, userId string, offset, limit int) ([]*model.OutgoingWebhook, error)

func (SqlWebhookStore) GetOutgoingList

func (s SqlWebhookStore) GetOutgoingList(offset, limit int) ([]*model.OutgoingWebhook, error)

func (SqlWebhookStore) GetOutgoingListByUser

func (s SqlWebhookStore) GetOutgoingListByUser(userId string, offset, limit int) ([]*model.OutgoingWebhook, error)

func (SqlWebhookStore) InvalidateWebhookCache

func (s SqlWebhookStore) InvalidateWebhookCache(webhookId string)

func (SqlWebhookStore) PermanentDeleteIncomingByChannel

func (s SqlWebhookStore) PermanentDeleteIncomingByChannel(channelId string) error

func (SqlWebhookStore) PermanentDeleteIncomingByUser

func (s SqlWebhookStore) PermanentDeleteIncomingByUser(userId string) error

func (SqlWebhookStore) PermanentDeleteOutgoingByChannel

func (s SqlWebhookStore) PermanentDeleteOutgoingByChannel(channelId string) error

func (SqlWebhookStore) PermanentDeleteOutgoingByUser

func (s SqlWebhookStore) PermanentDeleteOutgoingByUser(userId string) error

func (SqlWebhookStore) SaveIncoming

func (s SqlWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error)

func (SqlWebhookStore) SaveOutgoing

func (s SqlWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) (*model.OutgoingWebhook, error)

func (SqlWebhookStore) UpdateIncoming

func (s SqlWebhookStore) UpdateIncoming(hook *model.IncomingWebhook) (*model.IncomingWebhook, error)

func (SqlWebhookStore) UpdateOutgoing

func (s SqlWebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, error)

type TraceOnAdapter added in v5.20.0

type TraceOnAdapter struct{}

func (*TraceOnAdapter) Printf added in v5.20.0

func (t *TraceOnAdapter) Printf(format string, v ...interface{})

type UserWithChannel

type UserWithChannel struct {
	model.User
	ChannelId string
}

type UserWithLastActivityAt

type UserWithLastActivityAt struct {
	model.User
	LastActivityAt int64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL