fixed most init errors in channels/store/storetest dir | 24 files edited (#26522)

Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Этот коммит содержится в:
Matthew Straughn
2024-10-29 05:50:38 -04:00
коммит произвёл GitHub
родитель 5dba6e082d
Коммит 71bf7777f5
48 изменённых файлов: 3018 добавлений и 3020 удалений

Просмотреть файл

@@ -100,14 +100,14 @@ type RetentionPolicyStore interface {
GetAll(offset, limit int) ([]*model.RetentionPolicyWithTeamAndChannelCounts, error)
GetCount() (int64, error)
Delete(id string) error
GetChannels(policyId string, offset, limit int) (model.ChannelListWithTeamData, error)
GetChannelsCount(policyId string) (int64, error)
AddChannels(policyId string, channelIds []string) error
RemoveChannels(policyId string, channelIds []string) error
GetTeams(policyId string, offset, limit int) ([]*model.Team, error)
GetTeamsCount(policyId string) (int64, error)
AddTeams(policyId string, teamIds []string) error
RemoveTeams(policyId string, teamIds []string) error
GetChannels(policyID string, offset, limit int) (model.ChannelListWithTeamData, error)
GetChannelsCount(policyID string) (int64, error)
AddChannels(policyID string, channelIds []string) error
RemoveChannels(policyID string, channelIds []string) error
GetTeams(policyID string, offset, limit int) ([]*model.Team, error)
GetTeamsCount(policyID string) (int64, error)
AddTeams(policyID string, teamIds []string) error
RemoveTeams(policyID string, teamIds []string) error
DeleteOrphanedRows(limit int) (int64, error)
GetTeamPoliciesForUser(userID string, offset, limit int) ([]*model.RetentionPolicyForTeam, error)
GetTeamPoliciesCountForUser(userID string) (int64, error)
@@ -197,12 +197,12 @@ type ChannelStore interface {
SetDeleteAt(channelID string, deleteAt int64, updateAt int64) error
PermanentDelete(ctx request.CTX, channelID string) error
PermanentDeleteByTeam(teamID string) error
GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error)
GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error)
GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error)
GetByNamesIncludeDeleted(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error)
GetDeletedByName(team_id string, name string) (*model.Channel, error)
GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error)
GetByName(teamID string, name string, allowFromCache bool) (*model.Channel, error)
GetByNames(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error)
GetByNameIncludeDeleted(teamID string, name string, allowFromCache bool) (*model.Channel, error)
GetByNamesIncludeDeleted(teamID string, names []string, allowFromCache bool) ([]*model.Channel, error)
GetDeletedByName(teamID string, name string) (*model.Channel, error)
GetDeleted(teamID string, offset int, limit int, userID string) (model.ChannelList, error)
GetChannels(teamID, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, error)
GetChannelsByUser(userID string, includeDeleted bool, lastDeleteAt, pageSize int, fromChannelID string) (model.ChannelList, error)
GetAllChannelMemberIdsByChannelId(id string) ([]string, error)
@@ -307,7 +307,7 @@ type ChannelStore interface {
// GroupSyncedChannelCount returns the count of non-deleted group-constrained channels.
GroupSyncedChannelCount() (int64, error)
SetShared(channelId string, shared bool) error
SetShared(channelID string, shared bool) error
// GetTeamForChannel returns the team for a given channelID.
GetTeamForChannel(channelID string) (*model.Team, error)
IsReadOnlyChannel(channelID string) (bool, error)
@@ -328,11 +328,11 @@ type ThreadStore interface {
GetThreadMembershipsForExport(postID string) ([]*model.ThreadMembershipForExport, error)
Get(id string) (*model.Thread, error)
GetTotalUnreadThreads(userId, teamID string, opts model.GetUserThreadsOpts) (int64, error)
GetTotalThreads(userId, teamID string, opts model.GetUserThreadsOpts) (int64, error)
GetTotalUnreadMentions(userId, teamID string, opts model.GetUserThreadsOpts) (int64, error)
GetTotalUnreadUrgentMentions(userId, teamID string, opts model.GetUserThreadsOpts) (int64, error)
GetThreadsForUser(userId, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error)
GetTotalUnreadThreads(userID, teamID string, opts model.GetUserThreadsOpts) (int64, error)
GetTotalThreads(userID, teamID string, opts model.GetUserThreadsOpts) (int64, error)
GetTotalUnreadMentions(userID, teamID string, opts model.GetUserThreadsOpts) (int64, error)
GetTotalUnreadUrgentMentions(userID, teamID string, opts model.GetUserThreadsOpts) (int64, error)
GetThreadsForUser(userID, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error)
GetThreadForUser(threadMembership *model.ThreadMembership, extended, postPriorityIsEnabled bool) (*model.ThreadResponse, error)
GetTeamsUnreadForUser(userID string, teamIDs []string, includeUrgentMentionCount bool) (map[string]*model.TeamUnread, error)
@@ -342,9 +342,9 @@ type ThreadStore interface {
MarkAsRead(userID, threadID string, timestamp int64) error
UpdateMembership(membership *model.ThreadMembership) (*model.ThreadMembership, error)
GetMembershipsForUser(userId, teamID string) ([]*model.ThreadMembership, error)
GetMembershipForUser(userId, postID string) (*model.ThreadMembership, error)
DeleteMembershipForUser(userId, postID string) error
GetMembershipsForUser(userID, teamID string) ([]*model.ThreadMembership, error)
GetMembershipForUser(userID, postID string) (*model.ThreadMembership, error)
DeleteMembershipForUser(userID, postID string) error
MaintainMembership(userID, postID string, opts ThreadMembershipOpts) (*model.ThreadMembership, error)
PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error)
PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error)
@@ -389,7 +389,7 @@ type PostStore interface {
Overwrite(rctx request.CTX, post *model.Post) (*model.Post, error)
OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error)
GetPostsByIds(postIds []string) ([]*model.Post, error)
GetEditHistoryForPost(postId string) ([]*model.Post, error)
GetEditHistoryForPost(postID string) ([]*model.Post, error)
GetPostsBatchForIndexing(startTime int64, startPostID string, limit int) ([]*model.PostForIndexing, error)
PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error)
PermanentDeleteBatch(endTime int64, limit int64) (int64, error)
@@ -400,7 +400,7 @@ type PostStore interface {
GetDirectPostParentsForExportAfter(limit int, afterID string, includeArchivedChannels bool) ([]*model.DirectPostForExport, error)
SearchPostsForUser(rctx request.CTX, paramsList []*model.SearchParams, userID, teamID string, page, perPage int) (*model.PostSearchResults, error)
GetOldestEntityCreationTime() (int64, error)
HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error)
HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userID string) (bool, error)
GetPostsSinceForSync(options model.GetPostsSinceForSyncOptions, cursor model.GetPostsSinceForSyncCursor, limit int) ([]*model.Post, model.GetPostsSinceForSyncCursor, error)
SetPostReminder(reminder *model.PostReminder) error
GetPostReminders(now int64) ([]*model.PostReminder, error)
@@ -433,8 +433,8 @@ type UserStore interface {
GetProfilesInChannel(options *model.UserGetOptions) ([]*model.User, error)
GetProfilesInChannelByStatus(options *model.UserGetOptions) ([]*model.User, error)
GetProfilesInChannelByAdmin(options *model.UserGetOptions) ([]*model.User, error)
GetAllProfilesInChannel(rctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error)
GetProfilesNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)
GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error)
GetProfilesNotInChannel(teamID string, channelID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)
GetProfilesWithoutTeam(options *model.UserGetOptions) ([]*model.User, error)
GetProfilesByUsernames(usernames []string, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error)
GetAllProfiles(options *model.UserGetOptions) ([]*model.User, error)
@@ -526,7 +526,7 @@ type SessionStore interface {
type AuditStore interface {
Save(audit *model.Audit) error
Get(user_id string, offset int, limit int) (model.Audits, error)
Get(userID string, offset int, limit int) (model.Audits, error)
PermanentDeleteByUser(userID string) error
}
@@ -542,12 +542,12 @@ type ClusterDiscoveryStore interface {
type RemoteClusterStore interface {
Save(rc *model.RemoteCluster) (*model.RemoteCluster, error)
Update(rc *model.RemoteCluster) (*model.RemoteCluster, error)
Delete(remoteClusterId string) (bool, error)
Get(remoteClusterId string, includeDeleted bool) (*model.RemoteCluster, error)
Delete(remoteClusterID string) (bool, error)
Get(remoteClusterID string, includeDeleted bool) (*model.RemoteCluster, error)
GetByPluginID(pluginID string) (*model.RemoteCluster, error)
GetAll(offset, limit int, filter model.RemoteClusterQueryFilter) ([]*model.RemoteCluster, error)
UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error)
SetLastPingAt(remoteClusterId string) error
UpdateTopics(remoteClusterID string, topics string) (*model.RemoteCluster, error)
SetLastPingAt(remoteClusterID string) error
}
type ComplianceStore interface {
@@ -570,15 +570,15 @@ type OAuthStore interface {
SaveAuthData(authData *model.AuthData) (*model.AuthData, error)
GetAuthData(code string) (*model.AuthData, error)
RemoveAuthData(code string) error
RemoveAuthDataByClientId(clientId string, userId string) error
RemoveAuthDataByUserId(userId string) error
RemoveAuthDataByClientId(clientID string, userID string) error
RemoveAuthDataByUserId(userID string) error
PermanentDeleteAuthDataByUser(userID string) error
SaveAccessData(accessData *model.AccessData) (*model.AccessData, error)
UpdateAccessData(accessData *model.AccessData) (*model.AccessData, error)
GetAccessData(token string) (*model.AccessData, error)
GetAccessDataByUserForApp(userID, clientId string) ([]*model.AccessData, error)
GetAccessDataByUserForApp(userID, clientID string) ([]*model.AccessData, error)
GetAccessDataByRefreshToken(token string) (*model.AccessData, error)
GetPreviousAccessData(userID, clientId string) (*model.AccessData, error)
GetPreviousAccessData(userID, clientID string) (*model.AccessData, error)
RemoveAccessData(token string) error
RemoveAllAccessData() error
}
@@ -684,9 +684,9 @@ type TokenStore interface {
type DesktopTokensStore interface {
GetUserId(token string, minCreatedAt int64) (*string, error)
Insert(token string, createAt int64, userId string) error
Insert(token string, createAt int64, userID string) error
Delete(token string) error
DeleteByUserId(userId string) error
DeleteByUserId(userID string) error
DeleteOlderThan(minCreatedAt int64) error
}
@@ -749,9 +749,9 @@ type ReactionStore interface {
Save(reaction *model.Reaction) (*model.Reaction, error)
Delete(reaction *model.Reaction) (*model.Reaction, error)
GetForPost(postID string, allowFromCache bool) ([]*model.Reaction, error)
GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error)
GetUniqueCountForPost(postId string) (int, error)
ExistsOnPost(postId string, emojiName string) (bool, error)
GetForPostSince(postID string, since int64, excludeRemoteID string, inclDeleted bool) ([]*model.Reaction, error)
GetUniqueCountForPost(postID string) (int, error)
ExistsOnPost(postID string, emojiName string) (bool, error)
DeleteAllWithEmojiName(emojiName string) error
BulkGetForPosts(postIds []string) ([]*model.Reaction, error)
GetSingle(userID, postID, remoteID, emojiName string) (*model.Reaction, error)
@@ -856,7 +856,7 @@ type ProductNoticesStore interface {
type UserTermsOfServiceStore interface {
GetByUser(userID string) (*model.UserTermsOfService, error)
Save(userTermsOfService *model.UserTermsOfService) (*model.UserTermsOfService, error)
Delete(userID, termsOfServiceId string) error
Delete(userID, termsOfServiceID string) error
}
type GroupStore interface {
@@ -972,31 +972,31 @@ type LinkMetadataStore interface {
type NotifyAdminStore interface {
Save(data *model.NotifyAdminData) (*model.NotifyAdminData, error)
GetDataByUserIdAndFeature(userId string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error)
GetDataByUserIdAndFeature(userID string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error)
Get(trial bool) ([]*model.NotifyAdminData, error)
DeleteBefore(trial bool, now int64) error
Update(userId string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error
Update(userID string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error
}
type SharedChannelStore interface {
Save(sc *model.SharedChannel) (*model.SharedChannel, error)
Get(channelId string) (*model.SharedChannel, error)
Get(channelID string) (*model.SharedChannel, error)
HasChannel(channelID string) (bool, error)
GetAll(offset, limit int, opts model.SharedChannelFilterOpts) ([]*model.SharedChannel, error)
GetAllCount(opts model.SharedChannelFilterOpts) (int64, error)
Update(sc *model.SharedChannel) (*model.SharedChannel, error)
Delete(channelId string) (bool, error)
Delete(channelID string) (bool, error)
SaveRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error)
UpdateRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error)
GetRemote(id string) (*model.SharedChannelRemote, error)
HasRemote(channelID string, remoteId string) (bool, error)
GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error)
GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error)
HasRemote(channelID string, remoteID string) (bool, error)
GetRemoteForUser(remoteID string, userID string) (*model.RemoteCluster, error)
GetRemoteByIds(channelID string, remoteID string) (*model.SharedChannelRemote, error)
GetRemotes(offset, limit int, opts model.SharedChannelRemoteFilterOpts) ([]*model.SharedChannelRemote, error)
UpdateRemoteCursor(id string, cursor model.GetPostsSinceForSyncCursor) error
DeleteRemote(remoteId string) (bool, error)
GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error)
DeleteRemote(remoteID string) (bool, error)
GetRemotesStatus(channelID string) ([]*model.SharedChannelRemoteStatus, error)
SaveUser(remote *model.SharedChannelUser) (*model.SharedChannelUser, error)
GetSingleUser(userID string, channelID string, remoteID string) (*model.SharedChannelUser, error)
@@ -1006,12 +1006,12 @@ type SharedChannelStore interface {
SaveAttachment(remote *model.SharedChannelAttachment) (*model.SharedChannelAttachment, error)
UpsertAttachment(remote *model.SharedChannelAttachment) (string, error)
GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error)
GetAttachment(fileID string, remoteID string) (*model.SharedChannelAttachment, error)
UpdateAttachmentLastSyncAt(id string, syncTime int64) error
}
type PostPriorityStore interface {
GetForPost(postId string) (*model.PostPriority, error)
GetForPost(postID string) (*model.PostPriority, error)
GetForPosts(ids []string) ([]*model.PostPriority, error)
}
@@ -1021,9 +1021,9 @@ type DraftStore interface {
Delete(userID, channelID, rootID string) error
DeleteDraftsAssociatedWithPost(channelID, rootID string) error
GetDraftsForUser(userID, teamID string) ([]*model.Draft, error)
GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userId string) (int64, string, error)
DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userId string) error
DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userId string) error
GetLastCreateAtAndUserIdValuesForEmptyDraftsMigration(createAt int64, userID string) (int64, string, error)
DeleteEmptyDraftsByCreateAtAndUserId(createAt int64, userID string) error
DeleteOrphanDraftsByCreateAtAndUserId(createAt int64, userID string) error
}
type PostAcknowledgementStore interface {
@@ -1044,13 +1044,13 @@ type PostPersistentNotificationStore interface {
DeleteByTeam(teamIds []string) error
}
type ChannelBookmarkStore interface {
ErrorIfBookmarkFileInfoAlreadyAttached(fileId string) error
ErrorIfBookmarkFileInfoAlreadyAttached(fileID string) error
Get(Id string, includeDeleted bool) (b *model.ChannelBookmarkWithFileInfo, err error)
Save(bookmark *model.ChannelBookmark, increaseSortOrder bool) (b *model.ChannelBookmarkWithFileInfo, err error)
Update(bookmark *model.ChannelBookmark) error
UpdateSortOrder(bookmarkId, channelId string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error)
Delete(bookmarkId string, deleteFile bool) error
GetBookmarksForChannelSince(channelId string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error)
UpdateSortOrder(bookmarkID, channelID string, newIndex int64) ([]*model.ChannelBookmarkWithFileInfo, error)
Delete(bookmarkID string, deleteFile bool) error
GetBookmarksForChannelSince(channelID string, since int64) ([]*model.ChannelBookmarkWithFileInfo, error)
}
// ChannelSearchOpts contains options for searching channels.
@@ -1058,7 +1058,7 @@ type ChannelBookmarkStore interface {
// NotAssociatedToGroup will exclude channels that have associated, active GroupChannels records.
// IncludeDeleted will include channel records where DeleteAt != 0.
// ExcludeChannelNames will exclude channels from the results by name.
// IncludeSearchById will include searching matches against channel IDs in the results
// IncludeSearchByID will include searching matches against channel IDs in the results
// Paginate whether to paginate the results.
// Page page requested, if results are paginated.
// PerPage number of results per page, if paginated.
@@ -1075,7 +1075,7 @@ type ChannelSearchOpts struct {
ExcludePolicyConstrained bool
IncludePolicyID bool
IncludeTeamInfo bool
IncludeSearchById bool
IncludeSearchByID bool
ExcludeRemote bool
CountOnly bool
Public bool
@@ -1125,7 +1125,7 @@ type ThreadMembershipOpts struct {
// PostReminderMetadata contains some info needed to send
// the reminder message to the user.
type PostReminderMetadata struct {
ChannelId string
ChannelID string
TeamName string
UserLocale string
Username string