github.com/turgay/mattermost-server@v5.3.2-0.20181002173352-2945e8a2b0ce+incompatible/store/store.go (about) 1 // Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package store 5 6 import ( 7 "time" 8 9 "github.com/mattermost/mattermost-server/model" 10 ) 11 12 type StoreResult struct { 13 Data interface{} 14 Err *model.AppError 15 } 16 17 type StoreChannel chan StoreResult 18 19 func Do(f func(result *StoreResult)) StoreChannel { 20 storeChannel := make(StoreChannel, 1) 21 go func() { 22 result := StoreResult{} 23 f(&result) 24 storeChannel <- result 25 close(storeChannel) 26 }() 27 return storeChannel 28 } 29 30 func Must(sc StoreChannel) interface{} { 31 r := <-sc 32 if r.Err != nil { 33 34 time.Sleep(time.Second) 35 panic(r.Err) 36 } 37 38 return r.Data 39 } 40 41 type Store interface { 42 Team() TeamStore 43 Channel() ChannelStore 44 Post() PostStore 45 User() UserStore 46 Audit() AuditStore 47 ClusterDiscovery() ClusterDiscoveryStore 48 Compliance() ComplianceStore 49 Session() SessionStore 50 OAuth() OAuthStore 51 System() SystemStore 52 Webhook() WebhookStore 53 Command() CommandStore 54 CommandWebhook() CommandWebhookStore 55 Preference() PreferenceStore 56 License() LicenseStore 57 Token() TokenStore 58 Emoji() EmojiStore 59 Status() StatusStore 60 FileInfo() FileInfoStore 61 Reaction() ReactionStore 62 Role() RoleStore 63 Scheme() SchemeStore 64 Job() JobStore 65 UserAccessToken() UserAccessTokenStore 66 ChannelMemberHistory() ChannelMemberHistoryStore 67 Plugin() PluginStore 68 ServiceTerms() ServiceTermsStore 69 MarkSystemRanUnitTests() 70 Close() 71 LockToMaster() 72 UnlockFromMaster() 73 DropAllTables() 74 TotalMasterDbConnections() int 75 TotalReadDbConnections() int 76 TotalSearchDbConnections() int 77 } 78 79 type TeamStore interface { 80 Save(team *model.Team) StoreChannel 81 Update(team *model.Team) StoreChannel 82 UpdateDisplayName(name string, teamId string) StoreChannel 83 Get(id string) StoreChannel 84 GetByName(name string) StoreChannel 85 SearchByName(name string) StoreChannel 86 SearchAll(term string) StoreChannel 87 SearchOpen(term string) StoreChannel 88 GetAll() StoreChannel 89 GetAllPage(offset int, limit int) StoreChannel 90 GetAllTeamListing() StoreChannel 91 GetAllTeamPageListing(offset int, limit int) StoreChannel 92 GetTeamsByUserId(userId string) StoreChannel 93 GetByInviteId(inviteId string) StoreChannel 94 PermanentDelete(teamId string) StoreChannel 95 AnalyticsTeamCount() StoreChannel 96 SaveMember(member *model.TeamMember, maxUsersPerTeam int) StoreChannel 97 UpdateMember(member *model.TeamMember) StoreChannel 98 GetMember(teamId string, userId string) StoreChannel 99 GetMembers(teamId string, offset int, limit int) StoreChannel 100 GetMembersByIds(teamId string, userIds []string) StoreChannel 101 GetTotalMemberCount(teamId string) StoreChannel 102 GetActiveMemberCount(teamId string) StoreChannel 103 GetTeamsForUser(userId string) StoreChannel 104 GetChannelUnreadsForAllTeams(excludeTeamId, userId string) StoreChannel 105 GetChannelUnreadsForTeam(teamId, userId string) StoreChannel 106 RemoveMember(teamId string, userId string) StoreChannel 107 RemoveAllMembersByTeam(teamId string) StoreChannel 108 RemoveAllMembersByUser(userId string) StoreChannel 109 UpdateLastTeamIconUpdate(teamId string, curTime int64) StoreChannel 110 GetTeamsByScheme(schemeId string, offset int, limit int) StoreChannel 111 MigrateTeamMembers(fromTeamId string, fromUserId string) StoreChannel 112 ResetAllTeamSchemes() StoreChannel 113 ClearAllCustomRoleAssignments() StoreChannel 114 AnalyticsGetTeamCountForScheme(schemeId string) StoreChannel 115 GetAllForExportAfter(limit int, afterId string) StoreChannel 116 GetTeamMembersForExport(userId string) StoreChannel 117 } 118 119 type ChannelStore interface { 120 Save(channel *model.Channel, maxChannelsPerTeam int64) StoreChannel 121 CreateDirectChannel(userId string, otherUserId string) StoreChannel 122 SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel 123 Update(channel *model.Channel) StoreChannel 124 Get(id string, allowFromCache bool) StoreChannel 125 InvalidateChannel(id string) 126 InvalidateChannelByName(teamId, name string) 127 GetFromMaster(id string) StoreChannel 128 Delete(channelId string, time int64) StoreChannel 129 Restore(channelId string, time int64) StoreChannel 130 SetDeleteAt(channelId string, deleteAt int64, updateAt int64) StoreChannel 131 PermanentDeleteByTeam(teamId string) StoreChannel 132 PermanentDelete(channelId string) StoreChannel 133 GetByName(team_id string, name string, allowFromCache bool) StoreChannel 134 GetByNames(team_id string, names []string, allowFromCache bool) StoreChannel 135 GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) StoreChannel 136 GetDeletedByName(team_id string, name string) StoreChannel 137 GetDeleted(team_id string, offset int, limit int) StoreChannel 138 GetChannels(teamId string, userId string, includeDeleted bool) StoreChannel 139 GetMoreChannels(teamId string, userId string, offset int, limit int) StoreChannel 140 GetPublicChannelsForTeam(teamId string, offset int, limit int) StoreChannel 141 GetPublicChannelsByIdsForTeam(teamId string, channelIds []string) StoreChannel 142 GetChannelCounts(teamId string, userId string) StoreChannel 143 GetTeamChannels(teamId string) StoreChannel 144 GetAll(teamId string) StoreChannel 145 GetForPost(postId string) StoreChannel 146 SaveMember(member *model.ChannelMember) StoreChannel 147 UpdateMember(member *model.ChannelMember) StoreChannel 148 GetMembers(channelId string, offset, limit int) StoreChannel 149 GetMember(channelId string, userId string) StoreChannel 150 GetAllChannelMembersForUser(userId string, allowFromCache bool, includeDeleted bool) StoreChannel 151 InvalidateAllChannelMembersForUser(userId string) 152 IsUserInChannelUseCache(userId string, channelId string) bool 153 GetAllChannelMembersNotifyPropsForChannel(channelId string, allowFromCache bool) StoreChannel 154 InvalidateCacheForChannelMembersNotifyProps(channelId string) 155 GetMemberForPost(postId string, userId string) StoreChannel 156 InvalidateMemberCount(channelId string) 157 GetMemberCountFromCache(channelId string) int64 158 GetMemberCount(channelId string, allowFromCache bool) StoreChannel 159 GetPinnedPosts(channelId string) StoreChannel 160 RemoveMember(channelId string, userId string) StoreChannel 161 PermanentDeleteMembersByUser(userId string) StoreChannel 162 PermanentDeleteMembersByChannel(channelId string) StoreChannel 163 UpdateLastViewedAt(channelIds []string, userId string) StoreChannel 164 IncrementMentionCount(channelId string, userId string) StoreChannel 165 AnalyticsTypeCount(teamId string, channelType string) StoreChannel 166 GetMembersForUser(teamId string, userId string) StoreChannel 167 AutocompleteInTeam(teamId string, term string, includeDeleted bool) StoreChannel 168 AutocompleteInTeamForSearch(teamId string, userId string, term string, includeDeleted bool) StoreChannel 169 SearchInTeam(teamId string, term string, includeDeleted bool) StoreChannel 170 SearchMore(userId string, teamId string, term string) StoreChannel 171 GetMembersByIds(channelId string, userIds []string) StoreChannel 172 AnalyticsDeletedTypeCount(teamId string, channelType string) StoreChannel 173 GetChannelUnread(channelId, userId string) StoreChannel 174 ClearCaches() 175 GetChannelsByScheme(schemeId string, offset int, limit int) StoreChannel 176 MigrateChannelMembers(fromChannelId string, fromUserId string) StoreChannel 177 ResetAllChannelSchemes() StoreChannel 178 ClearAllCustomRoleAssignments() StoreChannel 179 ResetLastPostAt() StoreChannel 180 MigratePublicChannels() error 181 DropPublicChannels() error 182 EnableExperimentalPublicChannelsMaterialization() 183 DisableExperimentalPublicChannelsMaterialization() 184 IsExperimentalPublicChannelsMaterializationEnabled() bool 185 GetAllChannelsForExportAfter(limit int, afterId string) StoreChannel 186 GetChannelMembersForExport(userId string, teamId string) StoreChannel 187 } 188 189 type ChannelMemberHistoryStore interface { 190 LogJoinEvent(userId string, channelId string, joinTime int64) StoreChannel 191 LogLeaveEvent(userId string, channelId string, leaveTime int64) StoreChannel 192 GetUsersInChannelDuring(startTime int64, endTime int64, channelId string) StoreChannel 193 PermanentDeleteBatch(endTime int64, limit int64) StoreChannel 194 } 195 196 type PostStore interface { 197 Save(post *model.Post) StoreChannel 198 Update(newPost *model.Post, oldPost *model.Post) StoreChannel 199 Get(id string) StoreChannel 200 GetSingle(id string) StoreChannel 201 Delete(postId string, time int64, deleteByID string) StoreChannel 202 PermanentDeleteByUser(userId string) StoreChannel 203 PermanentDeleteByChannel(channelId string) StoreChannel 204 GetPosts(channelId string, offset int, limit int, allowFromCache bool) StoreChannel 205 GetFlaggedPosts(userId string, offset int, limit int) StoreChannel 206 GetFlaggedPostsForTeam(userId, teamId string, offset int, limit int) StoreChannel 207 GetFlaggedPostsForChannel(userId, channelId string, offset int, limit int) StoreChannel 208 GetPostsBefore(channelId string, postId string, numPosts int, offset int) StoreChannel 209 GetPostsAfter(channelId string, postId string, numPosts int, offset int) StoreChannel 210 GetPostsSince(channelId string, time int64, allowFromCache bool) StoreChannel 211 GetEtag(channelId string, allowFromCache bool) StoreChannel 212 Search(teamId string, userId string, params *model.SearchParams) StoreChannel 213 AnalyticsUserCountsWithPostsByDay(teamId string) StoreChannel 214 AnalyticsPostCountsByDay(teamId string) StoreChannel 215 AnalyticsPostCount(teamId string, mustHaveFile bool, mustHaveHashtag bool) StoreChannel 216 ClearCaches() 217 InvalidateLastPostTimeCache(channelId string) 218 GetPostsCreatedAt(channelId string, time int64) StoreChannel 219 Overwrite(post *model.Post) StoreChannel 220 GetPostsByIds(postIds []string) StoreChannel 221 GetPostsBatchForIndexing(startTime int64, endTime int64, limit int) StoreChannel 222 PermanentDeleteBatch(endTime int64, limit int64) StoreChannel 223 GetOldest() StoreChannel 224 GetMaxPostSize() StoreChannel 225 GetParentsForExportAfter(limit int, afterId string) StoreChannel 226 GetRepliesForExport(parentId string) StoreChannel 227 } 228 229 type UserStore interface { 230 Save(user *model.User) StoreChannel 231 Update(user *model.User, allowRoleUpdate bool) StoreChannel 232 UpdateLastPictureUpdate(userId string) StoreChannel 233 ResetLastPictureUpdate(userId string) StoreChannel 234 UpdateUpdateAt(userId string) StoreChannel 235 UpdatePassword(userId, newPassword string) StoreChannel 236 UpdateAuthData(userId string, service string, authData *string, email string, resetMfa bool) StoreChannel 237 UpdateMfaSecret(userId, secret string) StoreChannel 238 UpdateMfaActive(userId string, active bool) StoreChannel 239 Get(id string) StoreChannel 240 GetAll() StoreChannel 241 ClearCaches() 242 InvalidateProfilesInChannelCacheByUser(userId string) 243 InvalidateProfilesInChannelCache(channelId string) 244 GetProfilesInChannel(channelId string, offset int, limit int) StoreChannel 245 GetProfilesInChannelByStatus(channelId string, offset int, limit int) StoreChannel 246 GetAllProfilesInChannel(channelId string, allowFromCache bool) StoreChannel 247 GetProfilesNotInChannel(teamId string, channelId string, offset int, limit int) StoreChannel 248 GetProfilesWithoutTeam(offset int, limit int) StoreChannel 249 GetProfilesByUsernames(usernames []string, teamId string) StoreChannel 250 GetAllProfiles(offset int, limit int) StoreChannel 251 GetProfiles(teamId string, offset int, limit int) StoreChannel 252 GetProfileByIds(userId []string, allowFromCache bool) StoreChannel 253 InvalidatProfileCacheForUser(userId string) 254 GetByEmail(email string) StoreChannel 255 GetByAuth(authData *string, authService string) StoreChannel 256 GetAllUsingAuthService(authService string) StoreChannel 257 GetByUsername(username string) StoreChannel 258 GetForLogin(loginId string, allowSignInWithUsername, allowSignInWithEmail bool) StoreChannel 259 VerifyEmail(userId string) StoreChannel 260 GetEtagForAllProfiles() StoreChannel 261 GetEtagForProfiles(teamId string) StoreChannel 262 UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel 263 GetTotalUsersCount() StoreChannel 264 GetSystemAdminProfiles() StoreChannel 265 PermanentDelete(userId string) StoreChannel 266 AnalyticsUniqueUserCount(teamId string) StoreChannel 267 AnalyticsActiveCount(time int64) StoreChannel 268 GetUnreadCount(userId string) StoreChannel 269 GetUnreadCountForChannel(userId string, channelId string) StoreChannel 270 GetAnyUnreadPostCountForChannel(userId string, channelId string) StoreChannel 271 GetRecentlyActiveUsersForTeam(teamId string, offset, limit int) StoreChannel 272 GetNewUsersForTeam(teamId string, offset, limit int) StoreChannel 273 Search(teamId string, term string, options map[string]bool) StoreChannel 274 SearchNotInTeam(notInTeamId string, term string, options map[string]bool) StoreChannel 275 SearchInChannel(channelId string, term string, options map[string]bool) StoreChannel 276 SearchNotInChannel(teamId string, channelId string, term string, options map[string]bool) StoreChannel 277 SearchWithoutTeam(term string, options map[string]bool) StoreChannel 278 AnalyticsGetInactiveUsersCount() StoreChannel 279 AnalyticsGetSystemAdminCount() StoreChannel 280 GetProfilesNotInTeam(teamId string, offset int, limit int) StoreChannel 281 GetEtagForProfilesNotInTeam(teamId string) StoreChannel 282 ClearAllCustomRoleAssignments() StoreChannel 283 InferSystemInstallDate() StoreChannel 284 GetAllAfter(limit int, afterId string) StoreChannel 285 } 286 287 type SessionStore interface { 288 Save(session *model.Session) StoreChannel 289 Get(sessionIdOrToken string) StoreChannel 290 GetSessions(userId string) StoreChannel 291 GetSessionsWithActiveDeviceIds(userId string) StoreChannel 292 Remove(sessionIdOrToken string) StoreChannel 293 RemoveAllSessions() StoreChannel 294 PermanentDeleteSessionsByUser(teamId string) StoreChannel 295 UpdateLastActivityAt(sessionId string, time int64) StoreChannel 296 UpdateRoles(userId string, roles string) StoreChannel 297 UpdateDeviceId(id string, deviceId string, expiresAt int64) StoreChannel 298 AnalyticsSessionCount() StoreChannel 299 Cleanup(expiryTime int64, batchSize int64) 300 } 301 302 type AuditStore interface { 303 Save(audit *model.Audit) StoreChannel 304 Get(user_id string, offset int, limit int) StoreChannel 305 PermanentDeleteByUser(userId string) StoreChannel 306 PermanentDeleteBatch(endTime int64, limit int64) StoreChannel 307 } 308 309 type ClusterDiscoveryStore interface { 310 Save(discovery *model.ClusterDiscovery) StoreChannel 311 Delete(discovery *model.ClusterDiscovery) StoreChannel 312 Exists(discovery *model.ClusterDiscovery) StoreChannel 313 GetAll(discoveryType, clusterName string) StoreChannel 314 SetLastPingAt(discovery *model.ClusterDiscovery) StoreChannel 315 Cleanup() StoreChannel 316 } 317 318 type ComplianceStore interface { 319 Save(compliance *model.Compliance) StoreChannel 320 Update(compliance *model.Compliance) StoreChannel 321 Get(id string) StoreChannel 322 GetAll(offset, limit int) StoreChannel 323 ComplianceExport(compliance *model.Compliance) StoreChannel 324 MessageExport(after int64, limit int) StoreChannel 325 } 326 327 type OAuthStore interface { 328 SaveApp(app *model.OAuthApp) StoreChannel 329 UpdateApp(app *model.OAuthApp) StoreChannel 330 GetApp(id string) StoreChannel 331 GetAppByUser(userId string, offset, limit int) StoreChannel 332 GetApps(offset, limit int) StoreChannel 333 GetAuthorizedApps(userId string, offset, limit int) StoreChannel 334 DeleteApp(id string) StoreChannel 335 SaveAuthData(authData *model.AuthData) StoreChannel 336 GetAuthData(code string) StoreChannel 337 RemoveAuthData(code string) StoreChannel 338 PermanentDeleteAuthDataByUser(userId string) StoreChannel 339 SaveAccessData(accessData *model.AccessData) StoreChannel 340 UpdateAccessData(accessData *model.AccessData) StoreChannel 341 GetAccessData(token string) StoreChannel 342 GetAccessDataByUserForApp(userId, clientId string) StoreChannel 343 GetAccessDataByRefreshToken(token string) StoreChannel 344 GetPreviousAccessData(userId, clientId string) StoreChannel 345 RemoveAccessData(token string) StoreChannel 346 } 347 348 type SystemStore interface { 349 Save(system *model.System) StoreChannel 350 SaveOrUpdate(system *model.System) StoreChannel 351 Update(system *model.System) StoreChannel 352 Get() StoreChannel 353 GetByName(name string) StoreChannel 354 PermanentDeleteByName(name string) StoreChannel 355 } 356 357 type WebhookStore interface { 358 SaveIncoming(webhook *model.IncomingWebhook) StoreChannel 359 GetIncoming(id string, allowFromCache bool) StoreChannel 360 GetIncomingList(offset, limit int) StoreChannel 361 GetIncomingByTeam(teamId string, offset, limit int) StoreChannel 362 UpdateIncoming(webhook *model.IncomingWebhook) StoreChannel 363 GetIncomingByChannel(channelId string) StoreChannel 364 DeleteIncoming(webhookId string, time int64) StoreChannel 365 PermanentDeleteIncomingByChannel(channelId string) StoreChannel 366 PermanentDeleteIncomingByUser(userId string) StoreChannel 367 368 SaveOutgoing(webhook *model.OutgoingWebhook) StoreChannel 369 GetOutgoing(id string) StoreChannel 370 GetOutgoingList(offset, limit int) StoreChannel 371 GetOutgoingByChannel(channelId string, offset, limit int) StoreChannel 372 GetOutgoingByTeam(teamId string, offset, limit int) StoreChannel 373 DeleteOutgoing(webhookId string, time int64) StoreChannel 374 PermanentDeleteOutgoingByChannel(channelId string) StoreChannel 375 PermanentDeleteOutgoingByUser(userId string) StoreChannel 376 UpdateOutgoing(hook *model.OutgoingWebhook) StoreChannel 377 378 AnalyticsIncomingCount(teamId string) StoreChannel 379 AnalyticsOutgoingCount(teamId string) StoreChannel 380 InvalidateWebhookCache(webhook string) 381 ClearCaches() 382 } 383 384 type CommandStore interface { 385 Save(webhook *model.Command) StoreChannel 386 Get(id string) StoreChannel 387 GetByTeam(teamId string) StoreChannel 388 GetByTrigger(teamId string, trigger string) StoreChannel 389 Delete(commandId string, time int64) StoreChannel 390 PermanentDeleteByTeam(teamId string) StoreChannel 391 PermanentDeleteByUser(userId string) StoreChannel 392 Update(hook *model.Command) StoreChannel 393 AnalyticsCommandCount(teamId string) StoreChannel 394 } 395 396 type CommandWebhookStore interface { 397 Save(webhook *model.CommandWebhook) StoreChannel 398 Get(id string) StoreChannel 399 TryUse(id string, limit int) StoreChannel 400 Cleanup() 401 } 402 403 type PreferenceStore interface { 404 Save(preferences *model.Preferences) StoreChannel 405 Get(userId string, category string, name string) StoreChannel 406 GetCategory(userId string, category string) StoreChannel 407 GetAll(userId string) StoreChannel 408 Delete(userId, category, name string) StoreChannel 409 DeleteCategory(userId string, category string) StoreChannel 410 DeleteCategoryAndName(category string, name string) StoreChannel 411 PermanentDeleteByUser(userId string) StoreChannel 412 IsFeatureEnabled(feature, userId string) StoreChannel 413 CleanupFlagsBatch(limit int64) StoreChannel 414 } 415 416 type LicenseStore interface { 417 Save(license *model.LicenseRecord) StoreChannel 418 Get(id string) StoreChannel 419 } 420 421 type TokenStore interface { 422 Save(recovery *model.Token) StoreChannel 423 Delete(token string) StoreChannel 424 GetByToken(token string) StoreChannel 425 Cleanup() 426 } 427 428 type EmojiStore interface { 429 Save(emoji *model.Emoji) StoreChannel 430 Get(id string, allowFromCache bool) StoreChannel 431 GetByName(name string) StoreChannel 432 GetList(offset, limit int, sort string) StoreChannel 433 Delete(id string, time int64) StoreChannel 434 Search(name string, prefixOnly bool, limit int) StoreChannel 435 } 436 437 type StatusStore interface { 438 SaveOrUpdate(status *model.Status) StoreChannel 439 Get(userId string) StoreChannel 440 GetByIds(userIds []string) StoreChannel 441 GetOnlineAway() StoreChannel 442 GetOnline() StoreChannel 443 GetAllFromTeam(teamId string) StoreChannel 444 ResetAll() StoreChannel 445 GetTotalActiveUsersCount() StoreChannel 446 UpdateLastActivityAt(userId string, lastActivityAt int64) StoreChannel 447 } 448 449 type FileInfoStore interface { 450 Save(info *model.FileInfo) StoreChannel 451 Get(id string) StoreChannel 452 GetByPath(path string) StoreChannel 453 GetForPost(postId string, readFromMaster bool, allowFromCache bool) StoreChannel 454 GetForUser(userId string) StoreChannel 455 InvalidateFileInfosForPostCache(postId string) 456 AttachToPost(fileId string, postId string) StoreChannel 457 DeleteForPost(postId string) StoreChannel 458 PermanentDelete(fileId string) StoreChannel 459 PermanentDeleteBatch(endTime int64, limit int64) StoreChannel 460 PermanentDeleteByUser(userId string) StoreChannel 461 ClearCaches() 462 } 463 464 type ReactionStore interface { 465 Save(reaction *model.Reaction) StoreChannel 466 Delete(reaction *model.Reaction) StoreChannel 467 GetForPost(postId string, allowFromCache bool) StoreChannel 468 DeleteAllWithEmojiName(emojiName string) StoreChannel 469 PermanentDeleteBatch(endTime int64, limit int64) StoreChannel 470 } 471 472 type JobStore interface { 473 Save(job *model.Job) StoreChannel 474 UpdateOptimistically(job *model.Job, currentStatus string) StoreChannel 475 UpdateStatus(id string, status string) StoreChannel 476 UpdateStatusOptimistically(id string, currentStatus string, newStatus string) StoreChannel 477 Get(id string) StoreChannel 478 GetAllPage(offset int, limit int) StoreChannel 479 GetAllByType(jobType string) StoreChannel 480 GetAllByTypePage(jobType string, offset int, limit int) StoreChannel 481 GetAllByStatus(status string) StoreChannel 482 GetNewestJobByStatusAndType(status string, jobType string) StoreChannel 483 GetCountByStatusAndType(status string, jobType string) StoreChannel 484 Delete(id string) StoreChannel 485 } 486 487 type UserAccessTokenStore interface { 488 Save(token *model.UserAccessToken) StoreChannel 489 Delete(tokenId string) StoreChannel 490 DeleteAllForUser(userId string) StoreChannel 491 Get(tokenId string) StoreChannel 492 GetAll(offset int, limit int) StoreChannel 493 GetByToken(tokenString string) StoreChannel 494 GetByUser(userId string, page, perPage int) StoreChannel 495 Search(term string) StoreChannel 496 UpdateTokenEnable(tokenId string) StoreChannel 497 UpdateTokenDisable(tokenId string) StoreChannel 498 } 499 500 type PluginStore interface { 501 SaveOrUpdate(keyVal *model.PluginKeyValue) StoreChannel 502 Get(pluginId, key string) StoreChannel 503 Delete(pluginId, key string) StoreChannel 504 } 505 506 type RoleStore interface { 507 Save(role *model.Role) StoreChannel 508 Get(roleId string) StoreChannel 509 GetByName(name string) StoreChannel 510 GetByNames(names []string) StoreChannel 511 Delete(roldId string) StoreChannel 512 PermanentDeleteAll() StoreChannel 513 } 514 515 type SchemeStore interface { 516 Save(scheme *model.Scheme) StoreChannel 517 Get(schemeId string) StoreChannel 518 GetByName(schemeName string) StoreChannel 519 GetAllPage(scope string, offset int, limit int) StoreChannel 520 Delete(schemeId string) StoreChannel 521 PermanentDeleteAll() StoreChannel 522 } 523 524 type ServiceTermsStore interface { 525 Save(serviceTerms *model.ServiceTerms) StoreChannel 526 GetLatest(allowFromCache bool) StoreChannel 527 Get(id string, allowFromCache bool) StoreChannel 528 }