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