github.com/xzl8028/xenia-server@v0.0.0-20190809101854-18450a97da63/store/sqlstore/store.go (about) 1 // Copyright (c) 2015-present Xenia, Inc. All Rights Reserved. 2 // See License.txt for license information. 3 4 package sqlstore 5 6 import ( 7 sq "github.com/Masterminds/squirrel" 8 _ "github.com/go-sql-driver/mysql" 9 _ "github.com/lib/pq" 10 "github.com/xzl8028/gorp" 11 "github.com/xzl8028/xenia-server/store" 12 ) 13 14 /*type SqlStore struct { 15 master *gorp.DbMap 16 replicas []*gorp.DbMap 17 searchReplicas []*gorp.DbMap 18 team TeamStore 19 channel ChannelStore 20 post PostStore 21 user UserStore 22 audit AuditStore 23 compliance ComplianceStore 24 session SessionStore 25 oauth OAuthStore 26 system SystemStore 27 webhook WebhookStore 28 command CommandStore 29 preference PreferenceStore 30 license LicenseStore 31 token TokenStore 32 emoji EmojiStore 33 status StatusStore 34 fileInfo FileInfoStore 35 reaction ReactionStore 36 jobStatus JobStatusStore 37 SchemaVersion string 38 rrCounter int64 39 srCounter int64 40 }*/ 41 42 type SqlStore interface { 43 DriverName() string 44 GetCurrentSchemaVersion() string 45 GetMaster() *gorp.DbMap 46 GetSearchReplica() *gorp.DbMap 47 GetReplica() *gorp.DbMap 48 TotalMasterDbConnections() int 49 TotalReadDbConnections() int 50 TotalSearchDbConnections() int 51 MarkSystemRanUnitTests() 52 DoesTableExist(tablename string) bool 53 DoesColumnExist(tableName string, columName string) bool 54 DoesTriggerExist(triggerName string) bool 55 CreateColumnIfNotExists(tableName string, columnName string, mySqlColType string, postgresColType string, defaultValue string) bool 56 CreateColumnIfNotExistsNoDefault(tableName string, columnName string, mySqlColType string, postgresColType string) bool 57 RemoveColumnIfExists(tableName string, columnName string) bool 58 RemoveTableIfExists(tableName string) bool 59 RenameColumnIfExists(tableName string, oldColumnName string, newColumnName string, colType string) bool 60 GetMaxLengthOfColumnIfExists(tableName string, columnName string) string 61 AlterColumnTypeIfExists(tableName string, columnName string, mySqlColType string, postgresColType string) bool 62 AlterColumnDefaultIfExists(tableName string, columnName string, mySqlColDefault *string, postgresColDefault *string) bool 63 CreateUniqueIndexIfNotExists(indexName string, tableName string, columnName string) bool 64 CreateIndexIfNotExists(indexName string, tableName string, columnName string) bool 65 CreateCompositeIndexIfNotExists(indexName string, tableName string, columnNames []string) bool 66 CreateFullTextIndexIfNotExists(indexName string, tableName string, columnName string) bool 67 RemoveIndexIfExists(indexName string, tableName string) bool 68 GetAllConns() []*gorp.DbMap 69 Close() 70 LockToMaster() 71 UnlockFromMaster() 72 Team() store.TeamStore 73 Channel() store.ChannelStore 74 Post() store.PostStore 75 User() store.UserStore 76 Bot() store.BotStore 77 Task() store.TaskStore 78 Audit() store.AuditStore 79 ClusterDiscovery() store.ClusterDiscoveryStore 80 Compliance() store.ComplianceStore 81 Session() store.SessionStore 82 OAuth() store.OAuthStore 83 System() store.SystemStore 84 Webhook() store.WebhookStore 85 Command() store.CommandStore 86 CommandWebhook() store.CommandWebhookStore 87 Preference() store.PreferenceStore 88 License() store.LicenseStore 89 Token() store.TokenStore 90 Emoji() store.EmojiStore 91 Status() store.StatusStore 92 FileInfo() store.FileInfoStore 93 Reaction() store.ReactionStore 94 Job() store.JobStore 95 Plugin() store.PluginStore 96 UserAccessToken() store.UserAccessTokenStore 97 Role() store.RoleStore 98 Scheme() store.SchemeStore 99 TermsOfService() store.TermsOfServiceStore 100 UserTermsOfService() store.UserTermsOfServiceStore 101 LinkMetadata() store.LinkMetadataStore 102 getQueryBuilder() sq.StatementBuilderType 103 }