diff --git a/api4/api.go b/api4/api.go index b50f119e19..7ed141d0f9 100644 --- a/api4/api.go +++ b/api4/api.go @@ -103,6 +103,8 @@ type Routes struct { Jobs *mux.Router // 'api/v4/jobs' + DebugBar *mux.Router // 'api/v4/debugbar' + Preferences *mux.Router // 'api/v4/users/{user_id:[A-Za-z0-9]+}/preferences' License *mux.Router // 'api/v4/license' @@ -235,6 +237,7 @@ func Init(srv *app.Server) (*API, error) { api.BaseRoutes.Public = api.BaseRoutes.APIRoot.PathPrefix("/public").Subrouter() api.BaseRoutes.Reactions = api.BaseRoutes.APIRoot.PathPrefix("/reactions").Subrouter() api.BaseRoutes.Jobs = api.BaseRoutes.APIRoot.PathPrefix("/jobs").Subrouter() + api.BaseRoutes.DebugBar = api.BaseRoutes.APIRoot.PathPrefix("/debugbar").Subrouter() api.BaseRoutes.Elasticsearch = api.BaseRoutes.APIRoot.PathPrefix("/elasticsearch").Subrouter() api.BaseRoutes.Bleve = api.BaseRoutes.APIRoot.PathPrefix("/bleve").Subrouter() api.BaseRoutes.DataRetention = api.BaseRoutes.APIRoot.PathPrefix("/data_retention").Subrouter() @@ -298,6 +301,7 @@ func Init(srv *app.Server) (*API, error) { api.InitDataRetention() api.InitBrand() api.InitJob() + api.InitDebugBar() api.InitCommand() api.InitStatus() api.InitWebSocket() diff --git a/api4/debugbar.go b/api4/debugbar.go new file mode 100644 index 0000000000..0db73c638d --- /dev/null +++ b/api4/debugbar.go @@ -0,0 +1,60 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package api4 + +import ( + "encoding/json" + "net/http" + + "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/v6/shared/mlog" +) + +func (api *API) InitDebugBar() { + api.BaseRoutes.DebugBar.Handle("/systeminfo", api.APISessionRequired(getSystemInfo)).Methods("GET") + api.BaseRoutes.DebugBar.Handle("/queryexplain", api.APISessionRequired(getQueryExplain)).Methods("POST") +} + +func getSystemInfo(c *Context, w http.ResponseWriter, r *http.Request) { + if !c.App.Srv().DebugBar().IsEnabled() { + c.Err = model.NewAppError("Api4.GetSystemInfo", "api.debugbar.getSystemInfo.disabled_debugbar.error", nil, "", http.StatusNotImplemented) + return + } + + info, err := c.App.GetDebugBarInfo() + if err != nil { + c.Err = err + return + } + + if err := json.NewEncoder(w).Encode(info); err != nil { + c.Logger.Warn("Error while writing response", mlog.Err(err)) + } +} + +func getQueryExplain(c *Context, w http.ResponseWriter, r *http.Request) { + if !c.App.Srv().DebugBar().IsEnabled() { + c.Err = model.NewAppError("Api4.GetSystemInfo", "api.debugbar.getSystemInfo.disabled_debugbar.error", nil, "", http.StatusNotImplemented) + return + } + + var requestBody struct { + Query string + Args []any + } + if jsonErr := json.NewDecoder(r.Body).Decode(&requestBody); jsonErr != nil { + c.SetInvalidParamWithErr("explain_request", jsonErr) + return + } + + explain, err := c.App.GetQueryExplain(requestBody.Query, requestBody.Args) + if err != nil { + c.Err = err + return + } + + if err := json.NewEncoder(w).Encode(map[string]string{"explain": explain}); err != nil { + c.Logger.Warn("Error while writing response", mlog.Err(err)) + } +} diff --git a/app/app_iface.go b/app/app_iface.go index c7029bcb56..d25cd26bc5 100644 --- a/app/app_iface.go +++ b/app/app_iface.go @@ -633,6 +633,7 @@ type AppIface interface { GetComplianceReports(page, perPage int) (model.Compliances, *model.AppError) GetCookieDomain() string GetCustomStatus(userID string) (*model.CustomStatus, *model.AppError) + GetDebugBarInfo() (*model.DebugBarInfo, *model.AppError) GetDefaultProfileImage(user *model.User) ([]byte, *model.AppError) GetDeletedChannels(c request.CTX, teamID string, offset int, limit int, userID string) (model.ChannelList, *model.AppError) GetDraft(userID, channelID, rootID string) (*model.Draft, *model.AppError) @@ -740,6 +741,7 @@ type AppIface interface { GetProfileImage(user *model.User) ([]byte, bool, *model.AppError) GetPublicChannelsByIdsForTeam(c request.CTX, teamID string, channelIDs []string) (model.ChannelList, *model.AppError) GetPublicChannelsForTeam(c request.CTX, teamID string, offset int, limit int) (model.ChannelList, *model.AppError) + GetQueryExplain(query string, args []interface{}) (string, *model.AppError) GetReactionsForPost(postID string) ([]*model.Reaction, *model.AppError) GetRecentSearchesForUser(userID string) ([]*model.SearchParams, *model.AppError) GetRecentlyActiveUsersForTeam(teamID string) (map[string]*model.User, *model.AppError) diff --git a/app/debugbar.go b/app/debugbar.go new file mode 100644 index 0000000000..95f29a4966 --- /dev/null +++ b/app/debugbar.go @@ -0,0 +1,87 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package app + +import ( + "net/http" + "runtime" + + "github.com/mattermost/mattermost-server/v6/model" +) + +func (a *App) GetDebugBarInfo() (*model.DebugBarInfo, *model.AppError) { + sessionsCount, err := a.Srv().Store().Session().AnalyticsSessionCount() + if err != nil { + return nil, model.NewAppError("GetDebugBarInfo", "debugbar.info.session-count.error", nil, err.Error(), http.StatusInternalServerError) + } + // Here we are getting information regarding Elastic Search + var elasticServerVersion string + var elasticServerPlugins []string + if a.Srv().Platform().SearchEngine.ElasticsearchEngine != nil { + elasticServerVersion = a.Srv().Platform().SearchEngine.ElasticsearchEngine.GetFullVersion() + elasticServerPlugins = a.Srv().Platform().SearchEngine.ElasticsearchEngine.GetPlugins() + } + + // Here we are getting information regarding LDAP + ldapInterface := a.Channels().Ldap + var vendorName, vendorVersion string + if ldapInterface != nil { + vendorName, vendorVersion = ldapInterface.GetVendorNameAndVendorVersion() + } + + // Here we are getting information regarding the database (mysql/postgres + current schema version) + databaseType, databaseVersion := a.Srv().DatabaseTypeAndSchemaVersion() + + info := model.DebugBarInfo{ + SessionsCount: sessionsCount, + GoVersion: runtime.Version(), + Goroutines: runtime.NumGoroutine(), + Cpus: runtime.NumCPU(), + CgoCalls: runtime.NumCgoCall(), + ServerOS: runtime.GOOS, + ServerArchitecture: runtime.GOARCH, + ServerVersion: model.CurrentVersion, + BuildHash: model.BuildHash, + DatabaseType: databaseType, + DatabaseVersion: databaseVersion, + LdapVendorName: vendorName, + LdapVendorVersion: vendorVersion, + ElasticServerVersion: elasticServerVersion, + ElasticServerPlugins: elasticServerPlugins, + } + + runtime.ReadMemStats(&info.GoMemStats) + + totalSockets := a.TotalWebsocketConnections() + totalMasterDb := a.Srv().Store().TotalMasterDbConnections() + totalReadDb := a.Srv().Store().TotalReadDbConnections() + + // If in HA mode then aggregate all the stats + if a.Cluster() != nil && *a.Config().ClusterSettings.Enable { + stats, appErr := a.Cluster().GetClusterStats() + if appErr != nil { + return nil, appErr + } + + for _, stat := range stats { + totalSockets = totalSockets + stat.TotalWebsocketConnections + totalMasterDb = totalMasterDb + stat.TotalMasterDbConnections + totalReadDb = totalReadDb + stat.TotalReadDbConnections + } + } + + info.WebSocketConnections = totalSockets + info.MasterDBConnections = totalMasterDb + info.ReadDBConnections = totalReadDb + + return &info, nil +} + +func (a *App) GetQueryExplain(query string, args []interface{}) (string, *model.AppError) { + explain, err := a.Srv().Store().Explain(query, args) + if err != nil { + return "", model.NewAppError("GetQueryExplain", "debugbar.query_explain.error", nil, err.Error(), http.StatusInternalServerError) + } + return explain, nil +} diff --git a/app/email/email.go b/app/email/email.go index 25e12b40cf..f07c6a4411 100644 --- a/app/email/email.go +++ b/app/email/email.go @@ -861,7 +861,11 @@ func (es *Service) sendEmailWithCustomReplyTo(to, subject, htmlBody, replyToAddr category = getSendGridCategory(category, license.IsCloud()) - return mail.SendMailUsingConfig(to, subject, htmlBody, mailConfig, license != nil && *license.Features.Compliance, "", "", "", "", category) + err := mail.SendMailUsingConfig(to, subject, htmlBody, mailConfig, license != nil && *license.Features.Compliance, "", "", "", "", category) + if es.debugBar != nil && es.debugBar() != nil && es.debugBar().IsEnabled() { + es.debugBar().SendEmailSent(to, subject, htmlBody, nil, mailConfig, license != nil && *license.Features.Compliance, "", "", "", "", category, err) + } + return err } func (es *Service) sendMailWithCC(to, subject, htmlBody, ccMail, category string) error { @@ -870,7 +874,11 @@ func (es *Service) sendMailWithCC(to, subject, htmlBody, ccMail, category string category = getSendGridCategory(category, license.IsCloud()) - return mail.SendMailUsingConfig(to, subject, htmlBody, mailConfig, license != nil && *license.Features.Compliance, "", "", "", ccMail, category) + err := mail.SendMailUsingConfig(to, subject, htmlBody, mailConfig, license != nil && *license.Features.Compliance, "", "", "", ccMail, category) + if es.debugBar != nil && es.debugBar() != nil && es.debugBar().IsEnabled() { + es.debugBar().SendEmailSent(to, subject, htmlBody, nil, mailConfig, license != nil && *license.Features.Compliance, "", "", "", ccMail, category, err) + } + return err } func (es *Service) SendMailWithEmbeddedFilesAndCustomReplyTo(to, subject, htmlBody, replyToAddress string, embeddedFiles map[string]io.Reader, category string) error { @@ -879,7 +887,11 @@ func (es *Service) SendMailWithEmbeddedFilesAndCustomReplyTo(to, subject, htmlBo category = getSendGridCategory(category, license.IsCloud()) - return mail.SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody, embeddedFiles, mailConfig, license != nil && *license.Features.Compliance, "", "", "", "", category) + err := mail.SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody, embeddedFiles, mailConfig, license != nil && *license.Features.Compliance, "", "", "", "", category) + if es.debugBar != nil && es.debugBar() != nil && es.debugBar().IsEnabled() { + es.debugBar().SendEmailSent(to, subject, htmlBody, embeddedFiles, mailConfig, license != nil && *license.Features.Compliance, "", "", "", "", category, err) + } + return err } func (es *Service) SendMailWithEmbeddedFiles(to, subject, htmlBody string, embeddedFiles map[string]io.Reader, messageID string, inReplyTo string, references string, category string) error { @@ -888,7 +900,11 @@ func (es *Service) SendMailWithEmbeddedFiles(to, subject, htmlBody string, embed category = getSendGridCategory(category, license.IsCloud()) - return mail.SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody, embeddedFiles, mailConfig, license != nil && *license.Features.Compliance, messageID, inReplyTo, references, "", category) + err := mail.SendMailWithEmbeddedFilesUsingConfig(to, subject, htmlBody, embeddedFiles, mailConfig, license != nil && *license.Features.Compliance, messageID, inReplyTo, references, "", category) + if es.debugBar != nil && es.debugBar() != nil && es.debugBar().IsEnabled() { + es.debugBar().SendEmailSent(to, subject, htmlBody, embeddedFiles, mailConfig, license != nil && *license.Features.Compliance, messageID, inReplyTo, references, "", category, err) + } + return err } func (es *Service) InvalidateVerifyEmailTokensForUser(userID string) *model.AppError { diff --git a/app/email/service.go b/app/email/service.go index daa7d1a351..6096ec4163 100644 --- a/app/email/service.go +++ b/app/email/service.go @@ -12,6 +12,7 @@ import ( "github.com/throttled/throttled" "github.com/throttled/throttled/store/memstore" + "github.com/mattermost/mattermost-server/v6/app/platform/debugbar" "github.com/mattermost/mattermost-server/v6/app/users" "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/shared/i18n" @@ -42,8 +43,9 @@ func condenseSiteURL(siteURL string) string { } type Service struct { - config func() *model.Config - license func() *model.License + config func() *model.Config + license func() *model.License + debugBar func() *debugbar.DebugBar userService *users.UserService store store.Store @@ -57,6 +59,7 @@ type Service struct { type ServiceConfig struct { ConfigFn func() *model.Config LicenseFn func() *model.License + DebugBar func() *debugbar.DebugBar TemplatesContainer *templates.Container UserService *users.UserService @@ -71,6 +74,7 @@ func NewService(config ServiceConfig) (*Service, error) { config: config.ConfigFn, templatesContainer: config.TemplatesContainer, license: config.LicenseFn, + debugBar: config.DebugBar, store: config.Store, userService: config.UserService, } diff --git a/app/opentracing/opentracing_layer.go b/app/opentracing/opentracing_layer.go index d9a1e3f723..a381a55485 100644 --- a/app/opentracing/opentracing_layer.go +++ b/app/opentracing/opentracing_layer.go @@ -5872,6 +5872,28 @@ func (a *OpenTracingAppLayer) GetCustomStatus(userID string) (*model.CustomStatu return resultVar0, resultVar1 } +func (a *OpenTracingAppLayer) GetDebugBarInfo() (*model.DebugBarInfo, *model.AppError) { + origCtx := a.ctx + span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetDebugBarInfo") + + a.ctx = newCtx + a.app.Srv().Store().SetContext(newCtx) + defer func() { + a.app.Srv().Store().SetContext(origCtx) + a.ctx = origCtx + }() + + defer span.Finish() + resultVar0, resultVar1 := a.app.GetDebugBarInfo() + + if resultVar1 != nil { + span.LogFields(spanlog.Error(resultVar1)) + ext.Error.Set(span, true) + } + + return resultVar0, resultVar1 +} + func (a *OpenTracingAppLayer) GetDefaultProfileImage(user *model.User) ([]byte, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetDefaultProfileImage") @@ -8560,6 +8582,28 @@ func (a *OpenTracingAppLayer) GetPublicKey(name string) ([]byte, *model.AppError return resultVar0, resultVar1 } +func (a *OpenTracingAppLayer) GetQueryExplain(query string, args []interface{}) (string, *model.AppError) { + origCtx := a.ctx + span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetQueryExplain") + + a.ctx = newCtx + a.app.Srv().Store().SetContext(newCtx) + defer func() { + a.app.Srv().Store().SetContext(origCtx) + a.ctx = origCtx + }() + + defer span.Finish() + resultVar0, resultVar1 := a.app.GetQueryExplain(query, args) + + if resultVar1 != nil { + span.LogFields(spanlog.Error(resultVar1)) + ext.Error.Set(span, true) + } + + return resultVar0, resultVar1 +} + func (a *OpenTracingAppLayer) GetReactionsForPost(postID string) ([]*model.Reaction, *model.AppError) { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.GetReactionsForPost") diff --git a/app/platform/config.go b/app/platform/config.go index 808c1f4ebe..632467ff3a 100644 --- a/app/platform/config.go +++ b/app/platform/config.go @@ -286,6 +286,7 @@ func (ps *PlatformService) LimitedClientConfigWithComputed() map[string]string { // These properties are not configurable, but nevertheless represent configuration expected // by the client. respCfg["NoAccounts"] = strconv.FormatBool(ps.IsFirstUserAccount()) + respCfg["DebugBar"] = strconv.FormatBool(ps.DebugBar.IsEnabled()) return respCfg } @@ -300,6 +301,7 @@ func (ps *PlatformService) ClientConfigWithComputed() map[string]string { // These properties are not configurable, but nevertheless represent configuration expected // by the client. respCfg["NoAccounts"] = strconv.FormatBool(ps.IsFirstUserAccount()) + respCfg["DebugBar"] = strconv.FormatBool(ps.DebugBar.IsEnabled()) respCfg["MaxPostSize"] = strconv.Itoa(ps.MaxPostSize()) respCfg["UpgradedFromTE"] = strconv.FormatBool(ps.isUpgradedFromTE()) respCfg["InstallationDate"] = "" diff --git a/app/platform/debugbar/debugbar.go b/app/platform/debugbar/debugbar.go new file mode 100644 index 0000000000..573c348269 --- /dev/null +++ b/app/platform/debugbar/debugbar.go @@ -0,0 +1,100 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package debugbar + +import ( + "io" + "os" + "strings" + + "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/v6/shared/mail" +) + +const ( + socketEventName = "debugbar" +) + +type DebugBar struct { + publish func(*model.WebSocketEvent) + enabled bool +} + +func New(publish func(*model.WebSocketEvent)) *DebugBar { + return &DebugBar{ + publish: publish, + enabled: os.Getenv("MM_ENABLE_DEBUG_BAR") == "true", + } +} + +func (db *DebugBar) IsEnabled() bool { + return db.enabled +} + +func (db *DebugBar) SendLogEvent(logLevel string, logMessage string, fields map[string]string) { + event := model.NewWebSocketEvent(socketEventName, "", "", "", nil, "") + event.Add("time", model.GetMillis()) + event.Add("type", "log-line") + event.Add("level", logLevel) + event.Add("message", logMessage) + event.Add("fields", fields) + db.publish(event) +} + +func (db *DebugBar) SendApiCall(endpoint, method, statusCode string, elapsed float64) { + if endpoint == "getSystemInfo" || endpoint == "getQueryExplain" { + return + } + event := model.NewWebSocketEvent(socketEventName, "", "", "", nil, "") + event.Add("time", model.GetMillis()) + event.Add("type", "api-call") + event.Add("endpoint", endpoint) + event.Add("method", method) + event.Add("statusCode", statusCode) + event.Add("duration", elapsed) + db.publish(event) +} + +func (db *DebugBar) SendStoreCall(method string, success bool, elapsed float64, params map[string]any) { + event := model.NewWebSocketEvent(socketEventName, "", "", "", nil, "") + event.Add("time", model.GetMillis()) + event.Add("type", "store-call") + event.Add("method", method) + event.Add("params", params) + event.Add("success", success) + event.Add("duration", elapsed) + db.publish(event) +} + +func (db *DebugBar) SendSqlQuery(query string, elapsed float64, args ...any) { + if strings.HasPrefix(query, "EXPLAIN ") { + return + } + event := model.NewWebSocketEvent(socketEventName, "", "", "", nil, "") + event.Add("time", model.GetMillis()) + event.Add("type", "sql-query") + event.Add("query", query) + event.Add("args", args) + event.Add("duration", elapsed) + db.publish(event) +} + +func (db *DebugBar) SendEmailSent(to, subject, htmlBody string, embeddedFiles map[string]io.Reader, config *mail.SMTPConfig, enableComplianceFeatures bool, messageID string, inReplyTo string, references string, ccMail string, category string, err error) { + event := model.NewWebSocketEvent(socketEventName, "", "", "", nil, "") + event.Add("time", model.GetMillis()) + event.Add("type", "email-sent") + event.Add("to", to) + event.Add("subject", subject) + event.Add("htmlBody", htmlBody) + event.Add("embeddedFiles", embeddedFiles) + event.Add("SMTPConfig", config) + event.Add("enableComplianceFeatures", enableComplianceFeatures) + event.Add("messageID", messageID) + event.Add("inReplyTo", inReplyTo) + event.Add("references", references) + event.Add("cc", ccMail) + event.Add("category", category) + event.Add("err", err) + db.publish(event) +} diff --git a/app/platform/debugbar/logger.go b/app/platform/debugbar/logger.go new file mode 100644 index 0000000000..2f2f80191a --- /dev/null +++ b/app/platform/debugbar/logger.go @@ -0,0 +1,58 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package debugbar + +import ( + "bytes" + + "github.com/mattermost/logr/v2" + "github.com/mattermost/mattermost-server/v6/shared/mlog" +) + +type DebugBarLogTarget struct { + debugBar *DebugBar +} + +type DebugBarLogFilter struct{} + +func (_ *DebugBarLogFilter) GetEnabledLevel(level logr.Level) (logr.Level, bool) { + return level, true +} + +type DebugBarLogFormatter struct{} + +func (_ *DebugBarLogFormatter) IsStacktraceNeeded() bool { + return false +} + +func (_ *DebugBarLogFormatter) Format(rec *logr.LogRec, level logr.Level, buf *bytes.Buffer) (*bytes.Buffer, error) { + return bytes.NewBuffer([]byte{}), nil +} + +func NewDebugBarLogTarget(debugBar *DebugBar) *DebugBarLogTarget { + return &DebugBarLogTarget{debugBar: debugBar} +} + +func (dblt *DebugBarLogTarget) Init() error { + return nil +} + +func (dblt *DebugBarLogTarget) Shutdown() error { + return nil +} + +func (dblt *DebugBarLogTarget) Write(p []byte, rec *logr.LogRec) (int, error) { + dblt.debugBar.SendLogEvent(rec.Level().Name, rec.Msg(), dblt.fieldsToStringsMap(rec.Fields()...)) + return len(p), nil +} + +func (dblt *DebugBarLogTarget) fieldsToStringsMap(fields ...mlog.Field) map[string]string { + result := map[string]string{} + for _, field := range fields { + value := &bytes.Buffer{} + field.ValueString(value, nil) + result[field.Key] = value.String() + } + return result +} diff --git a/app/platform/log.go b/app/platform/log.go index 5988d5ee36..4d421472c6 100644 --- a/app/platform/log.go +++ b/app/platform/log.go @@ -13,6 +13,8 @@ import ( "os" "time" + "github.com/mattermost/logr/v2" + "github.com/mattermost/mattermost-server/v6/app/platform/debugbar" "github.com/mattermost/mattermost-server/v6/config" "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/shared/mlog" @@ -78,6 +80,13 @@ func (ps *PlatformService) initLogging() error { } } + if ps.DebugBar.IsEnabled() { + err := ps.logger.AddTarget(debugbar.NewDebugBarLogTarget(ps.DebugBar), "debugbar", &debugbar.DebugBarLogFilter{}, &debugbar.DebugBarLogFormatter{}, logr.DefaultMaxQueueSize) + if err != nil { + return err + } + } + return nil } diff --git a/app/platform/service.go b/app/platform/service.go index 857e14e3c8..2956d2d0fa 100644 --- a/app/platform/service.go +++ b/app/platform/service.go @@ -12,6 +12,7 @@ import ( "sync/atomic" "github.com/mattermost/mattermost-server/v6/app/featureflag" + "github.com/mattermost/mattermost-server/v6/app/platform/debugbar" "github.com/mattermost/mattermost-server/v6/config" "github.com/mattermost/mattermost-server/v6/einterfaces" "github.com/mattermost/mattermost-server/v6/jobs" @@ -23,6 +24,7 @@ import ( "github.com/mattermost/mattermost-server/v6/shared/filestore" "github.com/mattermost/mattermost-server/v6/shared/mlog" "github.com/mattermost/mattermost-server/v6/store" + "github.com/mattermost/mattermost-server/v6/store/debugbarlayer" "github.com/mattermost/mattermost-server/v6/store/localcachelayer" "github.com/mattermost/mattermost-server/v6/store/retrylayer" "github.com/mattermost/mattermost-server/v6/store/searchlayer" @@ -34,9 +36,11 @@ import ( // responsible for non-entity related functionalities that are required // by a product such as database access, configuration access, licensing etc. type PlatformService struct { - sqlStore *sqlstore.SqlStore - Store store.Store - newStore func() (store.Store, error) + sqlStore *sqlstore.SqlStore + DebugBar *debugbar.DebugBar + Store store.Store + newStore func() (store.Store, error) + LastUserID string WebSocketRouter *WebSocketRouter @@ -125,6 +129,7 @@ func New(sc ServiceConfig, options ...Option) (*PlatformService, error) { licenseListeners: map[string]func(*model.License, *model.License){}, additionalClusterHandlers: map[model.ClusterEvent]einterfaces.ClusterMessageHandler{}, } + ps.DebugBar = debugbar.New(ps.Publish) // Step 1: Cache provider. // At the moment we only have this implementation @@ -186,7 +191,7 @@ func New(sc ServiceConfig, options ...Option) (*PlatformService, error) { // Depends on Step 0 (config), 1 (cacheProvider), 3 (search engine), 5 (metrics) and cluster. if ps.newStore == nil { ps.newStore = func() (store.Store, error) { - ps.sqlStore = sqlstore.New(ps.Config().SqlSettings, ps.metricsIFace) + ps.sqlStore = sqlstore.New(ps.Config().SqlSettings, ps.metricsIFace, ps.DebugBar.SendSqlQuery) lcl, err2 := localcachelayer.NewLocalCacheLayer( retrylayer.New(ps.sqlStore), @@ -214,10 +219,15 @@ func New(sc ServiceConfig, options ...Option) (*PlatformService, error) { ps.sqlStore.UpdateLicense(newLicense) }) - return timerlayer.New( + timerStore := timerlayer.New( searchStore, ps.metricsIFace, - ), nil + ) + + if ps.DebugBar.IsEnabled() { + return debugbarlayer.New(timerStore, ps.DebugBar), nil + } + return timerStore, nil } } diff --git a/app/platform/service_test.go b/app/platform/service_test.go index 3b97b68eed..2505bc5831 100644 --- a/app/platform/service_test.go +++ b/app/platform/service_test.go @@ -142,6 +142,8 @@ func TestMetrics(t *testing.T) { mockMetricsImpl.On("Register").Return() mockMetricsImpl.On("ObserveStoreMethodDuration", mock.Anything, mock.Anything, mock.Anything).Return() mockMetricsImpl.On("RegisterDBCollector", mock.AnythingOfType("*sql.DB"), "master") + mockMetricsImpl.On("IncrementWebsocketEvent", "debugbar") + mockMetricsImpl.On("IncrementWebSocketBroadcastBufferSize", mock.AnythingOfType("string"), float64(1)) th := Setup(t, StartMetrics(), func(ps *PlatformService) error { ps.metricsIFace = mockMetricsImpl diff --git a/app/plugin_api_tests/test_db_driver/main.go b/app/plugin_api_tests/test_db_driver/main.go index c97b10ed2e..0cf5e1d983 100644 --- a/app/plugin_api_tests/test_db_driver/main.go +++ b/app/plugin_api_tests/test_db_driver/main.go @@ -31,7 +31,7 @@ func (p *MyPlugin) OnConfigurationChange() error { func (p *MyPlugin) MessageWillBePosted(_ *plugin.Context, _ *model.Post) (*model.Post, string) { settings := p.API.GetUnsanitizedConfig().SqlSettings settings.Trace = model.NewBool(false) - store := sqlstore.New(settings, nil) + store := sqlstore.New(settings, nil, nil) store.GetMasterX().Close() for _, isMaster := range []bool{true, false} { diff --git a/app/server.go b/app/server.go index 5f7e12d982..38143966f9 100644 --- a/app/server.go +++ b/app/server.go @@ -29,6 +29,7 @@ import ( "github.com/mattermost/mattermost-server/v6/app/email" "github.com/mattermost/mattermost-server/v6/app/platform" + "github.com/mattermost/mattermost-server/v6/app/platform/debugbar" "github.com/mattermost/mattermost-server/v6/app/request" "github.com/mattermost/mattermost-server/v6/app/teams" "github.com/mattermost/mattermost-server/v6/app/users" @@ -143,6 +144,14 @@ type Server struct { hooksManager *product.HooksManager } +func (s *Server) DebugBar() *debugbar.DebugBar { + if s.platform != nil { + return s.platform.DebugBar + } + + return nil +} + func (s *Server) Store() store.Store { if s.platform != nil { return s.platform.Store @@ -366,6 +375,7 @@ func NewServer(options ...Option) (*Server, error) { emailService, err := email.NewService(email.ServiceConfig{ ConfigFn: s.platform.Config, LicenseFn: s.License, + DebugBar: s.DebugBar, TemplatesContainer: s.TemplatesContainer(), UserService: s.userService, Store: s.GetStore(), diff --git a/cmd/mattermost/commands/db.go b/cmd/mattermost/commands/db.go index c0d186c265..806eddbdcf 100644 --- a/cmd/mattermost/commands/db.go +++ b/cmd/mattermost/commands/db.go @@ -92,7 +92,7 @@ func initDbCmdF(command *cobra.Command, _ []string) error { } defer configStore.Close() - sqlStore := sqlstore.New(configStore.Get().SqlSettings, nil) + sqlStore := sqlstore.New(configStore.Get().SqlSettings, nil, nil) defer sqlStore.Close() fmt.Println("Database store correctly initialised") @@ -140,7 +140,7 @@ func migrateCmdF(command *cobra.Command, args []string) error { } config := cfgStore.Get() - store := sqlstore.New(config.SqlSettings, nil) + store := sqlstore.New(config.SqlSettings, nil, nil) defer store.Close() CommandPrettyPrintln("Database successfully migrated") @@ -156,7 +156,7 @@ func dbVersionCmdF(command *cobra.Command, args []string) error { } config := cfgStore.Get() - store := sqlstore.New(config.SqlSettings, nil) + store := sqlstore.New(config.SqlSettings, nil, nil) defer store.Close() allFlag, _ := command.Flags().GetBool("all") diff --git a/i18n/en.json b/i18n/en.json index 9abad6d78c..dbd5f98ea3 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -1658,6 +1658,10 @@ "id": "api.custom_status.set_custom_statuses.update.app_error", "translation": "Failed to update the custom status. Please add either emoji or custom text status or both." }, + { + "id": "api.debugbar.getSystemInfo.disabled_debugbar.error", + "translation": "DebugBar feature is disabled." + }, { "id": "api.draft.create_draft.can_not_draft_to_deleted.error", "translation": "Can not save draft to deleted channel" @@ -7347,6 +7351,14 @@ "id": "common.parse_error_int64", "translation": "Failed to parse the value:{{.Value}} to int64" }, + { + "id": "debugbar.info.session-count.error", + "translation": "Unable to count sessions." + }, + { + "id": "debugbar.query_explain.error", + "translation": "Unable to execute the query explain." + }, { "id": "ent.account_migration.get_all_failed", "translation": "Unable to get users." diff --git a/model/debugbar.go b/model/debugbar.go new file mode 100644 index 0000000000..542730ecb5 --- /dev/null +++ b/model/debugbar.go @@ -0,0 +1,28 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +package model + +import "runtime" + +type DebugBarInfo struct { + ServerOS string + ServerArchitecture string + ServerVersion string + BuildHash string + DatabaseType string + DatabaseVersion string + LdapVendorName string + LdapVendorVersion string + ElasticServerVersion string + ElasticServerPlugins []string + WebSocketConnections int + MasterDBConnections int + ReadDBConnections int + SessionsCount int64 + Goroutines int + Cpus int + CgoCalls int64 + GoVersion string + GoMemStats runtime.MemStats +} diff --git a/services/searchengine/bleveengine/bleve_test.go b/services/searchengine/bleveengine/bleve_test.go index 62e30386eb..19101f32f6 100644 --- a/services/searchengine/bleveengine/bleve_test.go +++ b/services/searchengine/bleveengine/bleve_test.go @@ -49,7 +49,7 @@ func (s *BleveEngineTestSuite) setupStore() { driverName = model.DatabaseDriverPostgres } s.SQLSettings = storetest.MakeSqlSettings(driverName, false) - s.SQLStore = sqlstore.New(*s.SQLSettings, nil) + s.SQLStore = sqlstore.New(*s.SQLSettings, nil, nil) cfg := &model.Config{} cfg.SetDefaults() diff --git a/shared/mlog/levels.go b/shared/mlog/levels.go index 1c88e81678..dcd75af37d 100644 --- a/shared/mlog/levels.go +++ b/shared/mlog/levels.go @@ -47,6 +47,9 @@ var ( LvlSharedChannelServiceMessagesInbound = Level{ID: 203, Name: "SharedChannelServiceMsgInbound"} LvlSharedChannelServiceMessagesOutbound = Level{ID: 204, Name: "SharedChannelServiceMsgOutbound"} + // DebugBar + LvlDebugBar = Level{ID: 300, Name: "DebugBar"} + // Focalboard LvlFBTelemetry = Level{ID: 9000, Name: "telemetry"} LvlFBMetrics = Level{ID: 9001, Name: "metrics"} diff --git a/shared/mlog/mlog.go b/shared/mlog/mlog.go index 060f3cd302..f3c8ab22d7 100644 --- a/shared/mlog/mlog.go +++ b/shared/mlog/mlog.go @@ -48,6 +48,8 @@ type Field = logr.Field type Level = logr.Level type Option = logr.Option type Target = logr.Target +type Filter = logr.Filter +type Formatter = logr.Formatter type TargetInfo = logr.TargetInfo type LogRec = logr.LogRec type LogCloner = logr.LogCloner @@ -178,6 +180,11 @@ func NewLogger(options ...Option) (*Logger, error) { }, nil } +// AddTarget adds a new logr.Target to the Logger object. +func (l *Logger) AddTarget(target Target, name string, filter Filter, formatter Formatter, maxQueueSize int) error { + return l.log.Logr().AddTarget(target, name, filter, formatter, maxQueueSize) +} + // Configure provides a new configuration for this logger. // Zero or more sources of config can be provided: // diff --git a/store/debugbarlayer/debugbarlayer.go b/store/debugbarlayer/debugbarlayer.go new file mode 100644 index 0000000000..e0577a78a6 --- /dev/null +++ b/store/debugbarlayer/debugbarlayer.go @@ -0,0 +1,15521 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +// Code generated by "make store-layers" +// DO NOT EDIT + +package debugbarlayer + +import ( + "context" + "time" + //"fmt" + + "github.com/mattermost/mattermost-server/v6/app/platform/debugbar" + "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/v6/store" +) + +type DebugBarLayer struct { + store.Store + debugBar *debugbar.DebugBar + eventPublish func(event *model.WebSocketEvent) + AuditStore store.AuditStore + BotStore store.BotStore + ChannelStore store.ChannelStore + ChannelMemberHistoryStore store.ChannelMemberHistoryStore + ClusterDiscoveryStore store.ClusterDiscoveryStore + CommandStore store.CommandStore + CommandWebhookStore store.CommandWebhookStore + ComplianceStore store.ComplianceStore + DraftStore store.DraftStore + EmojiStore store.EmojiStore + FileInfoStore store.FileInfoStore + GroupStore store.GroupStore + JobStore store.JobStore + LicenseStore store.LicenseStore + LinkMetadataStore store.LinkMetadataStore + NotifyAdminStore store.NotifyAdminStore + OAuthStore store.OAuthStore + PluginStore store.PluginStore + PostStore store.PostStore + PostAcknowledgementStore store.PostAcknowledgementStore + PostPriorityStore store.PostPriorityStore + PreferenceStore store.PreferenceStore + ProductNoticesStore store.ProductNoticesStore + ReactionStore store.ReactionStore + RemoteClusterStore store.RemoteClusterStore + RetentionPolicyStore store.RetentionPolicyStore + RoleStore store.RoleStore + SchemeStore store.SchemeStore + SessionStore store.SessionStore + SharedChannelStore store.SharedChannelStore + StatusStore store.StatusStore + SystemStore store.SystemStore + TeamStore store.TeamStore + TermsOfServiceStore store.TermsOfServiceStore + ThreadStore store.ThreadStore + TokenStore store.TokenStore + TrueUpReviewStore store.TrueUpReviewStore + UploadSessionStore store.UploadSessionStore + UserStore store.UserStore + UserAccessTokenStore store.UserAccessTokenStore + UserTermsOfServiceStore store.UserTermsOfServiceStore + WebhookStore store.WebhookStore +} + +func (s *DebugBarLayer) Audit() store.AuditStore { + return s.AuditStore +} + +func (s *DebugBarLayer) Bot() store.BotStore { + return s.BotStore +} + +func (s *DebugBarLayer) Channel() store.ChannelStore { + return s.ChannelStore +} + +func (s *DebugBarLayer) ChannelMemberHistory() store.ChannelMemberHistoryStore { + return s.ChannelMemberHistoryStore +} + +func (s *DebugBarLayer) ClusterDiscovery() store.ClusterDiscoveryStore { + return s.ClusterDiscoveryStore +} + +func (s *DebugBarLayer) Command() store.CommandStore { + return s.CommandStore +} + +func (s *DebugBarLayer) CommandWebhook() store.CommandWebhookStore { + return s.CommandWebhookStore +} + +func (s *DebugBarLayer) Compliance() store.ComplianceStore { + return s.ComplianceStore +} + +func (s *DebugBarLayer) Draft() store.DraftStore { + return s.DraftStore +} + +func (s *DebugBarLayer) Emoji() store.EmojiStore { + return s.EmojiStore +} + +func (s *DebugBarLayer) FileInfo() store.FileInfoStore { + return s.FileInfoStore +} + +func (s *DebugBarLayer) Group() store.GroupStore { + return s.GroupStore +} + +func (s *DebugBarLayer) Job() store.JobStore { + return s.JobStore +} + +func (s *DebugBarLayer) License() store.LicenseStore { + return s.LicenseStore +} + +func (s *DebugBarLayer) LinkMetadata() store.LinkMetadataStore { + return s.LinkMetadataStore +} + +func (s *DebugBarLayer) NotifyAdmin() store.NotifyAdminStore { + return s.NotifyAdminStore +} + +func (s *DebugBarLayer) OAuth() store.OAuthStore { + return s.OAuthStore +} + +func (s *DebugBarLayer) Plugin() store.PluginStore { + return s.PluginStore +} + +func (s *DebugBarLayer) Post() store.PostStore { + return s.PostStore +} + +func (s *DebugBarLayer) PostAcknowledgement() store.PostAcknowledgementStore { + return s.PostAcknowledgementStore +} + +func (s *DebugBarLayer) PostPriority() store.PostPriorityStore { + return s.PostPriorityStore +} + +func (s *DebugBarLayer) Preference() store.PreferenceStore { + return s.PreferenceStore +} + +func (s *DebugBarLayer) ProductNotices() store.ProductNoticesStore { + return s.ProductNoticesStore +} + +func (s *DebugBarLayer) Reaction() store.ReactionStore { + return s.ReactionStore +} + +func (s *DebugBarLayer) RemoteCluster() store.RemoteClusterStore { + return s.RemoteClusterStore +} + +func (s *DebugBarLayer) RetentionPolicy() store.RetentionPolicyStore { + return s.RetentionPolicyStore +} + +func (s *DebugBarLayer) Role() store.RoleStore { + return s.RoleStore +} + +func (s *DebugBarLayer) Scheme() store.SchemeStore { + return s.SchemeStore +} + +func (s *DebugBarLayer) Session() store.SessionStore { + return s.SessionStore +} + +func (s *DebugBarLayer) SharedChannel() store.SharedChannelStore { + return s.SharedChannelStore +} + +func (s *DebugBarLayer) Status() store.StatusStore { + return s.StatusStore +} + +func (s *DebugBarLayer) System() store.SystemStore { + return s.SystemStore +} + +func (s *DebugBarLayer) Team() store.TeamStore { + return s.TeamStore +} + +func (s *DebugBarLayer) TermsOfService() store.TermsOfServiceStore { + return s.TermsOfServiceStore +} + +func (s *DebugBarLayer) Thread() store.ThreadStore { + return s.ThreadStore +} + +func (s *DebugBarLayer) Token() store.TokenStore { + return s.TokenStore +} + +func (s *DebugBarLayer) TrueUpReview() store.TrueUpReviewStore { + return s.TrueUpReviewStore +} + +func (s *DebugBarLayer) UploadSession() store.UploadSessionStore { + return s.UploadSessionStore +} + +func (s *DebugBarLayer) User() store.UserStore { + return s.UserStore +} + +func (s *DebugBarLayer) UserAccessToken() store.UserAccessTokenStore { + return s.UserAccessTokenStore +} + +func (s *DebugBarLayer) UserTermsOfService() store.UserTermsOfServiceStore { + return s.UserTermsOfServiceStore +} + +func (s *DebugBarLayer) Webhook() store.WebhookStore { + return s.WebhookStore +} + +type DebugBarLayerAuditStore struct { + store.AuditStore + Root *DebugBarLayer +} + +type DebugBarLayerBotStore struct { + store.BotStore + Root *DebugBarLayer +} + +type DebugBarLayerChannelStore struct { + store.ChannelStore + Root *DebugBarLayer +} + +type DebugBarLayerChannelMemberHistoryStore struct { + store.ChannelMemberHistoryStore + Root *DebugBarLayer +} + +type DebugBarLayerClusterDiscoveryStore struct { + store.ClusterDiscoveryStore + Root *DebugBarLayer +} + +type DebugBarLayerCommandStore struct { + store.CommandStore + Root *DebugBarLayer +} + +type DebugBarLayerCommandWebhookStore struct { + store.CommandWebhookStore + Root *DebugBarLayer +} + +type DebugBarLayerComplianceStore struct { + store.ComplianceStore + Root *DebugBarLayer +} + +type DebugBarLayerDraftStore struct { + store.DraftStore + Root *DebugBarLayer +} + +type DebugBarLayerEmojiStore struct { + store.EmojiStore + Root *DebugBarLayer +} + +type DebugBarLayerFileInfoStore struct { + store.FileInfoStore + Root *DebugBarLayer +} + +type DebugBarLayerGroupStore struct { + store.GroupStore + Root *DebugBarLayer +} + +type DebugBarLayerJobStore struct { + store.JobStore + Root *DebugBarLayer +} + +type DebugBarLayerLicenseStore struct { + store.LicenseStore + Root *DebugBarLayer +} + +type DebugBarLayerLinkMetadataStore struct { + store.LinkMetadataStore + Root *DebugBarLayer +} + +type DebugBarLayerNotifyAdminStore struct { + store.NotifyAdminStore + Root *DebugBarLayer +} + +type DebugBarLayerOAuthStore struct { + store.OAuthStore + Root *DebugBarLayer +} + +type DebugBarLayerPluginStore struct { + store.PluginStore + Root *DebugBarLayer +} + +type DebugBarLayerPostStore struct { + store.PostStore + Root *DebugBarLayer +} + +type DebugBarLayerPostAcknowledgementStore struct { + store.PostAcknowledgementStore + Root *DebugBarLayer +} + +type DebugBarLayerPostPriorityStore struct { + store.PostPriorityStore + Root *DebugBarLayer +} + +type DebugBarLayerPreferenceStore struct { + store.PreferenceStore + Root *DebugBarLayer +} + +type DebugBarLayerProductNoticesStore struct { + store.ProductNoticesStore + Root *DebugBarLayer +} + +type DebugBarLayerReactionStore struct { + store.ReactionStore + Root *DebugBarLayer +} + +type DebugBarLayerRemoteClusterStore struct { + store.RemoteClusterStore + Root *DebugBarLayer +} + +type DebugBarLayerRetentionPolicyStore struct { + store.RetentionPolicyStore + Root *DebugBarLayer +} + +type DebugBarLayerRoleStore struct { + store.RoleStore + Root *DebugBarLayer +} + +type DebugBarLayerSchemeStore struct { + store.SchemeStore + Root *DebugBarLayer +} + +type DebugBarLayerSessionStore struct { + store.SessionStore + Root *DebugBarLayer +} + +type DebugBarLayerSharedChannelStore struct { + store.SharedChannelStore + Root *DebugBarLayer +} + +type DebugBarLayerStatusStore struct { + store.StatusStore + Root *DebugBarLayer +} + +type DebugBarLayerSystemStore struct { + store.SystemStore + Root *DebugBarLayer +} + +type DebugBarLayerTeamStore struct { + store.TeamStore + Root *DebugBarLayer +} + +type DebugBarLayerTermsOfServiceStore struct { + store.TermsOfServiceStore + Root *DebugBarLayer +} + +type DebugBarLayerThreadStore struct { + store.ThreadStore + Root *DebugBarLayer +} + +type DebugBarLayerTokenStore struct { + store.TokenStore + Root *DebugBarLayer +} + +type DebugBarLayerTrueUpReviewStore struct { + store.TrueUpReviewStore + Root *DebugBarLayer +} + +type DebugBarLayerUploadSessionStore struct { + store.UploadSessionStore + Root *DebugBarLayer +} + +type DebugBarLayerUserStore struct { + store.UserStore + Root *DebugBarLayer +} + +type DebugBarLayerUserAccessTokenStore struct { + store.UserAccessTokenStore + Root *DebugBarLayer +} + +type DebugBarLayerUserTermsOfServiceStore struct { + store.UserTermsOfServiceStore + Root *DebugBarLayer +} + +type DebugBarLayerWebhookStore struct { + store.WebhookStore + Root *DebugBarLayer +} + +func (s *DebugBarLayerAuditStore) Get(user_id string, offset int, limit int) (model.Audits, error) { + start := time.Now() + + result, err := s.AuditStore.Get(user_id, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["user_id"] = user_id + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("AuditStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerAuditStore) PermanentDeleteByUser(userID string) error { + start := time.Now() + + err := s.AuditStore.PermanentDeleteByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("AuditStore.PermanentDeleteByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerAuditStore) Save(audit *model.Audit) error { + start := time.Now() + + err := s.AuditStore.Save(audit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["audit"] = audit + + s.Root.debugBar.SendStoreCall("AuditStore.Save", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerBotStore) Get(userID string, includeDeleted bool) (*model.Bot, error) { + start := time.Now() + + result, err := s.BotStore.Get(userID, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("BotStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerBotStore) GetAll(options *model.BotGetOptions) ([]*model.Bot, error) { + start := time.Now() + + result, err := s.BotStore.GetAll(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("BotStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerBotStore) PermanentDelete(userID string) error { + start := time.Now() + + err := s.BotStore.PermanentDelete(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("BotStore.PermanentDelete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerBotStore) Save(bot *model.Bot) (*model.Bot, error) { + start := time.Now() + + result, err := s.BotStore.Save(bot) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["bot"] = bot + + s.Root.debugBar.SendStoreCall("BotStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerBotStore) Update(bot *model.Bot) (*model.Bot, error) { + start := time.Now() + + result, err := s.BotStore.Update(bot) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["bot"] = bot + + s.Root.debugBar.SendStoreCall("BotStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) AnalyticsDeletedTypeCount(teamID string, channelType model.ChannelType) (int64, error) { + start := time.Now() + + result, err := s.ChannelStore.AnalyticsDeletedTypeCount(teamID, channelType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["channelType"] = channelType + + s.Root.debugBar.SendStoreCall("ChannelStore.AnalyticsDeletedTypeCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) AnalyticsTypeCount(teamID string, channelType model.ChannelType) (int64, error) { + start := time.Now() + + result, err := s.ChannelStore.AnalyticsTypeCount(teamID, channelType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["channelType"] = channelType + + s.Root.debugBar.SendStoreCall("ChannelStore.AnalyticsTypeCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) Autocomplete(userID string, term string, includeDeleted bool, isGuest bool) (model.ChannelListWithTeamData, error) { + start := time.Now() + + result, err := s.ChannelStore.Autocomplete(userID, term, includeDeleted, isGuest) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["includeDeleted"] = includeDeleted + + debugBarLayerParams["isGuest"] = isGuest + + s.Root.debugBar.SendStoreCall("ChannelStore.Autocomplete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) AutocompleteInTeam(teamID string, userID string, term string, includeDeleted bool, isGuest bool) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.AutocompleteInTeam(teamID, userID, term, includeDeleted, isGuest) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["includeDeleted"] = includeDeleted + + debugBarLayerParams["isGuest"] = isGuest + + s.Root.debugBar.SendStoreCall("ChannelStore.AutocompleteInTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.AutocompleteInTeamForSearch(teamID, userID, term, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("ChannelStore.AutocompleteInTeamForSearch", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) ClearAllCustomRoleAssignments() error { + start := time.Now() + + err := s.ChannelStore.ClearAllCustomRoleAssignments() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("ChannelStore.ClearAllCustomRoleAssignments", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) ClearCaches() { + start := time.Now() + + s.ChannelStore.ClearCaches() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("ChannelStore.ClearCaches", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerChannelStore) ClearMembersForUserCache() { + start := time.Now() + + s.ChannelStore.ClearMembersForUserCache() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("ChannelStore.ClearMembersForUserCache", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerChannelStore) ClearSidebarOnTeamLeave(userID string, teamID string) error { + start := time.Now() + + err := s.ChannelStore.ClearSidebarOnTeamLeave(userID, teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("ChannelStore.ClearSidebarOnTeamLeave", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) CountPostsAfter(channelID string, timestamp int64, userID string) (int, int, error) { + start := time.Now() + + result, resultVar1, err := s.ChannelStore.CountPostsAfter(channelID, timestamp, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["timestamp"] = timestamp + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.CountPostsAfter", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerChannelStore) CountUrgentPostsAfter(channelID string, timestamp int64, userID string) (int, error) { + start := time.Now() + + result, err := s.ChannelStore.CountUrgentPostsAfter(channelID, timestamp, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["timestamp"] = timestamp + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.CountUrgentPostsAfter", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) CreateDirectChannel(userID *model.User, otherUserID *model.User, channelOptions ...model.ChannelOption) (*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.CreateDirectChannel(userID, otherUserID, channelOptions...) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["otherUserID"] = otherUserID + + debugBarLayerParams["channelOptions"] = channelOptions + + s.Root.debugBar.SendStoreCall("ChannelStore.CreateDirectChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) CreateInitialSidebarCategories(userID string, opts *store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) { + start := time.Now() + + result, err := s.ChannelStore.CreateInitialSidebarCategories(userID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ChannelStore.CreateInitialSidebarCategories", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { + start := time.Now() + + result, err := s.ChannelStore.CreateSidebarCategory(userID, teamID, newCategory) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["newCategory"] = newCategory + + s.Root.debugBar.SendStoreCall("ChannelStore.CreateSidebarCategory", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) Delete(channelID string, timestamp int64) error { + start := time.Now() + + err := s.ChannelStore.Delete(channelID, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("ChannelStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) DeleteSidebarCategory(categoryID string) error { + start := time.Now() + + err := s.ChannelStore.DeleteSidebarCategory(categoryID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["categoryID"] = categoryID + + s.Root.debugBar.SendStoreCall("ChannelStore.DeleteSidebarCategory", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences model.Preferences) error { + start := time.Now() + + err := s.ChannelStore.DeleteSidebarChannelsByPreferences(preferences) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["preferences"] = preferences + + s.Root.debugBar.SendStoreCall("ChannelStore.DeleteSidebarChannelsByPreferences", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) Get(id string, allowFromCache bool) (*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.Get(id, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ChannelStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetAll(teamID string) ([]*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.GetAll(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetAllChannelMembersById(id string) ([]string, error) { + start := time.Now() + + result, err := s.ChannelStore.GetAllChannelMembersById(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("ChannelStore.GetAllChannelMembersById", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetAllChannelMembersForUser(userID string, allowFromCache bool, includeDeleted bool) (map[string]string, error) { + start := time.Now() + + result, err := s.ChannelStore.GetAllChannelMembersForUser(userID, allowFromCache, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["allowFromCache"] = allowFromCache + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("ChannelStore.GetAllChannelMembersForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetAllChannelMembersNotifyPropsForChannel(channelID string, allowFromCache bool) (map[string]model.StringMap, error) { + start := time.Now() + + result, err := s.ChannelStore.GetAllChannelMembersNotifyPropsForChannel(channelID, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ChannelStore.GetAllChannelMembersNotifyPropsForChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, error) { + start := time.Now() + + result, err := s.ChannelStore.GetAllChannels(page, perPage, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ChannelStore.GetAllChannels", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetAllChannelsCount(opts store.ChannelSearchOpts) (int64, error) { + start := time.Now() + + result, err := s.ChannelStore.GetAllChannelsCount(opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ChannelStore.GetAllChannelsCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetAllChannelsForExportAfter(limit int, afterID string) ([]*model.ChannelForExport, error) { + start := time.Now() + + result, err := s.ChannelStore.GetAllChannelsForExportAfter(limit, afterID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["afterID"] = afterID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetAllChannelsForExportAfter", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetAllDirectChannelsForExportAfter(limit int, afterID string) ([]*model.DirectChannelForExport, error) { + start := time.Now() + + result, err := s.ChannelStore.GetAllDirectChannelsForExportAfter(limit, afterID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["afterID"] = afterID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetAllDirectChannelsForExportAfter", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.GetByName(team_id, name, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["team_id"] = team_id + + debugBarLayerParams["name"] = name + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ChannelStore.GetByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.GetByNameIncludeDeleted(team_id, name, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["team_id"] = team_id + + debugBarLayerParams["name"] = name + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ChannelStore.GetByNameIncludeDeleted", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.GetByNames(team_id, names, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["team_id"] = team_id + + debugBarLayerParams["names"] = names + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ChannelStore.GetByNames", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelCounts(teamID string, userID string) (*model.ChannelCounts, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelCounts(teamID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelCounts", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelMembersForExport(userID string, teamID string) ([]*model.ChannelMemberForExport, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelMembersForExport(userID, teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelMembersForExport", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelMembersTimezones(channelID string) ([]model.StringMap, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelMembersTimezones(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelMembersTimezones", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelUnread(channelID string, userID string) (*model.ChannelUnread, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelUnread(channelID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelUnread", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannels(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannels(teamID, userID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannels", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelsBatchForIndexing(startTime int64, startChannelID string, limit int) ([]*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelsBatchForIndexing(startTime, startChannelID, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["startTime"] = startTime + + debugBarLayerParams["startChannelID"] = startChannelID + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelsBatchForIndexing", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelsByIds(channelIds []string, includeDeleted bool) ([]*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelsByIds(channelIds, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelIds"] = channelIds + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelsByIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelsByScheme(schemeID string, offset int, limit int) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelsByScheme(schemeID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["schemeID"] = schemeID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelsByScheme", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelsByUser(userID string, includeDeleted bool, lastDeleteAt int, pageSize int, fromChannelID string) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelsByUser(userID, includeDeleted, lastDeleteAt, pageSize, fromChannelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["includeDeleted"] = includeDeleted + + debugBarLayerParams["lastDeleteAt"] = lastDeleteAt + + debugBarLayerParams["pageSize"] = pageSize + + debugBarLayerParams["fromChannelID"] = fromChannelID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelsByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelsWithCursor(teamId string, userId string, opts *model.ChannelSearchOpts, afterChannelID string) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelsWithCursor(teamId, userId, opts, afterChannelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamId"] = teamId + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["opts"] = opts + + debugBarLayerParams["afterChannelID"] = afterChannelID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelsWithCursor", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetChannelsWithTeamDataByIds(channelIds []string, includeDeleted bool) ([]*model.ChannelWithTeamData, error) { + start := time.Now() + + result, err := s.ChannelStore.GetChannelsWithTeamDataByIds(channelIds, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelIds"] = channelIds + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("ChannelStore.GetChannelsWithTeamDataByIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetDeleted(team_id, offset, limit, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["team_id"] = team_id + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetDeleted", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetDeletedByName(team_id string, name string) (*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.GetDeletedByName(team_id, name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["team_id"] = team_id + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("ChannelStore.GetDeletedByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetFileCount(channelID string) (int64, error) { + start := time.Now() + + result, err := s.ChannelStore.GetFileCount(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetFileCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetForPost(postID string) (*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.GetForPost(postID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetForPost", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetGuestCount(channelID string, allowFromCache bool) (int64, error) { + start := time.Now() + + result, err := s.ChannelStore.GetGuestCount(channelID, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ChannelStore.GetGuestCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMany(ids []string, allowFromCache bool) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMany(ids, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ids"] = ids + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMany", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMember(ctx context.Context, channelID string, userID string) (*model.ChannelMember, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMember(ctx, channelID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMemberCount(channelID string, allowFromCache bool) (int64, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMemberCount(channelID, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMemberCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMemberCountFromCache(channelID string) int64 { + start := time.Now() + + result := s.ChannelStore.GetMemberCountFromCache(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMemberCountFromCache", success, elapsed, debugBarLayerParams) + + return result +} + +func (s *DebugBarLayerChannelStore) GetMemberCountsByGroup(ctx context.Context, channelID string, includeTimezones bool) ([]*model.ChannelMemberCountByGroup, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMemberCountsByGroup(ctx, channelID, includeTimezones) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["includeTimezones"] = includeTimezones + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMemberCountsByGroup", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMemberForPost(postID string, userID string) (*model.ChannelMember, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMemberForPost(postID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMemberForPost", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMembers(channelID string, offset int, limit int) (model.ChannelMembers, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMembers(channelID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (model.ChannelMembers, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMembersByChannelIds(channelIds, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelIds"] = channelIds + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMembersByChannelIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMembersByIds(channelID string, userIds []string) (model.ChannelMembers, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMembersByIds(channelID, userIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["userIds"] = userIds + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMembersByIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMembersForUser(teamID string, userID string) (model.ChannelMembers, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMembersForUser(teamID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMembersForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMembersForUserWithCursor(userID string, teamID string, opts *store.ChannelMemberGraphQLSearchOpts) (model.ChannelMembers, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMembersForUserWithCursor(userID, teamID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMembersForUserWithCursor", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMembersForUserWithPagination(userID string, page int, perPage int) (model.ChannelMembersWithTeamData, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMembersForUserWithPagination(userID, page, perPage) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMembersForUserWithPagination", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMembersInfoByChannelIds(channelIDs []string) (map[string][]*model.User, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMembersInfoByChannelIds(channelIDs) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelIDs"] = channelIDs + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMembersInfoByChannelIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetMoreChannels(teamID, userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetMoreChannels", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetPinnedPostCount(channelID string, allowFromCache bool) (int64, error) { + start := time.Now() + + result, err := s.ChannelStore.GetPinnedPostCount(channelID, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ChannelStore.GetPinnedPostCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetPinnedPosts(channelID string) (*model.PostList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetPinnedPosts(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetPinnedPosts", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetPrivateChannelsForTeam(teamID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetPrivateChannelsForTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetPublicChannelsByIdsForTeam(teamID, channelIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["channelIds"] = channelIds + + s.Root.debugBar.SendStoreCall("ChannelStore.GetPublicChannelsByIdsForTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetPublicChannelsForTeam(teamID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetPublicChannelsForTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetSidebarCategories(userID string, opts *store.SidebarCategorySearchOpts) (*model.OrderedSidebarCategories, error) { + start := time.Now() + + result, err := s.ChannelStore.GetSidebarCategories(userID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ChannelStore.GetSidebarCategories", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetSidebarCategoriesForTeamForUser(userID string, teamID string) (*model.OrderedSidebarCategories, error) { + start := time.Now() + + result, err := s.ChannelStore.GetSidebarCategoriesForTeamForUser(userID, teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetSidebarCategoriesForTeamForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetSidebarCategory(categoryID string) (*model.SidebarCategoryWithChannels, error) { + start := time.Now() + + result, err := s.ChannelStore.GetSidebarCategory(categoryID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["categoryID"] = categoryID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetSidebarCategory", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetSidebarCategoryOrder(userID string, teamID string) ([]string, error) { + start := time.Now() + + result, err := s.ChannelStore.GetSidebarCategoryOrder(userID, teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetSidebarCategoryOrder", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetTeamChannels(teamID string) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetTeamChannels(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetTeamChannels", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetTeamForChannel(channelID string) (*model.Team, error) { + start := time.Now() + + result, err := s.ChannelStore.GetTeamForChannel(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetTeamForChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetTeamMembersForChannel(channelID string) ([]string, error) { + start := time.Now() + + result, err := s.ChannelStore.GetTeamMembersForChannel(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.GetTeamMembersForChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetTopChannelsForTeamSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetTopChannelsForTeamSince(teamID, userID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetTopChannelsForTeamSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetTopChannelsForUserSince(userID string, teamID string, since int64, offset int, limit int) (*model.TopChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetTopChannelsForUserSince(userID, teamID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetTopChannelsForUserSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetTopInactiveChannelsForTeamSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopInactiveChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetTopInactiveChannelsForTeamSince(teamID, userID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetTopInactiveChannelsForTeamSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GetTopInactiveChannelsForUserSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopInactiveChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.GetTopInactiveChannelsForUserSince(teamID, userID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelStore.GetTopInactiveChannelsForUserSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) GroupSyncedChannelCount() (int64, error) { + start := time.Now() + + result, err := s.ChannelStore.GroupSyncedChannelCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("ChannelStore.GroupSyncedChannelCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) IncrementMentionCount(channelID string, userIDs []string, isRoot bool, isUrgent bool) error { + start := time.Now() + + err := s.ChannelStore.IncrementMentionCount(channelID, userIDs, isRoot, isUrgent) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["userIDs"] = userIDs + + debugBarLayerParams["isRoot"] = isRoot + + debugBarLayerParams["isUrgent"] = isUrgent + + s.Root.debugBar.SendStoreCall("ChannelStore.IncrementMentionCount", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) InvalidateAllChannelMembersForUser(userID string) { + start := time.Now() + + s.ChannelStore.InvalidateAllChannelMembersForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.InvalidateAllChannelMembersForUser", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerChannelStore) InvalidateCacheForChannelMembersNotifyProps(channelID string) { + start := time.Now() + + s.ChannelStore.InvalidateCacheForChannelMembersNotifyProps(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.InvalidateCacheForChannelMembersNotifyProps", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerChannelStore) InvalidateChannel(id string) { + start := time.Now() + + s.ChannelStore.InvalidateChannel(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("ChannelStore.InvalidateChannel", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerChannelStore) InvalidateChannelByName(teamID string, name string) { + start := time.Now() + + s.ChannelStore.InvalidateChannelByName(teamID, name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("ChannelStore.InvalidateChannelByName", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerChannelStore) InvalidateGuestCount(channelID string) { + start := time.Now() + + s.ChannelStore.InvalidateGuestCount(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.InvalidateGuestCount", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerChannelStore) InvalidateMemberCount(channelID string) { + start := time.Now() + + s.ChannelStore.InvalidateMemberCount(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.InvalidateMemberCount", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerChannelStore) InvalidatePinnedPostCount(channelID string) { + start := time.Now() + + s.ChannelStore.InvalidatePinnedPostCount(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.InvalidatePinnedPostCount", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerChannelStore) IsUserInChannelUseCache(userID string, channelID string) bool { + start := time.Now() + + result := s.ChannelStore.IsUserInChannelUseCache(userID, channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.IsUserInChannelUseCache", success, elapsed, debugBarLayerParams) + + return result +} + +func (s *DebugBarLayerChannelStore) MigrateChannelMembers(fromChannelID string, fromUserID string) (map[string]string, error) { + start := time.Now() + + result, err := s.ChannelStore.MigrateChannelMembers(fromChannelID, fromUserID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["fromChannelID"] = fromChannelID + + debugBarLayerParams["fromUserID"] = fromUserID + + s.Root.debugBar.SendStoreCall("ChannelStore.MigrateChannelMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) PermanentDelete(channelID string) error { + start := time.Now() + + err := s.ChannelStore.PermanentDelete(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.PermanentDelete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) PermanentDeleteByTeam(teamID string) error { + start := time.Now() + + err := s.ChannelStore.PermanentDeleteByTeam(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("ChannelStore.PermanentDeleteByTeam", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) PermanentDeleteMembersByChannel(channelID string) error { + start := time.Now() + + err := s.ChannelStore.PermanentDeleteMembersByChannel(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.PermanentDeleteMembersByChannel", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) PermanentDeleteMembersByUser(userID string) error { + start := time.Now() + + err := s.ChannelStore.PermanentDeleteMembersByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.PermanentDeleteMembersByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, duration model.PostCountGrouping, groupingLocation *time.Location) ([]*model.DurationPostCount, error) { + start := time.Now() + + result, err := s.ChannelStore.PostCountsByDuration(channelIDs, sinceUnixMillis, userID, duration, groupingLocation) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelIDs"] = channelIDs + + debugBarLayerParams["sinceUnixMillis"] = sinceUnixMillis + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["duration"] = duration + + debugBarLayerParams["groupingLocation"] = groupingLocation + + s.Root.debugBar.SendStoreCall("ChannelStore.PostCountsByDuration", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) RemoveAllDeactivatedMembers(channelID string) error { + start := time.Now() + + err := s.ChannelStore.RemoveAllDeactivatedMembers(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelStore.RemoveAllDeactivatedMembers", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) RemoveMember(channelID string, userID string) error { + start := time.Now() + + err := s.ChannelStore.RemoveMember(channelID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.RemoveMember", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) RemoveMembers(channelID string, userIds []string) error { + start := time.Now() + + err := s.ChannelStore.RemoveMembers(channelID, userIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["userIds"] = userIds + + s.Root.debugBar.SendStoreCall("ChannelStore.RemoveMembers", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) ResetAllChannelSchemes() error { + start := time.Now() + + err := s.ChannelStore.ResetAllChannelSchemes() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("ChannelStore.ResetAllChannelSchemes", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) Restore(channelID string, timestamp int64) error { + start := time.Now() + + err := s.ChannelStore.Restore(channelID, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("ChannelStore.Restore", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.Save(channel, maxChannelsPerTeam) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channel"] = channel + + debugBarLayerParams["maxChannelsPerTeam"] = maxChannelsPerTeam + + s.Root.debugBar.SendStoreCall("ChannelStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) (*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.SaveDirectChannel(channel, member1, member2) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channel"] = channel + + debugBarLayerParams["member1"] = member1 + + debugBarLayerParams["member2"] = member2 + + s.Root.debugBar.SendStoreCall("ChannelStore.SaveDirectChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) SaveMember(member *model.ChannelMember) (*model.ChannelMember, error) { + start := time.Now() + + result, err := s.ChannelStore.SaveMember(member) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["member"] = member + + s.Root.debugBar.SendStoreCall("ChannelStore.SaveMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) SaveMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error) { + start := time.Now() + + result, err := s.ChannelStore.SaveMultipleMembers(members) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["members"] = members + + s.Root.debugBar.SendStoreCall("ChannelStore.SaveMultipleMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, int64, error) { + start := time.Now() + + result, resultVar1, err := s.ChannelStore.SearchAllChannels(term, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["term"] = term + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ChannelStore.SearchAllChannels", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.SearchArchivedInTeam(teamID, term, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.SearchArchivedInTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.SearchForUserInTeam(userID, teamID, term, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("ChannelStore.SearchForUserInTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) SearchGroupChannels(userID string, term string) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.SearchGroupChannels(userID, term) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["term"] = term + + s.Root.debugBar.SendStoreCall("ChannelStore.SearchGroupChannels", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.SearchInTeam(teamID, term, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("ChannelStore.SearchInTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) SearchMore(userID string, teamID string, term string) (model.ChannelList, error) { + start := time.Now() + + result, err := s.ChannelStore.SearchMore(userID, teamID, term) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["term"] = term + + s.Root.debugBar.SendStoreCall("ChannelStore.SearchMore", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) SetDeleteAt(channelID string, deleteAt int64, updateAt int64) error { + start := time.Now() + + err := s.ChannelStore.SetDeleteAt(channelID, deleteAt, updateAt) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["deleteAt"] = deleteAt + + debugBarLayerParams["updateAt"] = updateAt + + s.Root.debugBar.SendStoreCall("ChannelStore.SetDeleteAt", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) SetShared(channelId string, shared bool) error { + start := time.Now() + + err := s.ChannelStore.SetShared(channelId, shared) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelId"] = channelId + + debugBarLayerParams["shared"] = shared + + s.Root.debugBar.SendStoreCall("ChannelStore.SetShared", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) Update(channel *model.Channel) (*model.Channel, error) { + start := time.Now() + + result, err := s.ChannelStore.Update(channel) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channel"] = channel + + s.Root.debugBar.SendStoreCall("ChannelStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) UpdateLastViewedAt(channelIds []string, userID string) (map[string]int64, error) { + start := time.Now() + + result, err := s.ChannelStore.UpdateLastViewedAt(channelIds, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelIds"] = channelIds + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateLastViewedAt", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) UpdateLastViewedAtPost(unreadPost *model.Post, userID string, mentionCount int, mentionCountRoot int, urgentMentionCount int, setUnreadCountRoot bool) (*model.ChannelUnreadAt, error) { + start := time.Now() + + result, err := s.ChannelStore.UpdateLastViewedAtPost(unreadPost, userID, mentionCount, mentionCountRoot, urgentMentionCount, setUnreadCountRoot) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["unreadPost"] = unreadPost + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["mentionCount"] = mentionCount + + debugBarLayerParams["mentionCountRoot"] = mentionCountRoot + + debugBarLayerParams["urgentMentionCount"] = urgentMentionCount + + debugBarLayerParams["setUnreadCountRoot"] = setUnreadCountRoot + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateLastViewedAtPost", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) UpdateMember(member *model.ChannelMember) (*model.ChannelMember, error) { + start := time.Now() + + result, err := s.ChannelStore.UpdateMember(member) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["member"] = member + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) UpdateMemberNotifyProps(channelID string, userID string, props map[string]string) (*model.ChannelMember, error) { + start := time.Now() + + result, err := s.ChannelStore.UpdateMemberNotifyProps(channelID, userID, props) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["props"] = props + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateMemberNotifyProps", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) UpdateMembersRole(channelID string, userIDs []string) error { + start := time.Now() + + err := s.ChannelStore.UpdateMembersRole(channelID, userIDs) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["userIDs"] = userIDs + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateMembersRole", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) UpdateMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error) { + start := time.Now() + + result, err := s.ChannelStore.UpdateMultipleMembers(members) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["members"] = members + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateMultipleMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { + start := time.Now() + + result, resultVar1, err := s.ChannelStore.UpdateSidebarCategories(userID, teamID, categories) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["categories"] = categories + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateSidebarCategories", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerChannelStore) UpdateSidebarCategoryOrder(userID string, teamID string, categoryOrder []string) error { + start := time.Now() + + err := s.ChannelStore.UpdateSidebarCategoryOrder(userID, teamID, categoryOrder) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["categoryOrder"] = categoryOrder + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateSidebarCategoryOrder", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) UpdateSidebarChannelCategoryOnMove(channel *model.Channel, newTeamID string) error { + start := time.Now() + + err := s.ChannelStore.UpdateSidebarChannelCategoryOnMove(channel, newTeamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channel"] = channel + + debugBarLayerParams["newTeamID"] = newTeamID + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateSidebarChannelCategoryOnMove", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences model.Preferences) error { + start := time.Now() + + err := s.ChannelStore.UpdateSidebarChannelsByPreferences(preferences) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["preferences"] = preferences + + s.Root.debugBar.SendStoreCall("ChannelStore.UpdateSidebarChannelsByPreferences", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelStore) UserBelongsToChannels(userID string, channelIds []string) (bool, error) { + start := time.Now() + + result, err := s.ChannelStore.UserBelongsToChannels(userID, channelIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelIds"] = channelIds + + s.Root.debugBar.SendStoreCall("ChannelStore.UserBelongsToChannels", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelMemberHistoryStore) DeleteOrphanedRows(limit int) (int64, error) { + start := time.Now() + + result, err := s.ChannelMemberHistoryStore.DeleteOrphanedRows(limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelMemberHistoryStore.DeleteOrphanedRows", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelMemberHistoryStore) GetChannelsLeftSince(userID string, since int64) ([]string, error) { + start := time.Now() + + result, err := s.ChannelMemberHistoryStore.GetChannelsLeftSince(userID, since) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["since"] = since + + s.Root.debugBar.SendStoreCall("ChannelMemberHistoryStore.GetChannelsLeftSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelMemberHistoryStore) GetUsersInChannelDuring(startTime int64, endTime int64, channelID string) ([]*model.ChannelMemberHistoryResult, error) { + start := time.Now() + + result, err := s.ChannelMemberHistoryStore.GetUsersInChannelDuring(startTime, endTime, channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["startTime"] = startTime + + debugBarLayerParams["endTime"] = endTime + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("ChannelMemberHistoryStore.GetUsersInChannelDuring", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelMemberHistoryStore) LogJoinEvent(userID string, channelID string, joinTime int64) error { + start := time.Now() + + err := s.ChannelMemberHistoryStore.LogJoinEvent(userID, channelID, joinTime) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["joinTime"] = joinTime + + s.Root.debugBar.SendStoreCall("ChannelMemberHistoryStore.LogJoinEvent", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelMemberHistoryStore) LogLeaveEvent(userID string, channelID string, leaveTime int64) error { + start := time.Now() + + err := s.ChannelMemberHistoryStore.LogLeaveEvent(userID, channelID, leaveTime) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["leaveTime"] = leaveTime + + s.Root.debugBar.SendStoreCall("ChannelMemberHistoryStore.LogLeaveEvent", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerChannelMemberHistoryStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { + start := time.Now() + + result, err := s.ChannelMemberHistoryStore.PermanentDeleteBatch(endTime, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["endTime"] = endTime + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ChannelMemberHistoryStore.PermanentDeleteBatch", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerChannelMemberHistoryStore) PermanentDeleteBatchForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { + start := time.Now() + + result, resultVar1, err := s.ChannelMemberHistoryStore.PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["now"] = now + + debugBarLayerParams["globalPolicyEndTime"] = globalPolicyEndTime + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["cursor"] = cursor + + s.Root.debugBar.SendStoreCall("ChannelMemberHistoryStore.PermanentDeleteBatchForRetentionPolicies", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerClusterDiscoveryStore) Cleanup() error { + start := time.Now() + + err := s.ClusterDiscoveryStore.Cleanup() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("ClusterDiscoveryStore.Cleanup", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerClusterDiscoveryStore) Delete(discovery *model.ClusterDiscovery) (bool, error) { + start := time.Now() + + result, err := s.ClusterDiscoveryStore.Delete(discovery) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["discovery"] = discovery + + s.Root.debugBar.SendStoreCall("ClusterDiscoveryStore.Delete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerClusterDiscoveryStore) Exists(discovery *model.ClusterDiscovery) (bool, error) { + start := time.Now() + + result, err := s.ClusterDiscoveryStore.Exists(discovery) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["discovery"] = discovery + + s.Root.debugBar.SendStoreCall("ClusterDiscoveryStore.Exists", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerClusterDiscoveryStore) GetAll(discoveryType string, clusterName string) ([]*model.ClusterDiscovery, error) { + start := time.Now() + + result, err := s.ClusterDiscoveryStore.GetAll(discoveryType, clusterName) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["discoveryType"] = discoveryType + + debugBarLayerParams["clusterName"] = clusterName + + s.Root.debugBar.SendStoreCall("ClusterDiscoveryStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerClusterDiscoveryStore) Save(discovery *model.ClusterDiscovery) error { + start := time.Now() + + err := s.ClusterDiscoveryStore.Save(discovery) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["discovery"] = discovery + + s.Root.debugBar.SendStoreCall("ClusterDiscoveryStore.Save", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerClusterDiscoveryStore) SetLastPingAt(discovery *model.ClusterDiscovery) error { + start := time.Now() + + err := s.ClusterDiscoveryStore.SetLastPingAt(discovery) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["discovery"] = discovery + + s.Root.debugBar.SendStoreCall("ClusterDiscoveryStore.SetLastPingAt", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerCommandStore) AnalyticsCommandCount(teamID string) (int64, error) { + start := time.Now() + + result, err := s.CommandStore.AnalyticsCommandCount(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("CommandStore.AnalyticsCommandCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerCommandStore) Delete(commandID string, timestamp int64) error { + start := time.Now() + + err := s.CommandStore.Delete(commandID, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["commandID"] = commandID + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("CommandStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerCommandStore) Get(id string) (*model.Command, error) { + start := time.Now() + + result, err := s.CommandStore.Get(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("CommandStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerCommandStore) GetByTeam(teamID string) ([]*model.Command, error) { + start := time.Now() + + result, err := s.CommandStore.GetByTeam(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("CommandStore.GetByTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerCommandStore) GetByTrigger(teamID string, trigger string) (*model.Command, error) { + start := time.Now() + + result, err := s.CommandStore.GetByTrigger(teamID, trigger) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["trigger"] = trigger + + s.Root.debugBar.SendStoreCall("CommandStore.GetByTrigger", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerCommandStore) PermanentDeleteByTeam(teamID string) error { + start := time.Now() + + err := s.CommandStore.PermanentDeleteByTeam(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("CommandStore.PermanentDeleteByTeam", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerCommandStore) PermanentDeleteByUser(userID string) error { + start := time.Now() + + err := s.CommandStore.PermanentDeleteByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("CommandStore.PermanentDeleteByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerCommandStore) Save(webhook *model.Command) (*model.Command, error) { + start := time.Now() + + result, err := s.CommandStore.Save(webhook) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["webhook"] = webhook + + s.Root.debugBar.SendStoreCall("CommandStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerCommandStore) Update(hook *model.Command) (*model.Command, error) { + start := time.Now() + + result, err := s.CommandStore.Update(hook) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["hook"] = hook + + s.Root.debugBar.SendStoreCall("CommandStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerCommandWebhookStore) Cleanup() { + start := time.Now() + + s.CommandWebhookStore.Cleanup() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("CommandWebhookStore.Cleanup", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerCommandWebhookStore) Get(id string) (*model.CommandWebhook, error) { + start := time.Now() + + result, err := s.CommandWebhookStore.Get(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("CommandWebhookStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerCommandWebhookStore) Save(webhook *model.CommandWebhook) (*model.CommandWebhook, error) { + start := time.Now() + + result, err := s.CommandWebhookStore.Save(webhook) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["webhook"] = webhook + + s.Root.debugBar.SendStoreCall("CommandWebhookStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerCommandWebhookStore) TryUse(id string, limit int) error { + start := time.Now() + + err := s.CommandWebhookStore.TryUse(id, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("CommandWebhookStore.TryUse", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerComplianceStore) ComplianceExport(compliance *model.Compliance, cursor model.ComplianceExportCursor, limit int) ([]*model.CompliancePost, model.ComplianceExportCursor, error) { + start := time.Now() + + result, resultVar1, err := s.ComplianceStore.ComplianceExport(compliance, cursor, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["compliance"] = compliance + + debugBarLayerParams["cursor"] = cursor + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ComplianceStore.ComplianceExport", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerComplianceStore) Get(id string) (*model.Compliance, error) { + start := time.Now() + + result, err := s.ComplianceStore.Get(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("ComplianceStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerComplianceStore) GetAll(offset int, limit int) (model.Compliances, error) { + start := time.Now() + + result, err := s.ComplianceStore.GetAll(offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ComplianceStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerComplianceStore) MessageExport(ctx context.Context, cursor model.MessageExportCursor, limit int) ([]*model.MessageExport, model.MessageExportCursor, error) { + start := time.Now() + + result, resultVar1, err := s.ComplianceStore.MessageExport(ctx, cursor, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["cursor"] = cursor + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ComplianceStore.MessageExport", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerComplianceStore) Save(compliance *model.Compliance) (*model.Compliance, error) { + start := time.Now() + + result, err := s.ComplianceStore.Save(compliance) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["compliance"] = compliance + + s.Root.debugBar.SendStoreCall("ComplianceStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerComplianceStore) Update(compliance *model.Compliance) (*model.Compliance, error) { + start := time.Now() + + result, err := s.ComplianceStore.Update(compliance) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["compliance"] = compliance + + s.Root.debugBar.SendStoreCall("ComplianceStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerDraftStore) Delete(userID string, channelID string, rootID string) error { + start := time.Now() + + err := s.DraftStore.Delete(userID, channelID, rootID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["rootID"] = rootID + + s.Root.debugBar.SendStoreCall("DraftStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerDraftStore) Get(userID string, channelID string, rootID string, includeDeleted bool) (*model.Draft, error) { + start := time.Now() + + result, err := s.DraftStore.Get(userID, channelID, rootID, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["rootID"] = rootID + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("DraftStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerDraftStore) GetDraftsForUser(userID string, teamID string) ([]*model.Draft, error) { + start := time.Now() + + result, err := s.DraftStore.GetDraftsForUser(userID, teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("DraftStore.GetDraftsForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerDraftStore) Save(d *model.Draft) (*model.Draft, error) { + start := time.Now() + + result, err := s.DraftStore.Save(d) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["d"] = d + + s.Root.debugBar.SendStoreCall("DraftStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerDraftStore) Update(d *model.Draft) (*model.Draft, error) { + start := time.Now() + + result, err := s.DraftStore.Update(d) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["d"] = d + + s.Root.debugBar.SendStoreCall("DraftStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerEmojiStore) Delete(emoji *model.Emoji, timestamp int64) error { + start := time.Now() + + err := s.EmojiStore.Delete(emoji, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["emoji"] = emoji + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("EmojiStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerEmojiStore) Get(ctx context.Context, id string, allowFromCache bool) (*model.Emoji, error) { + start := time.Now() + + result, err := s.EmojiStore.Get(ctx, id, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["id"] = id + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("EmojiStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerEmojiStore) GetByName(ctx context.Context, name string, allowFromCache bool) (*model.Emoji, error) { + start := time.Now() + + result, err := s.EmojiStore.GetByName(ctx, name, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["name"] = name + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("EmojiStore.GetByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerEmojiStore) GetList(offset int, limit int, sort string) ([]*model.Emoji, error) { + start := time.Now() + + result, err := s.EmojiStore.GetList(offset, limit, sort) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["sort"] = sort + + s.Root.debugBar.SendStoreCall("EmojiStore.GetList", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerEmojiStore) GetMultipleByName(names []string) ([]*model.Emoji, error) { + start := time.Now() + + result, err := s.EmojiStore.GetMultipleByName(names) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["names"] = names + + s.Root.debugBar.SendStoreCall("EmojiStore.GetMultipleByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerEmojiStore) Save(emoji *model.Emoji) (*model.Emoji, error) { + start := time.Now() + + result, err := s.EmojiStore.Save(emoji) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["emoji"] = emoji + + s.Root.debugBar.SendStoreCall("EmojiStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerEmojiStore) Search(name string, prefixOnly bool, limit int) ([]*model.Emoji, error) { + start := time.Now() + + result, err := s.EmojiStore.Search(name, prefixOnly, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["name"] = name + + debugBarLayerParams["prefixOnly"] = prefixOnly + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("EmojiStore.Search", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) AttachToPost(fileID string, postID string, creatorID string) error { + start := time.Now() + + err := s.FileInfoStore.AttachToPost(fileID, postID, creatorID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["fileID"] = fileID + + debugBarLayerParams["postID"] = postID + + debugBarLayerParams["creatorID"] = creatorID + + s.Root.debugBar.SendStoreCall("FileInfoStore.AttachToPost", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerFileInfoStore) ClearCaches() { + start := time.Now() + + s.FileInfoStore.ClearCaches() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("FileInfoStore.ClearCaches", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerFileInfoStore) CountAll() (int64, error) { + start := time.Now() + + result, err := s.FileInfoStore.CountAll() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("FileInfoStore.CountAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) DeleteForPost(postID string) (string, error) { + start := time.Now() + + result, err := s.FileInfoStore.DeleteForPost(postID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + s.Root.debugBar.SendStoreCall("FileInfoStore.DeleteForPost", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) Get(id string) (*model.FileInfo, error) { + start := time.Now() + + result, err := s.FileInfoStore.Get(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("FileInfoStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) GetByIds(ids []string) ([]*model.FileInfo, error) { + start := time.Now() + + result, err := s.FileInfoStore.GetByIds(ids) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ids"] = ids + + s.Root.debugBar.SendStoreCall("FileInfoStore.GetByIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) GetByPath(path string) (*model.FileInfo, error) { + start := time.Now() + + result, err := s.FileInfoStore.GetByPath(path) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["path"] = path + + s.Root.debugBar.SendStoreCall("FileInfoStore.GetByPath", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) GetFilesBatchForIndexing(startTime int64, startFileID string, limit int) ([]*model.FileForIndexing, error) { + start := time.Now() + + result, err := s.FileInfoStore.GetFilesBatchForIndexing(startTime, startFileID, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["startTime"] = startTime + + debugBarLayerParams["startFileID"] = startFileID + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("FileInfoStore.GetFilesBatchForIndexing", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) GetForPost(postID string, readFromMaster bool, includeDeleted bool, allowFromCache bool) ([]*model.FileInfo, error) { + start := time.Now() + + result, err := s.FileInfoStore.GetForPost(postID, readFromMaster, includeDeleted, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + debugBarLayerParams["readFromMaster"] = readFromMaster + + debugBarLayerParams["includeDeleted"] = includeDeleted + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("FileInfoStore.GetForPost", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) GetForUser(userID string) ([]*model.FileInfo, error) { + start := time.Now() + + result, err := s.FileInfoStore.GetForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("FileInfoStore.GetForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) GetFromMaster(id string) (*model.FileInfo, error) { + start := time.Now() + + result, err := s.FileInfoStore.GetFromMaster(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("FileInfoStore.GetFromMaster", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) GetStorageUsage(allowFromCache bool, includeDeleted bool) (int64, error) { + start := time.Now() + + result, err := s.FileInfoStore.GetStorageUsage(allowFromCache, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["allowFromCache"] = allowFromCache + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("FileInfoStore.GetStorageUsage", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) GetUptoNSizeFileTime(n int64) (int64, error) { + start := time.Now() + + result, err := s.FileInfoStore.GetUptoNSizeFileTime(n) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["n"] = n + + s.Root.debugBar.SendStoreCall("FileInfoStore.GetUptoNSizeFileTime", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) GetWithOptions(page int, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, error) { + start := time.Now() + + result, err := s.FileInfoStore.GetWithOptions(page, perPage, opt) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + debugBarLayerParams["opt"] = opt + + s.Root.debugBar.SendStoreCall("FileInfoStore.GetWithOptions", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) InvalidateFileInfosForPostCache(postID string, deleted bool) { + start := time.Now() + + s.FileInfoStore.InvalidateFileInfosForPostCache(postID, deleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + debugBarLayerParams["deleted"] = deleted + + s.Root.debugBar.SendStoreCall("FileInfoStore.InvalidateFileInfosForPostCache", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerFileInfoStore) PermanentDelete(fileID string) error { + start := time.Now() + + err := s.FileInfoStore.PermanentDelete(fileID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["fileID"] = fileID + + s.Root.debugBar.SendStoreCall("FileInfoStore.PermanentDelete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerFileInfoStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { + start := time.Now() + + result, err := s.FileInfoStore.PermanentDeleteBatch(endTime, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["endTime"] = endTime + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("FileInfoStore.PermanentDeleteBatch", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) PermanentDeleteByUser(userID string) (int64, error) { + start := time.Now() + + result, err := s.FileInfoStore.PermanentDeleteByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("FileInfoStore.PermanentDeleteByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) Save(info *model.FileInfo) (*model.FileInfo, error) { + start := time.Now() + + result, err := s.FileInfoStore.Save(info) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["info"] = info + + s.Root.debugBar.SendStoreCall("FileInfoStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) Search(paramsList []*model.SearchParams, userID string, teamID string, page int, perPage int) (*model.FileInfoList, error) { + start := time.Now() + + result, err := s.FileInfoStore.Search(paramsList, userID, teamID, page, perPage) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["paramsList"] = paramsList + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + s.Root.debugBar.SendStoreCall("FileInfoStore.Search", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerFileInfoStore) SetContent(fileID string, content string) error { + start := time.Now() + + err := s.FileInfoStore.SetContent(fileID, content) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["fileID"] = fileID + + debugBarLayerParams["content"] = content + + s.Root.debugBar.SendStoreCall("FileInfoStore.SetContent", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerFileInfoStore) Upsert(info *model.FileInfo) (*model.FileInfo, error) { + start := time.Now() + + result, err := s.FileInfoStore.Upsert(info) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["info"] = info + + s.Root.debugBar.SendStoreCall("FileInfoStore.Upsert", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, syncableID string, syncableType model.GroupSyncableType) ([]string, error) { + start := time.Now() + + result, err := s.GroupStore.AdminRoleGroupsForSyncableMember(userID, syncableID, syncableType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["syncableID"] = syncableID + + debugBarLayerParams["syncableType"] = syncableType + + s.Root.debugBar.SendStoreCall("GroupStore.AdminRoleGroupsForSyncableMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) { + start := time.Now() + + result, err := s.GroupStore.ChannelMembersMinusGroupMembers(channelID, groupIDs, page, perPage) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["groupIDs"] = groupIDs + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + s.Root.debugBar.SendStoreCall("GroupStore.ChannelMembersMinusGroupMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) ChannelMembersToAdd(since int64, channelID *string, includeRemovedMembers bool) ([]*model.UserChannelIDPair, error) { + start := time.Now() + + result, err := s.GroupStore.ChannelMembersToAdd(since, channelID, includeRemovedMembers) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["since"] = since + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["includeRemovedMembers"] = includeRemovedMembers + + s.Root.debugBar.SendStoreCall("GroupStore.ChannelMembersToAdd", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, error) { + start := time.Now() + + result, err := s.GroupStore.ChannelMembersToRemove(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("GroupStore.ChannelMembersToRemove", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, error) { + start := time.Now() + + result, err := s.GroupStore.CountChannelMembersMinusGroupMembers(channelID, groupIDs) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["groupIDs"] = groupIDs + + s.Root.debugBar.SendStoreCall("GroupStore.CountChannelMembersMinusGroupMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) CountGroupsByChannel(channelID string, opts model.GroupSearchOpts) (int64, error) { + start := time.Now() + + result, err := s.GroupStore.CountGroupsByChannel(channelID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("GroupStore.CountGroupsByChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) CountGroupsByTeam(teamID string, opts model.GroupSearchOpts) (int64, error) { + start := time.Now() + + result, err := s.GroupStore.CountGroupsByTeam(teamID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("GroupStore.CountGroupsByTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, error) { + start := time.Now() + + result, err := s.GroupStore.CountTeamMembersMinusGroupMembers(teamID, groupIDs) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["groupIDs"] = groupIDs + + s.Root.debugBar.SendStoreCall("GroupStore.CountTeamMembersMinusGroupMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) Create(group *model.Group) (*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.Create(group) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["group"] = group + + s.Root.debugBar.SendStoreCall("GroupStore.Create", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) { + start := time.Now() + + result, err := s.GroupStore.CreateGroupSyncable(groupSyncable) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupSyncable"] = groupSyncable + + s.Root.debugBar.SendStoreCall("GroupStore.CreateGroupSyncable", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) CreateWithUserIds(group *model.GroupWithUserIds) (*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.CreateWithUserIds(group) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["group"] = group + + s.Root.debugBar.SendStoreCall("GroupStore.CreateWithUserIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) Delete(groupID string) (*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.Delete(groupID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + s.Root.debugBar.SendStoreCall("GroupStore.Delete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) { + start := time.Now() + + result, err := s.GroupStore.DeleteGroupSyncable(groupID, syncableID, syncableType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["syncableID"] = syncableID + + debugBarLayerParams["syncableType"] = syncableType + + s.Root.debugBar.SendStoreCall("GroupStore.DeleteGroupSyncable", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, error) { + start := time.Now() + + result, err := s.GroupStore.DeleteMember(groupID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("GroupStore.DeleteMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) DeleteMembers(groupID string, userIDs []string) ([]*model.GroupMember, error) { + start := time.Now() + + result, err := s.GroupStore.DeleteMembers(groupID, userIDs) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["userIDs"] = userIDs + + s.Root.debugBar.SendStoreCall("GroupStore.DeleteMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) DistinctGroupMemberCount() (int64, error) { + start := time.Now() + + result, err := s.GroupStore.DistinctGroupMemberCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("GroupStore.DistinctGroupMemberCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) DistinctGroupMemberCountForSource(source model.GroupSource) (int64, error) { + start := time.Now() + + result, err := s.GroupStore.DistinctGroupMemberCountForSource(source) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["source"] = source + + s.Root.debugBar.SendStoreCall("GroupStore.DistinctGroupMemberCountForSource", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) Get(groupID string) (*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.Get(groupID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + s.Root.debugBar.SendStoreCall("GroupStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.GetAllBySource(groupSource) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupSource"] = groupSource + + s.Root.debugBar.SendStoreCall("GroupStore.GetAllBySource", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, error) { + start := time.Now() + + result, err := s.GroupStore.GetAllGroupSyncablesByGroupId(groupID, syncableType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["syncableType"] = syncableType + + s.Root.debugBar.SendStoreCall("GroupStore.GetAllGroupSyncablesByGroupId", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.GetByIDs(groupIDs) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupIDs"] = groupIDs + + s.Root.debugBar.SendStoreCall("GroupStore.GetByIDs", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.GetByName(name, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["name"] = name + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("GroupStore.GetByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.GetByRemoteID(remoteID, groupSource) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remoteID"] = remoteID + + debugBarLayerParams["groupSource"] = groupSource + + s.Root.debugBar.SendStoreCall("GroupStore.GetByRemoteID", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetByUser(userID string) ([]*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.GetByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("GroupStore.GetByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) { + start := time.Now() + + result, err := s.GroupStore.GetGroupSyncable(groupID, syncableID, syncableType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["syncableID"] = syncableID + + debugBarLayerParams["syncableType"] = syncableType + + s.Root.debugBar.SendStoreCall("GroupStore.GetGroupSyncable", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpts, viewRestrictions *model.ViewUsersRestrictions) ([]*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.GetGroups(page, perPage, opts, viewRestrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + debugBarLayerParams["opts"] = opts + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + s.Root.debugBar.SendStoreCall("GroupStore.GetGroups", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamID string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, error) { + start := time.Now() + + result, err := s.GroupStore.GetGroupsAssociatedToChannelsByTeam(teamID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("GroupStore.GetGroupsAssociatedToChannelsByTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetGroupsByChannel(channelID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) { + start := time.Now() + + result, err := s.GroupStore.GetGroupsByChannel(channelID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("GroupStore.GetGroupsByChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetGroupsByTeam(teamID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) { + start := time.Now() + + result, err := s.GroupStore.GetGroupsByTeam(teamID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("GroupStore.GetGroupsByTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetMember(groupID string, userID string) (*model.GroupMember, error) { + start := time.Now() + + result, err := s.GroupStore.GetMember(groupID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("GroupStore.GetMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetMemberCount(groupID string) (int64, error) { + start := time.Now() + + result, err := s.GroupStore.GetMemberCount(groupID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + s.Root.debugBar.SendStoreCall("GroupStore.GetMemberCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetMemberCountWithRestrictions(groupID string, viewRestrictions *model.ViewUsersRestrictions) (int64, error) { + start := time.Now() + + result, err := s.GroupStore.GetMemberCountWithRestrictions(groupID, viewRestrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + s.Root.debugBar.SendStoreCall("GroupStore.GetMemberCountWithRestrictions", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, error) { + start := time.Now() + + result, err := s.GroupStore.GetMemberUsers(groupID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + s.Root.debugBar.SendStoreCall("GroupStore.GetMemberUsers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, error) { + start := time.Now() + + result, err := s.GroupStore.GetMemberUsersInTeam(groupID, teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("GroupStore.GetMemberUsersInTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, error) { + start := time.Now() + + result, err := s.GroupStore.GetMemberUsersNotInChannel(groupID, channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("GroupStore.GetMemberUsersNotInChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetMemberUsersPage(groupID string, page int, perPage int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { + start := time.Now() + + result, err := s.GroupStore.GetMemberUsersPage(groupID, page, perPage, viewRestrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + s.Root.debugBar.SendStoreCall("GroupStore.GetMemberUsersPage", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetMemberUsersSortedPage(groupID string, page int, perPage int, viewRestrictions *model.ViewUsersRestrictions, teammateNameDisplay string) ([]*model.User, error) { + start := time.Now() + + result, err := s.GroupStore.GetMemberUsersSortedPage(groupID, page, perPage, viewRestrictions, teammateNameDisplay) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + debugBarLayerParams["teammateNameDisplay"] = teammateNameDisplay + + s.Root.debugBar.SendStoreCall("GroupStore.GetMemberUsersSortedPage", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GetNonMemberUsersPage(groupID string, page int, perPage int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { + start := time.Now() + + result, err := s.GroupStore.GetNonMemberUsersPage(groupID, page, perPage, viewRestrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + s.Root.debugBar.SendStoreCall("GroupStore.GetNonMemberUsersPage", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GroupChannelCount() (int64, error) { + start := time.Now() + + result, err := s.GroupStore.GroupChannelCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("GroupStore.GroupChannelCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GroupCount() (int64, error) { + start := time.Now() + + result, err := s.GroupStore.GroupCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("GroupStore.GroupCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GroupCountBySource(source model.GroupSource) (int64, error) { + start := time.Now() + + result, err := s.GroupStore.GroupCountBySource(source) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["source"] = source + + s.Root.debugBar.SendStoreCall("GroupStore.GroupCountBySource", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GroupCountWithAllowReference() (int64, error) { + start := time.Now() + + result, err := s.GroupStore.GroupCountWithAllowReference() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("GroupStore.GroupCountWithAllowReference", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GroupMemberCount() (int64, error) { + start := time.Now() + + result, err := s.GroupStore.GroupMemberCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("GroupStore.GroupMemberCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) GroupTeamCount() (int64, error) { + start := time.Now() + + result, err := s.GroupStore.GroupTeamCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("GroupStore.GroupTeamCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) PermanentDeleteMembersByUser(userID string) error { + start := time.Now() + + err := s.GroupStore.PermanentDeleteMembersByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("GroupStore.PermanentDeleteMembersByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, error) { + start := time.Now() + + result, err := s.GroupStore.PermittedSyncableAdmins(syncableID, syncableType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["syncableID"] = syncableID + + debugBarLayerParams["syncableType"] = syncableType + + s.Root.debugBar.SendStoreCall("GroupStore.PermittedSyncableAdmins", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) Restore(groupID string) (*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.Restore(groupID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + s.Root.debugBar.SendStoreCall("GroupStore.Restore", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) { + start := time.Now() + + result, err := s.GroupStore.TeamMembersMinusGroupMembers(teamID, groupIDs, page, perPage) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["groupIDs"] = groupIDs + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + s.Root.debugBar.SendStoreCall("GroupStore.TeamMembersMinusGroupMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) TeamMembersToAdd(since int64, teamID *string, includeRemovedMembers bool) ([]*model.UserTeamIDPair, error) { + start := time.Now() + + result, err := s.GroupStore.TeamMembersToAdd(since, teamID, includeRemovedMembers) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["since"] = since + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["includeRemovedMembers"] = includeRemovedMembers + + s.Root.debugBar.SendStoreCall("GroupStore.TeamMembersToAdd", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, error) { + start := time.Now() + + result, err := s.GroupStore.TeamMembersToRemove(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("GroupStore.TeamMembersToRemove", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) Update(group *model.Group) (*model.Group, error) { + start := time.Now() + + result, err := s.GroupStore.Update(group) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["group"] = group + + s.Root.debugBar.SendStoreCall("GroupStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) { + start := time.Now() + + result, err := s.GroupStore.UpdateGroupSyncable(groupSyncable) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupSyncable"] = groupSyncable + + s.Root.debugBar.SendStoreCall("GroupStore.UpdateGroupSyncable", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, error) { + start := time.Now() + + result, err := s.GroupStore.UpsertMember(groupID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("GroupStore.UpsertMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerGroupStore) UpsertMembers(groupID string, userIDs []string) ([]*model.GroupMember, error) { + start := time.Now() + + result, err := s.GroupStore.UpsertMembers(groupID, userIDs) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["userIDs"] = userIDs + + s.Root.debugBar.SendStoreCall("GroupStore.UpsertMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) Cleanup(expiryTime int64, batchSize int) error { + start := time.Now() + + err := s.JobStore.Cleanup(expiryTime, batchSize) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["expiryTime"] = expiryTime + + debugBarLayerParams["batchSize"] = batchSize + + s.Root.debugBar.SendStoreCall("JobStore.Cleanup", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerJobStore) Delete(id string) (string, error) { + start := time.Now() + + result, err := s.JobStore.Delete(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("JobStore.Delete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) Get(id string) (*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.Get(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("JobStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) GetAllByStatus(status string) ([]*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.GetAllByStatus(status) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["status"] = status + + s.Root.debugBar.SendStoreCall("JobStore.GetAllByStatus", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) GetAllByType(jobType string) ([]*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.GetAllByType(jobType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["jobType"] = jobType + + s.Root.debugBar.SendStoreCall("JobStore.GetAllByType", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) GetAllByTypeAndStatus(jobType string, status string) ([]*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.GetAllByTypeAndStatus(jobType, status) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["jobType"] = jobType + + debugBarLayerParams["status"] = status + + s.Root.debugBar.SendStoreCall("JobStore.GetAllByTypeAndStatus", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) GetAllByTypePage(jobType string, offset int, limit int) ([]*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.GetAllByTypePage(jobType, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["jobType"] = jobType + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("JobStore.GetAllByTypePage", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) GetAllByTypesPage(jobTypes []string, offset int, limit int) ([]*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.GetAllByTypesPage(jobTypes, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["jobTypes"] = jobTypes + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("JobStore.GetAllByTypesPage", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) GetAllPage(offset int, limit int) ([]*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.GetAllPage(offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("JobStore.GetAllPage", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) GetCountByStatusAndType(status string, jobType string) (int64, error) { + start := time.Now() + + result, err := s.JobStore.GetCountByStatusAndType(status, jobType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["status"] = status + + debugBarLayerParams["jobType"] = jobType + + s.Root.debugBar.SendStoreCall("JobStore.GetCountByStatusAndType", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) GetNewestJobByStatusAndType(status string, jobType string) (*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.GetNewestJobByStatusAndType(status, jobType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["status"] = status + + debugBarLayerParams["jobType"] = jobType + + s.Root.debugBar.SendStoreCall("JobStore.GetNewestJobByStatusAndType", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) GetNewestJobByStatusesAndType(statuses []string, jobType string) (*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.GetNewestJobByStatusesAndType(statuses, jobType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["statuses"] = statuses + + debugBarLayerParams["jobType"] = jobType + + s.Root.debugBar.SendStoreCall("JobStore.GetNewestJobByStatusesAndType", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) Save(job *model.Job) (*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.Save(job) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["job"] = job + + s.Root.debugBar.SendStoreCall("JobStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) UpdateOptimistically(job *model.Job, currentStatus string) (bool, error) { + start := time.Now() + + result, err := s.JobStore.UpdateOptimistically(job, currentStatus) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["job"] = job + + debugBarLayerParams["currentStatus"] = currentStatus + + s.Root.debugBar.SendStoreCall("JobStore.UpdateOptimistically", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) UpdateStatus(id string, status string) (*model.Job, error) { + start := time.Now() + + result, err := s.JobStore.UpdateStatus(id, status) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["status"] = status + + s.Root.debugBar.SendStoreCall("JobStore.UpdateStatus", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerJobStore) UpdateStatusOptimistically(id string, currentStatus string, newStatus string) (bool, error) { + start := time.Now() + + result, err := s.JobStore.UpdateStatusOptimistically(id, currentStatus, newStatus) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["currentStatus"] = currentStatus + + debugBarLayerParams["newStatus"] = newStatus + + s.Root.debugBar.SendStoreCall("JobStore.UpdateStatusOptimistically", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerLicenseStore) Get(id string) (*model.LicenseRecord, error) { + start := time.Now() + + result, err := s.LicenseStore.Get(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("LicenseStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerLicenseStore) GetAll() ([]*model.LicenseRecord, error) { + start := time.Now() + + result, err := s.LicenseStore.GetAll() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("LicenseStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerLicenseStore) Save(license *model.LicenseRecord) (*model.LicenseRecord, error) { + start := time.Now() + + result, err := s.LicenseStore.Save(license) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["license"] = license + + s.Root.debugBar.SendStoreCall("LicenseStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerLinkMetadataStore) Get(url string, timestamp int64) (*model.LinkMetadata, error) { + start := time.Now() + + result, err := s.LinkMetadataStore.Get(url, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["url"] = url + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("LinkMetadataStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerLinkMetadataStore) Save(linkMetadata *model.LinkMetadata) (*model.LinkMetadata, error) { + start := time.Now() + + result, err := s.LinkMetadataStore.Save(linkMetadata) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["linkMetadata"] = linkMetadata + + s.Root.debugBar.SendStoreCall("LinkMetadataStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerNotifyAdminStore) DeleteBefore(trial bool, now int64) error { + start := time.Now() + + err := s.NotifyAdminStore.DeleteBefore(trial, now) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["trial"] = trial + + debugBarLayerParams["now"] = now + + s.Root.debugBar.SendStoreCall("NotifyAdminStore.DeleteBefore", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerNotifyAdminStore) Get(trial bool) ([]*model.NotifyAdminData, error) { + start := time.Now() + + result, err := s.NotifyAdminStore.Get(trial) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["trial"] = trial + + s.Root.debugBar.SendStoreCall("NotifyAdminStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerNotifyAdminStore) GetDataByUserIdAndFeature(userId string, feature model.MattermostFeature) ([]*model.NotifyAdminData, error) { + start := time.Now() + + result, err := s.NotifyAdminStore.GetDataByUserIdAndFeature(userId, feature) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["feature"] = feature + + s.Root.debugBar.SendStoreCall("NotifyAdminStore.GetDataByUserIdAndFeature", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerNotifyAdminStore) Save(data *model.NotifyAdminData) (*model.NotifyAdminData, error) { + start := time.Now() + + result, err := s.NotifyAdminStore.Save(data) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["data"] = data + + s.Root.debugBar.SendStoreCall("NotifyAdminStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerNotifyAdminStore) Update(userId string, requiredPlan string, requiredFeature model.MattermostFeature, now int64) error { + start := time.Now() + + err := s.NotifyAdminStore.Update(userId, requiredPlan, requiredFeature, now) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["requiredPlan"] = requiredPlan + + debugBarLayerParams["requiredFeature"] = requiredFeature + + debugBarLayerParams["now"] = now + + s.Root.debugBar.SendStoreCall("NotifyAdminStore.Update", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerOAuthStore) DeleteApp(id string) error { + start := time.Now() + + err := s.OAuthStore.DeleteApp(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("OAuthStore.DeleteApp", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerOAuthStore) GetAccessData(token string) (*model.AccessData, error) { + start := time.Now() + + result, err := s.OAuthStore.GetAccessData(token) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["token"] = token + + s.Root.debugBar.SendStoreCall("OAuthStore.GetAccessData", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) GetAccessDataByRefreshToken(token string) (*model.AccessData, error) { + start := time.Now() + + result, err := s.OAuthStore.GetAccessDataByRefreshToken(token) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["token"] = token + + s.Root.debugBar.SendStoreCall("OAuthStore.GetAccessDataByRefreshToken", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientId string) ([]*model.AccessData, error) { + start := time.Now() + + result, err := s.OAuthStore.GetAccessDataByUserForApp(userID, clientId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["clientId"] = clientId + + s.Root.debugBar.SendStoreCall("OAuthStore.GetAccessDataByUserForApp", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) GetApp(id string) (*model.OAuthApp, error) { + start := time.Now() + + result, err := s.OAuthStore.GetApp(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("OAuthStore.GetApp", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) GetAppByUser(userID string, offset int, limit int) ([]*model.OAuthApp, error) { + start := time.Now() + + result, err := s.OAuthStore.GetAppByUser(userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("OAuthStore.GetAppByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) GetApps(offset int, limit int) ([]*model.OAuthApp, error) { + start := time.Now() + + result, err := s.OAuthStore.GetApps(offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("OAuthStore.GetApps", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) GetAuthData(code string) (*model.AuthData, error) { + start := time.Now() + + result, err := s.OAuthStore.GetAuthData(code) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["code"] = code + + s.Root.debugBar.SendStoreCall("OAuthStore.GetAuthData", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) GetAuthorizedApps(userID string, offset int, limit int) ([]*model.OAuthApp, error) { + start := time.Now() + + result, err := s.OAuthStore.GetAuthorizedApps(userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("OAuthStore.GetAuthorizedApps", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) GetPreviousAccessData(userID string, clientId string) (*model.AccessData, error) { + start := time.Now() + + result, err := s.OAuthStore.GetPreviousAccessData(userID, clientId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["clientId"] = clientId + + s.Root.debugBar.SendStoreCall("OAuthStore.GetPreviousAccessData", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) PermanentDeleteAuthDataByUser(userID string) error { + start := time.Now() + + err := s.OAuthStore.PermanentDeleteAuthDataByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("OAuthStore.PermanentDeleteAuthDataByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerOAuthStore) RemoveAccessData(token string) error { + start := time.Now() + + err := s.OAuthStore.RemoveAccessData(token) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["token"] = token + + s.Root.debugBar.SendStoreCall("OAuthStore.RemoveAccessData", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerOAuthStore) RemoveAllAccessData() error { + start := time.Now() + + err := s.OAuthStore.RemoveAllAccessData() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("OAuthStore.RemoveAllAccessData", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerOAuthStore) RemoveAuthData(code string) error { + start := time.Now() + + err := s.OAuthStore.RemoveAuthData(code) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["code"] = code + + s.Root.debugBar.SendStoreCall("OAuthStore.RemoveAuthData", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerOAuthStore) SaveAccessData(accessData *model.AccessData) (*model.AccessData, error) { + start := time.Now() + + result, err := s.OAuthStore.SaveAccessData(accessData) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["accessData"] = accessData + + s.Root.debugBar.SendStoreCall("OAuthStore.SaveAccessData", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) SaveApp(app *model.OAuthApp) (*model.OAuthApp, error) { + start := time.Now() + + result, err := s.OAuthStore.SaveApp(app) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["app"] = app + + s.Root.debugBar.SendStoreCall("OAuthStore.SaveApp", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) SaveAuthData(authData *model.AuthData) (*model.AuthData, error) { + start := time.Now() + + result, err := s.OAuthStore.SaveAuthData(authData) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["authData"] = authData + + s.Root.debugBar.SendStoreCall("OAuthStore.SaveAuthData", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) UpdateAccessData(accessData *model.AccessData) (*model.AccessData, error) { + start := time.Now() + + result, err := s.OAuthStore.UpdateAccessData(accessData) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["accessData"] = accessData + + s.Root.debugBar.SendStoreCall("OAuthStore.UpdateAccessData", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerOAuthStore) UpdateApp(app *model.OAuthApp) (*model.OAuthApp, error) { + start := time.Now() + + result, err := s.OAuthStore.UpdateApp(app) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["app"] = app + + s.Root.debugBar.SendStoreCall("OAuthStore.UpdateApp", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPluginStore) CompareAndDelete(keyVal *model.PluginKeyValue, oldValue []byte) (bool, error) { + start := time.Now() + + result, err := s.PluginStore.CompareAndDelete(keyVal, oldValue) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["keyVal"] = keyVal + + debugBarLayerParams["oldValue"] = oldValue + + s.Root.debugBar.SendStoreCall("PluginStore.CompareAndDelete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPluginStore) CompareAndSet(keyVal *model.PluginKeyValue, oldValue []byte) (bool, error) { + start := time.Now() + + result, err := s.PluginStore.CompareAndSet(keyVal, oldValue) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["keyVal"] = keyVal + + debugBarLayerParams["oldValue"] = oldValue + + s.Root.debugBar.SendStoreCall("PluginStore.CompareAndSet", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPluginStore) Delete(pluginID string, key string) error { + start := time.Now() + + err := s.PluginStore.Delete(pluginID, key) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["pluginID"] = pluginID + + debugBarLayerParams["key"] = key + + s.Root.debugBar.SendStoreCall("PluginStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPluginStore) DeleteAllExpired() error { + start := time.Now() + + err := s.PluginStore.DeleteAllExpired() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("PluginStore.DeleteAllExpired", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPluginStore) DeleteAllForPlugin(PluginID string) error { + start := time.Now() + + err := s.PluginStore.DeleteAllForPlugin(PluginID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["PluginID"] = PluginID + + s.Root.debugBar.SendStoreCall("PluginStore.DeleteAllForPlugin", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPluginStore) Get(pluginID string, key string) (*model.PluginKeyValue, error) { + start := time.Now() + + result, err := s.PluginStore.Get(pluginID, key) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["pluginID"] = pluginID + + debugBarLayerParams["key"] = key + + s.Root.debugBar.SendStoreCall("PluginStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPluginStore) List(pluginID string, page int, perPage int) ([]string, error) { + start := time.Now() + + result, err := s.PluginStore.List(pluginID, page, perPage) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["pluginID"] = pluginID + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + s.Root.debugBar.SendStoreCall("PluginStore.List", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPluginStore) SaveOrUpdate(keyVal *model.PluginKeyValue) (*model.PluginKeyValue, error) { + start := time.Now() + + result, err := s.PluginStore.SaveOrUpdate(keyVal) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["keyVal"] = keyVal + + s.Root.debugBar.SendStoreCall("PluginStore.SaveOrUpdate", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPluginStore) SetWithOptions(pluginID string, key string, value []byte, options model.PluginKVSetOptions) (bool, error) { + start := time.Now() + + result, err := s.PluginStore.SetWithOptions(pluginID, key, value, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["pluginID"] = pluginID + + debugBarLayerParams["key"] = key + + debugBarLayerParams["value"] = value + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("PluginStore.SetWithOptions", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) AnalyticsPostCount(options *model.PostCountOptions) (int64, error) { + start := time.Now() + + result, err := s.PostStore.AnalyticsPostCount(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("PostStore.AnalyticsPostCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) { + start := time.Now() + + result, err := s.PostStore.AnalyticsPostCountsByDay(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("PostStore.AnalyticsPostCountsByDay", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamID string) (model.AnalyticsRows, error) { + start := time.Now() + + result, err := s.PostStore.AnalyticsUserCountsWithPostsByDay(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("PostStore.AnalyticsUserCountsWithPostsByDay", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) ClearCaches() { + start := time.Now() + + s.PostStore.ClearCaches() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("PostStore.ClearCaches", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerPostStore) Delete(postID string, timestamp int64, deleteByID string) error { + start := time.Now() + + err := s.PostStore.Delete(postID, timestamp, deleteByID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + debugBarLayerParams["timestamp"] = timestamp + + debugBarLayerParams["deleteByID"] = deleteByID + + s.Root.debugBar.SendStoreCall("PostStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPostStore) DeleteOrphanedRows(limit int) (int64, error) { + start := time.Now() + + result, err := s.PostStore.DeleteOrphanedRows(limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PostStore.DeleteOrphanedRows", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) Get(ctx context.Context, id string, opts model.GetPostsOptions, userID string, sanitizeOptions map[string]bool) (*model.PostList, error) { + start := time.Now() + + result, err := s.PostStore.Get(ctx, id, opts, userID, sanitizeOptions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["id"] = id + + debugBarLayerParams["opts"] = opts + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["sanitizeOptions"] = sanitizeOptions + + s.Root.debugBar.SendStoreCall("PostStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterID string) ([]*model.DirectPostForExport, error) { + start := time.Now() + + result, err := s.PostStore.GetDirectPostParentsForExportAfter(limit, afterID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["afterID"] = afterID + + s.Root.debugBar.SendStoreCall("PostStore.GetDirectPostParentsForExportAfter", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetEditHistoryForPost(postId string) ([]*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.GetEditHistoryForPost(postId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postId"] = postId + + s.Root.debugBar.SendStoreCall("PostStore.GetEditHistoryForPost", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetEtag(channelID string, allowFromCache bool, collapsedThreads bool) string { + start := time.Now() + + result := s.PostStore.GetEtag(channelID, allowFromCache, collapsedThreads) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["allowFromCache"] = allowFromCache + + debugBarLayerParams["collapsedThreads"] = collapsedThreads + + s.Root.debugBar.SendStoreCall("PostStore.GetEtag", success, elapsed, debugBarLayerParams) + + return result +} + +func (s *DebugBarLayerPostStore) GetFlaggedPosts(userID string, offset int, limit int) (*model.PostList, error) { + start := time.Now() + + result, err := s.PostStore.GetFlaggedPosts(userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PostStore.GetFlaggedPosts", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetFlaggedPostsForChannel(userID string, channelID string, offset int, limit int) (*model.PostList, error) { + start := time.Now() + + result, err := s.PostStore.GetFlaggedPostsForChannel(userID, channelID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PostStore.GetFlaggedPostsForChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetFlaggedPostsForTeam(userID string, teamID string, offset int, limit int) (*model.PostList, error) { + start := time.Now() + + result, err := s.PostStore.GetFlaggedPostsForTeam(userID, teamID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PostStore.GetFlaggedPostsForTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetLastPostRowCreateAt() (int64, error) { + start := time.Now() + + result, err := s.PostStore.GetLastPostRowCreateAt() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("PostStore.GetLastPostRowCreateAt", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetMaxPostSize() int { + start := time.Now() + + result := s.PostStore.GetMaxPostSize() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("PostStore.GetMaxPostSize", success, elapsed, debugBarLayerParams) + + return result +} + +func (s *DebugBarLayerPostStore) GetNthRecentPostTime(n int64) (int64, error) { + start := time.Now() + + result, err := s.PostStore.GetNthRecentPostTime(n) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["n"] = n + + s.Root.debugBar.SendStoreCall("PostStore.GetNthRecentPostTime", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetOldest() (*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.GetOldest() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("PostStore.GetOldest", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetOldestEntityCreationTime() (int64, error) { + start := time.Now() + + result, err := s.PostStore.GetOldestEntityCreationTime() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("PostStore.GetOldestEntityCreationTime", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetParentsForExportAfter(limit int, afterID string) ([]*model.PostForExport, error) { + start := time.Now() + + result, err := s.PostStore.GetParentsForExportAfter(limit, afterID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["afterID"] = afterID + + s.Root.debugBar.SendStoreCall("PostStore.GetParentsForExportAfter", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostAfterTime(channelID string, timestamp int64, collapsedThreads bool) (*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.GetPostAfterTime(channelID, timestamp, collapsedThreads) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["timestamp"] = timestamp + + debugBarLayerParams["collapsedThreads"] = collapsedThreads + + s.Root.debugBar.SendStoreCall("PostStore.GetPostAfterTime", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostIdAfterTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { + start := time.Now() + + result, err := s.PostStore.GetPostIdAfterTime(channelID, timestamp, collapsedThreads) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["timestamp"] = timestamp + + debugBarLayerParams["collapsedThreads"] = collapsedThreads + + s.Root.debugBar.SendStoreCall("PostStore.GetPostIdAfterTime", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostIdBeforeTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { + start := time.Now() + + result, err := s.PostStore.GetPostIdBeforeTime(channelID, timestamp, collapsedThreads) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["timestamp"] = timestamp + + debugBarLayerParams["collapsedThreads"] = collapsedThreads + + s.Root.debugBar.SendStoreCall("PostStore.GetPostIdBeforeTime", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostReminderMetadata(postID string) (*store.PostReminderMetadata, error) { + start := time.Now() + + result, err := s.PostStore.GetPostReminderMetadata(postID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + s.Root.debugBar.SendStoreCall("PostStore.GetPostReminderMetadata", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostReminders(now int64) ([]*model.PostReminder, error) { + start := time.Now() + + result, err := s.PostStore.GetPostReminders(now) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["now"] = now + + s.Root.debugBar.SendStoreCall("PostStore.GetPostReminders", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool, sanitizeOptions map[string]bool) (*model.PostList, error) { + start := time.Now() + + result, err := s.PostStore.GetPosts(options, allowFromCache, sanitizeOptions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + debugBarLayerParams["allowFromCache"] = allowFromCache + + debugBarLayerParams["sanitizeOptions"] = sanitizeOptions + + s.Root.debugBar.SendStoreCall("PostStore.GetPosts", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostsAfter(options model.GetPostsOptions, sanitizeOptions map[string]bool) (*model.PostList, error) { + start := time.Now() + + result, err := s.PostStore.GetPostsAfter(options, sanitizeOptions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + debugBarLayerParams["sanitizeOptions"] = sanitizeOptions + + s.Root.debugBar.SendStoreCall("PostStore.GetPostsAfter", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostsBatchForIndexing(startTime int64, startPostID string, limit int) ([]*model.PostForIndexing, error) { + start := time.Now() + + result, err := s.PostStore.GetPostsBatchForIndexing(startTime, startPostID, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["startTime"] = startTime + + debugBarLayerParams["startPostID"] = startPostID + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PostStore.GetPostsBatchForIndexing", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostsBefore(options model.GetPostsOptions, sanitizeOptions map[string]bool) (*model.PostList, error) { + start := time.Now() + + result, err := s.PostStore.GetPostsBefore(options, sanitizeOptions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + debugBarLayerParams["sanitizeOptions"] = sanitizeOptions + + s.Root.debugBar.SendStoreCall("PostStore.GetPostsBefore", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.GetPostsByIds(postIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postIds"] = postIds + + s.Root.debugBar.SendStoreCall("PostStore.GetPostsByIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostsByThread(threadID string, since int64) ([]*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.GetPostsByThread(threadID, since) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["threadID"] = threadID + + debugBarLayerParams["since"] = since + + s.Root.debugBar.SendStoreCall("PostStore.GetPostsByThread", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostsCreatedAt(channelID string, timestamp int64) ([]*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.GetPostsCreatedAt(channelID, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("PostStore.GetPostsCreatedAt", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostsSince(options model.GetPostsSinceOptions, allowFromCache bool, sanitizeOptions map[string]bool) (*model.PostList, error) { + start := time.Now() + + result, err := s.PostStore.GetPostsSince(options, allowFromCache, sanitizeOptions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + debugBarLayerParams["allowFromCache"] = allowFromCache + + debugBarLayerParams["sanitizeOptions"] = sanitizeOptions + + s.Root.debugBar.SendStoreCall("PostStore.GetPostsSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetPostsSinceForSync(options model.GetPostsSinceForSyncOptions, cursor model.GetPostsSinceForSyncCursor, limit int) ([]*model.Post, model.GetPostsSinceForSyncCursor, error) { + start := time.Now() + + result, resultVar1, err := s.PostStore.GetPostsSinceForSync(options, cursor, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + debugBarLayerParams["cursor"] = cursor + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PostStore.GetPostsSinceForSync", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerPostStore) GetRecentSearchesForUser(userID string) ([]*model.SearchParams, error) { + start := time.Now() + + result, err := s.PostStore.GetRecentSearchesForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("PostStore.GetRecentSearchesForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetRepliesForExport(parentID string) ([]*model.ReplyForExport, error) { + start := time.Now() + + result, err := s.PostStore.GetRepliesForExport(parentID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["parentID"] = parentID + + s.Root.debugBar.SendStoreCall("PostStore.GetRepliesForExport", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetSingle(id string, inclDeleted bool) (*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.GetSingle(id, inclDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["inclDeleted"] = inclDeleted + + s.Root.debugBar.SendStoreCall("PostStore.GetSingle", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) GetTopDMsForUserSince(userID string, since int64, offset int, limit int) (*model.TopDMList, error) { + start := time.Now() + + result, err := s.PostStore.GetTopDMsForUserSince(userID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PostStore.GetTopDMsForUserSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) { + start := time.Now() + + result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + debugBarLayerParams["userId"] = userId + + s.Root.debugBar.SendStoreCall("PostStore.HasAutoResponsePostByUserSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) InvalidateLastPostTimeCache(channelID string) { + start := time.Now() + + s.PostStore.InvalidateLastPostTimeCache(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("PostStore.InvalidateLastPostTimeCache", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerPostStore) LogRecentSearch(userID string, searchQuery []byte, createAt int64) error { + start := time.Now() + + err := s.PostStore.LogRecentSearch(userID, searchQuery, createAt) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["searchQuery"] = searchQuery + + debugBarLayerParams["createAt"] = createAt + + s.Root.debugBar.SendStoreCall("PostStore.LogRecentSearch", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPostStore) Overwrite(post *model.Post) (*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.Overwrite(post) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["post"] = post + + s.Root.debugBar.SendStoreCall("PostStore.Overwrite", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) { + start := time.Now() + + result, resultVar1, err := s.PostStore.OverwriteMultiple(posts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["posts"] = posts + + s.Root.debugBar.SendStoreCall("PostStore.OverwriteMultiple", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { + start := time.Now() + + result, err := s.PostStore.PermanentDeleteBatch(endTime, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["endTime"] = endTime + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PostStore.PermanentDeleteBatch", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) PermanentDeleteBatchForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { + start := time.Now() + + result, resultVar1, err := s.PostStore.PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["now"] = now + + debugBarLayerParams["globalPolicyEndTime"] = globalPolicyEndTime + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["cursor"] = cursor + + s.Root.debugBar.SendStoreCall("PostStore.PermanentDeleteBatchForRetentionPolicies", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerPostStore) PermanentDeleteByChannel(channelID string) error { + start := time.Now() + + err := s.PostStore.PermanentDeleteByChannel(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("PostStore.PermanentDeleteByChannel", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPostStore) PermanentDeleteByUser(userID string) error { + start := time.Now() + + err := s.PostStore.PermanentDeleteByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("PostStore.PermanentDeleteByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPostStore) Save(post *model.Post) (*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.Save(post) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["post"] = post + + s.Root.debugBar.SendStoreCall("PostStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post, int, error) { + start := time.Now() + + result, resultVar1, err := s.PostStore.SaveMultiple(posts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["posts"] = posts + + s.Root.debugBar.SendStoreCall("PostStore.SaveMultiple", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerPostStore) Search(teamID string, userID string, params *model.SearchParams) (*model.PostList, error) { + start := time.Now() + + result, err := s.PostStore.Search(teamID, userID, params) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["params"] = params + + s.Root.debugBar.SendStoreCall("PostStore.Search", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) SearchPostsForUser(paramsList []*model.SearchParams, userID string, teamID string, page int, perPage int) (*model.PostSearchResults, error) { + start := time.Now() + + result, err := s.PostStore.SearchPostsForUser(paramsList, userID, teamID, page, perPage) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["paramsList"] = paramsList + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + s.Root.debugBar.SendStoreCall("PostStore.SearchPostsForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostStore) SetPostReminder(reminder *model.PostReminder) error { + start := time.Now() + + err := s.PostStore.SetPostReminder(reminder) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["reminder"] = reminder + + s.Root.debugBar.SendStoreCall("PostStore.SetPostReminder", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPostStore) Update(newPost *model.Post, oldPost *model.Post) (*model.Post, error) { + start := time.Now() + + result, err := s.PostStore.Update(newPost, oldPost) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["newPost"] = newPost + + debugBarLayerParams["oldPost"] = oldPost + + s.Root.debugBar.SendStoreCall("PostStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostAcknowledgementStore) Delete(acknowledgement *model.PostAcknowledgement) error { + start := time.Now() + + err := s.PostAcknowledgementStore.Delete(acknowledgement) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["acknowledgement"] = acknowledgement + + s.Root.debugBar.SendStoreCall("PostAcknowledgementStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPostAcknowledgementStore) Get(postID string, userID string) (*model.PostAcknowledgement, error) { + start := time.Now() + + result, err := s.PostAcknowledgementStore.Get(postID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("PostAcknowledgementStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostAcknowledgementStore) GetForPost(postID string) ([]*model.PostAcknowledgement, error) { + start := time.Now() + + result, err := s.PostAcknowledgementStore.GetForPost(postID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + s.Root.debugBar.SendStoreCall("PostAcknowledgementStore.GetForPost", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostAcknowledgementStore) GetForPosts(postIds []string) ([]*model.PostAcknowledgement, error) { + start := time.Now() + + result, err := s.PostAcknowledgementStore.GetForPosts(postIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postIds"] = postIds + + s.Root.debugBar.SendStoreCall("PostAcknowledgementStore.GetForPosts", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostAcknowledgementStore) Save(postID string, userID string, acknowledgedAt int64) (*model.PostAcknowledgement, error) { + start := time.Now() + + result, err := s.PostAcknowledgementStore.Save(postID, userID, acknowledgedAt) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["acknowledgedAt"] = acknowledgedAt + + s.Root.debugBar.SendStoreCall("PostAcknowledgementStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostPriorityStore) GetForPost(postId string) (*model.PostPriority, error) { + start := time.Now() + + result, err := s.PostPriorityStore.GetForPost(postId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postId"] = postId + + s.Root.debugBar.SendStoreCall("PostPriorityStore.GetForPost", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPostPriorityStore) GetForPosts(ids []string) ([]*model.PostPriority, error) { + start := time.Now() + + result, err := s.PostPriorityStore.GetForPosts(ids) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ids"] = ids + + s.Root.debugBar.SendStoreCall("PostPriorityStore.GetForPosts", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPreferenceStore) CleanupFlagsBatch(limit int64) (int64, error) { + start := time.Now() + + result, err := s.PreferenceStore.CleanupFlagsBatch(limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PreferenceStore.CleanupFlagsBatch", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPreferenceStore) Delete(userID string, category string, name string) error { + start := time.Now() + + err := s.PreferenceStore.Delete(userID, category, name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["category"] = category + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("PreferenceStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPreferenceStore) DeleteCategory(userID string, category string) error { + start := time.Now() + + err := s.PreferenceStore.DeleteCategory(userID, category) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["category"] = category + + s.Root.debugBar.SendStoreCall("PreferenceStore.DeleteCategory", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPreferenceStore) DeleteCategoryAndName(category string, name string) error { + start := time.Now() + + err := s.PreferenceStore.DeleteCategoryAndName(category, name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["category"] = category + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("PreferenceStore.DeleteCategoryAndName", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPreferenceStore) DeleteOrphanedRows(limit int) (int64, error) { + start := time.Now() + + result, err := s.PreferenceStore.DeleteOrphanedRows(limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("PreferenceStore.DeleteOrphanedRows", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPreferenceStore) Get(userID string, category string, name string) (*model.Preference, error) { + start := time.Now() + + result, err := s.PreferenceStore.Get(userID, category, name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["category"] = category + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("PreferenceStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPreferenceStore) GetAll(userID string) (model.Preferences, error) { + start := time.Now() + + result, err := s.PreferenceStore.GetAll(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("PreferenceStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPreferenceStore) GetCategory(userID string, category string) (model.Preferences, error) { + start := time.Now() + + result, err := s.PreferenceStore.GetCategory(userID, category) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["category"] = category + + s.Root.debugBar.SendStoreCall("PreferenceStore.GetCategory", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPreferenceStore) GetCategoryAndName(category string, nane string) (model.Preferences, error) { + start := time.Now() + + result, err := s.PreferenceStore.GetCategoryAndName(category, nane) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["category"] = category + + debugBarLayerParams["nane"] = nane + + s.Root.debugBar.SendStoreCall("PreferenceStore.GetCategoryAndName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerPreferenceStore) PermanentDeleteByUser(userID string) error { + start := time.Now() + + err := s.PreferenceStore.PermanentDeleteByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("PreferenceStore.PermanentDeleteByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerPreferenceStore) Save(preferences model.Preferences) error { + start := time.Now() + + err := s.PreferenceStore.Save(preferences) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["preferences"] = preferences + + s.Root.debugBar.SendStoreCall("PreferenceStore.Save", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerProductNoticesStore) Clear(notices []string) error { + start := time.Now() + + err := s.ProductNoticesStore.Clear(notices) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["notices"] = notices + + s.Root.debugBar.SendStoreCall("ProductNoticesStore.Clear", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerProductNoticesStore) ClearOldNotices(currentNotices model.ProductNotices) error { + start := time.Now() + + err := s.ProductNoticesStore.ClearOldNotices(currentNotices) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["currentNotices"] = currentNotices + + s.Root.debugBar.SendStoreCall("ProductNoticesStore.ClearOldNotices", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerProductNoticesStore) GetViews(userID string) ([]model.ProductNoticeViewState, error) { + start := time.Now() + + result, err := s.ProductNoticesStore.GetViews(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("ProductNoticesStore.GetViews", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerProductNoticesStore) View(userID string, notices []string) error { + start := time.Now() + + err := s.ProductNoticesStore.View(userID, notices) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["notices"] = notices + + s.Root.debugBar.SendStoreCall("ProductNoticesStore.View", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerReactionStore) BulkGetForPosts(postIds []string) ([]*model.Reaction, error) { + start := time.Now() + + result, err := s.ReactionStore.BulkGetForPosts(postIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postIds"] = postIds + + s.Root.debugBar.SendStoreCall("ReactionStore.BulkGetForPosts", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerReactionStore) Delete(reaction *model.Reaction) (*model.Reaction, error) { + start := time.Now() + + result, err := s.ReactionStore.Delete(reaction) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["reaction"] = reaction + + s.Root.debugBar.SendStoreCall("ReactionStore.Delete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerReactionStore) DeleteAllWithEmojiName(emojiName string) error { + start := time.Now() + + err := s.ReactionStore.DeleteAllWithEmojiName(emojiName) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["emojiName"] = emojiName + + s.Root.debugBar.SendStoreCall("ReactionStore.DeleteAllWithEmojiName", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerReactionStore) DeleteOrphanedRows(limit int) (int64, error) { + start := time.Now() + + result, err := s.ReactionStore.DeleteOrphanedRows(limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ReactionStore.DeleteOrphanedRows", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerReactionStore) GetForPost(postID string, allowFromCache bool) ([]*model.Reaction, error) { + start := time.Now() + + result, err := s.ReactionStore.GetForPost(postID, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postID"] = postID + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("ReactionStore.GetForPost", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerReactionStore) GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error) { + start := time.Now() + + result, err := s.ReactionStore.GetForPostSince(postId, since, excludeRemoteId, inclDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["postId"] = postId + + debugBarLayerParams["since"] = since + + debugBarLayerParams["excludeRemoteId"] = excludeRemoteId + + debugBarLayerParams["inclDeleted"] = inclDeleted + + s.Root.debugBar.SendStoreCall("ReactionStore.GetForPostSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerReactionStore) GetTopForTeamSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopReactionList, error) { + start := time.Now() + + result, err := s.ReactionStore.GetTopForTeamSince(teamID, userID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ReactionStore.GetTopForTeamSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerReactionStore) GetTopForUserSince(userID string, teamID string, since int64, offset int, limit int) (*model.TopReactionList, error) { + start := time.Now() + + result, err := s.ReactionStore.GetTopForUserSince(userID, teamID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ReactionStore.GetTopForUserSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerReactionStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { + start := time.Now() + + result, err := s.ReactionStore.PermanentDeleteBatch(endTime, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["endTime"] = endTime + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ReactionStore.PermanentDeleteBatch", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerReactionStore) Save(reaction *model.Reaction) (*model.Reaction, error) { + start := time.Now() + + result, err := s.ReactionStore.Save(reaction) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["reaction"] = reaction + + s.Root.debugBar.SendStoreCall("ReactionStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRemoteClusterStore) Delete(remoteClusterId string) (bool, error) { + start := time.Now() + + result, err := s.RemoteClusterStore.Delete(remoteClusterId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remoteClusterId"] = remoteClusterId + + s.Root.debugBar.SendStoreCall("RemoteClusterStore.Delete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRemoteClusterStore) Get(remoteClusterId string) (*model.RemoteCluster, error) { + start := time.Now() + + result, err := s.RemoteClusterStore.Get(remoteClusterId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remoteClusterId"] = remoteClusterId + + s.Root.debugBar.SendStoreCall("RemoteClusterStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRemoteClusterStore) GetAll(filter model.RemoteClusterQueryFilter) ([]*model.RemoteCluster, error) { + start := time.Now() + + result, err := s.RemoteClusterStore.GetAll(filter) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["filter"] = filter + + s.Root.debugBar.SendStoreCall("RemoteClusterStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRemoteClusterStore) Save(rc *model.RemoteCluster) (*model.RemoteCluster, error) { + start := time.Now() + + result, err := s.RemoteClusterStore.Save(rc) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["rc"] = rc + + s.Root.debugBar.SendStoreCall("RemoteClusterStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRemoteClusterStore) SetLastPingAt(remoteClusterId string) error { + start := time.Now() + + err := s.RemoteClusterStore.SetLastPingAt(remoteClusterId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remoteClusterId"] = remoteClusterId + + s.Root.debugBar.SendStoreCall("RemoteClusterStore.SetLastPingAt", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerRemoteClusterStore) Update(rc *model.RemoteCluster) (*model.RemoteCluster, error) { + start := time.Now() + + result, err := s.RemoteClusterStore.Update(rc) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["rc"] = rc + + s.Root.debugBar.SendStoreCall("RemoteClusterStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error) { + start := time.Now() + + result, err := s.RemoteClusterStore.UpdateTopics(remoteClusterId, topics) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remoteClusterId"] = remoteClusterId + + debugBarLayerParams["topics"] = topics + + s.Root.debugBar.SendStoreCall("RemoteClusterStore.UpdateTopics", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) AddChannels(policyId string, channelIds []string) error { + start := time.Now() + + err := s.RetentionPolicyStore.AddChannels(policyId, channelIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["policyId"] = policyId + + debugBarLayerParams["channelIds"] = channelIds + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.AddChannels", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerRetentionPolicyStore) AddTeams(policyId string, teamIds []string) error { + start := time.Now() + + err := s.RetentionPolicyStore.AddTeams(policyId, teamIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["policyId"] = policyId + + debugBarLayerParams["teamIds"] = teamIds + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.AddTeams", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerRetentionPolicyStore) Delete(id string) error { + start := time.Now() + + err := s.RetentionPolicyStore.Delete(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerRetentionPolicyStore) DeleteOrphanedRows(limit int) (int64, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.DeleteOrphanedRows(limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.DeleteOrphanedRows", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) Get(id string) (*model.RetentionPolicyWithTeamAndChannelCounts, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.Get(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetAll(offset int, limit int) ([]*model.RetentionPolicyWithTeamAndChannelCounts, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetAll(offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetChannelPoliciesCountForUser(userID string) (int64, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetChannelPoliciesCountForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetChannelPoliciesCountForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetChannelPoliciesForUser(userID string, offset int, limit int) ([]*model.RetentionPolicyForChannel, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetChannelPoliciesForUser(userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetChannelPoliciesForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetChannels(policyId string, offset int, limit int) (model.ChannelListWithTeamData, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetChannels(policyId, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["policyId"] = policyId + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetChannels", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetChannelsCount(policyId string) (int64, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetChannelsCount(policyId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["policyId"] = policyId + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetChannelsCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetCount() (int64, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetTeamPoliciesCountForUser(userID string) (int64, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetTeamPoliciesCountForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetTeamPoliciesCountForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetTeamPoliciesForUser(userID string, offset int, limit int) ([]*model.RetentionPolicyForTeam, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetTeamPoliciesForUser(userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetTeamPoliciesForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetTeams(policyId string, offset int, limit int) ([]*model.Team, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetTeams(policyId, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["policyId"] = policyId + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetTeams", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) GetTeamsCount(policyId string) (int64, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.GetTeamsCount(policyId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["policyId"] = policyId + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.GetTeamsCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) Patch(patch *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.Patch(patch) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["patch"] = patch + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.Patch", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRetentionPolicyStore) RemoveChannels(policyId string, channelIds []string) error { + start := time.Now() + + err := s.RetentionPolicyStore.RemoveChannels(policyId, channelIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["policyId"] = policyId + + debugBarLayerParams["channelIds"] = channelIds + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.RemoveChannels", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerRetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) error { + start := time.Now() + + err := s.RetentionPolicyStore.RemoveTeams(policyId, teamIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["policyId"] = policyId + + debugBarLayerParams["teamIds"] = teamIds + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.RemoveTeams", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerRetentionPolicyStore) Save(policy *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, error) { + start := time.Now() + + result, err := s.RetentionPolicyStore.Save(policy) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["policy"] = policy + + s.Root.debugBar.SendStoreCall("RetentionPolicyStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRoleStore) AllChannelSchemeRoles() ([]*model.Role, error) { + start := time.Now() + + result, err := s.RoleStore.AllChannelSchemeRoles() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("RoleStore.AllChannelSchemeRoles", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRoleStore) ChannelHigherScopedPermissions(roleNames []string) (map[string]*model.RolePermissions, error) { + start := time.Now() + + result, err := s.RoleStore.ChannelHigherScopedPermissions(roleNames) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["roleNames"] = roleNames + + s.Root.debugBar.SendStoreCall("RoleStore.ChannelHigherScopedPermissions", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRoleStore) ChannelRolesUnderTeamRole(roleName string) ([]*model.Role, error) { + start := time.Now() + + result, err := s.RoleStore.ChannelRolesUnderTeamRole(roleName) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["roleName"] = roleName + + s.Root.debugBar.SendStoreCall("RoleStore.ChannelRolesUnderTeamRole", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRoleStore) Delete(roleID string) (*model.Role, error) { + start := time.Now() + + result, err := s.RoleStore.Delete(roleID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["roleID"] = roleID + + s.Root.debugBar.SendStoreCall("RoleStore.Delete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRoleStore) Get(roleID string) (*model.Role, error) { + start := time.Now() + + result, err := s.RoleStore.Get(roleID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["roleID"] = roleID + + s.Root.debugBar.SendStoreCall("RoleStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRoleStore) GetAll() ([]*model.Role, error) { + start := time.Now() + + result, err := s.RoleStore.GetAll() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("RoleStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRoleStore) GetByName(ctx context.Context, name string) (*model.Role, error) { + start := time.Now() + + result, err := s.RoleStore.GetByName(ctx, name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("RoleStore.GetByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRoleStore) GetByNames(names []string) ([]*model.Role, error) { + start := time.Now() + + result, err := s.RoleStore.GetByNames(names) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["names"] = names + + s.Root.debugBar.SendStoreCall("RoleStore.GetByNames", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerRoleStore) PermanentDeleteAll() error { + start := time.Now() + + err := s.RoleStore.PermanentDeleteAll() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("RoleStore.PermanentDeleteAll", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerRoleStore) Save(role *model.Role) (*model.Role, error) { + start := time.Now() + + result, err := s.RoleStore.Save(role) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["role"] = role + + s.Root.debugBar.SendStoreCall("RoleStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSchemeStore) CountByScope(scope string) (int64, error) { + start := time.Now() + + result, err := s.SchemeStore.CountByScope(scope) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["scope"] = scope + + s.Root.debugBar.SendStoreCall("SchemeStore.CountByScope", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSchemeStore) CountWithoutPermission(scope string, permissionID string, roleScope model.RoleScope, roleType model.RoleType) (int64, error) { + start := time.Now() + + result, err := s.SchemeStore.CountWithoutPermission(scope, permissionID, roleScope, roleType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["scope"] = scope + + debugBarLayerParams["permissionID"] = permissionID + + debugBarLayerParams["roleScope"] = roleScope + + debugBarLayerParams["roleType"] = roleType + + s.Root.debugBar.SendStoreCall("SchemeStore.CountWithoutPermission", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSchemeStore) Delete(schemeID string) (*model.Scheme, error) { + start := time.Now() + + result, err := s.SchemeStore.Delete(schemeID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["schemeID"] = schemeID + + s.Root.debugBar.SendStoreCall("SchemeStore.Delete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSchemeStore) Get(schemeID string) (*model.Scheme, error) { + start := time.Now() + + result, err := s.SchemeStore.Get(schemeID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["schemeID"] = schemeID + + s.Root.debugBar.SendStoreCall("SchemeStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSchemeStore) GetAllPage(scope string, offset int, limit int) ([]*model.Scheme, error) { + start := time.Now() + + result, err := s.SchemeStore.GetAllPage(scope, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["scope"] = scope + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("SchemeStore.GetAllPage", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSchemeStore) GetByName(schemeName string) (*model.Scheme, error) { + start := time.Now() + + result, err := s.SchemeStore.GetByName(schemeName) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["schemeName"] = schemeName + + s.Root.debugBar.SendStoreCall("SchemeStore.GetByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSchemeStore) PermanentDeleteAll() error { + start := time.Now() + + err := s.SchemeStore.PermanentDeleteAll() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("SchemeStore.PermanentDeleteAll", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, error) { + start := time.Now() + + result, err := s.SchemeStore.Save(scheme) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["scheme"] = scheme + + s.Root.debugBar.SendStoreCall("SchemeStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSessionStore) AnalyticsSessionCount() (int64, error) { + start := time.Now() + + result, err := s.SessionStore.AnalyticsSessionCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("SessionStore.AnalyticsSessionCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSessionStore) Cleanup(expiryTime int64, batchSize int64) error { + start := time.Now() + + err := s.SessionStore.Cleanup(expiryTime, batchSize) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["expiryTime"] = expiryTime + + debugBarLayerParams["batchSize"] = batchSize + + s.Root.debugBar.SendStoreCall("SessionStore.Cleanup", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSessionStore) Get(ctx context.Context, sessionIDOrToken string) (*model.Session, error) { + start := time.Now() + + result, err := s.SessionStore.Get(ctx, sessionIDOrToken) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["sessionIDOrToken"] = sessionIDOrToken + + s.Root.debugBar.SendStoreCall("SessionStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSessionStore) GetLastSessionRowCreateAt() (int64, error) { + start := time.Now() + + result, err := s.SessionStore.GetLastSessionRowCreateAt() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("SessionStore.GetLastSessionRowCreateAt", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSessionStore) GetSessions(userID string) ([]*model.Session, error) { + start := time.Now() + + result, err := s.SessionStore.GetSessions(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("SessionStore.GetSessions", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) { + start := time.Now() + + result, err := s.SessionStore.GetSessionsExpired(thresholdMillis, mobileOnly, unnotifiedOnly) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["thresholdMillis"] = thresholdMillis + + debugBarLayerParams["mobileOnly"] = mobileOnly + + debugBarLayerParams["unnotifiedOnly"] = unnotifiedOnly + + s.Root.debugBar.SendStoreCall("SessionStore.GetSessionsExpired", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSessionStore) GetSessionsWithActiveDeviceIds(userID string) ([]*model.Session, error) { + start := time.Now() + + result, err := s.SessionStore.GetSessionsWithActiveDeviceIds(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("SessionStore.GetSessionsWithActiveDeviceIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSessionStore) PermanentDeleteSessionsByUser(teamID string) error { + start := time.Now() + + err := s.SessionStore.PermanentDeleteSessionsByUser(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("SessionStore.PermanentDeleteSessionsByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSessionStore) Remove(sessionIDOrToken string) error { + start := time.Now() + + err := s.SessionStore.Remove(sessionIDOrToken) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["sessionIDOrToken"] = sessionIDOrToken + + s.Root.debugBar.SendStoreCall("SessionStore.Remove", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSessionStore) RemoveAllSessions() error { + start := time.Now() + + err := s.SessionStore.RemoveAllSessions() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("SessionStore.RemoveAllSessions", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSessionStore) Save(session *model.Session) (*model.Session, error) { + start := time.Now() + + result, err := s.SessionStore.Save(session) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["session"] = session + + s.Root.debugBar.SendStoreCall("SessionStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSessionStore) UpdateDeviceId(id string, deviceID string, expiresAt int64) (string, error) { + start := time.Now() + + result, err := s.SessionStore.UpdateDeviceId(id, deviceID, expiresAt) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["deviceID"] = deviceID + + debugBarLayerParams["expiresAt"] = expiresAt + + s.Root.debugBar.SendStoreCall("SessionStore.UpdateDeviceId", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSessionStore) UpdateExpiredNotify(sessionid string, notified bool) error { + start := time.Now() + + err := s.SessionStore.UpdateExpiredNotify(sessionid, notified) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["sessionid"] = sessionid + + debugBarLayerParams["notified"] = notified + + s.Root.debugBar.SendStoreCall("SessionStore.UpdateExpiredNotify", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSessionStore) UpdateExpiresAt(sessionID string, timestamp int64) error { + start := time.Now() + + err := s.SessionStore.UpdateExpiresAt(sessionID, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["sessionID"] = sessionID + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("SessionStore.UpdateExpiresAt", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSessionStore) UpdateLastActivityAt(sessionID string, timestamp int64) error { + start := time.Now() + + err := s.SessionStore.UpdateLastActivityAt(sessionID, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["sessionID"] = sessionID + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("SessionStore.UpdateLastActivityAt", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSessionStore) UpdateProps(session *model.Session) error { + start := time.Now() + + err := s.SessionStore.UpdateProps(session) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["session"] = session + + s.Root.debugBar.SendStoreCall("SessionStore.UpdateProps", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSessionStore) UpdateRoles(userID string, roles string) (string, error) { + start := time.Now() + + result, err := s.SessionStore.UpdateRoles(userID, roles) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["roles"] = roles + + s.Root.debugBar.SendStoreCall("SessionStore.UpdateRoles", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) Delete(channelId string) (bool, error) { + start := time.Now() + + result, err := s.SharedChannelStore.Delete(channelId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelId"] = channelId + + s.Root.debugBar.SendStoreCall("SharedChannelStore.Delete", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) DeleteRemote(remoteId string) (bool, error) { + start := time.Now() + + result, err := s.SharedChannelStore.DeleteRemote(remoteId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remoteId"] = remoteId + + s.Root.debugBar.SendStoreCall("SharedChannelStore.DeleteRemote", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) Get(channelId string) (*model.SharedChannel, error) { + start := time.Now() + + result, err := s.SharedChannelStore.Get(channelId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelId"] = channelId + + s.Root.debugBar.SendStoreCall("SharedChannelStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetAll(offset int, limit int, opts model.SharedChannelFilterOpts) ([]*model.SharedChannel, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetAll(offset, limit, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetAllCount(opts model.SharedChannelFilterOpts) (int64, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetAllCount(opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetAllCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetAttachment(fileId, remoteId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["fileId"] = fileId + + debugBarLayerParams["remoteId"] = remoteId + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetAttachment", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetRemote(id string) (*model.SharedChannelRemote, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetRemote(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetRemote", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetRemoteByIds(channelId, remoteId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelId"] = channelId + + debugBarLayerParams["remoteId"] = remoteId + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetRemoteByIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetRemoteForUser(remoteId, userId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remoteId"] = remoteId + + debugBarLayerParams["userId"] = userId + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetRemoteForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetRemotes(opts model.SharedChannelRemoteFilterOpts) ([]*model.SharedChannelRemote, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetRemotes(opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetRemotes", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetRemotesStatus(channelId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelId"] = channelId + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetRemotesStatus", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetSingleUser(userID string, channelID string, remoteID string) (*model.SharedChannelUser, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetSingleUser(userID, channelID, remoteID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["remoteID"] = remoteID + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetSingleUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetUsersForSync(filter model.GetUsersForSyncFilter) ([]*model.User, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetUsersForSync(filter) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["filter"] = filter + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetUsersForSync", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) GetUsersForUser(userID string) ([]*model.SharedChannelUser, error) { + start := time.Now() + + result, err := s.SharedChannelStore.GetUsersForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("SharedChannelStore.GetUsersForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) HasChannel(channelID string) (bool, error) { + start := time.Now() + + result, err := s.SharedChannelStore.HasChannel(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("SharedChannelStore.HasChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) HasRemote(channelID string, remoteId string) (bool, error) { + start := time.Now() + + result, err := s.SharedChannelStore.HasRemote(channelID, remoteId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["remoteId"] = remoteId + + s.Root.debugBar.SendStoreCall("SharedChannelStore.HasRemote", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) Save(sc *model.SharedChannel) (*model.SharedChannel, error) { + start := time.Now() + + result, err := s.SharedChannelStore.Save(sc) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["sc"] = sc + + s.Root.debugBar.SendStoreCall("SharedChannelStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) SaveAttachment(remote *model.SharedChannelAttachment) (*model.SharedChannelAttachment, error) { + start := time.Now() + + result, err := s.SharedChannelStore.SaveAttachment(remote) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remote"] = remote + + s.Root.debugBar.SendStoreCall("SharedChannelStore.SaveAttachment", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) SaveRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error) { + start := time.Now() + + result, err := s.SharedChannelStore.SaveRemote(remote) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remote"] = remote + + s.Root.debugBar.SendStoreCall("SharedChannelStore.SaveRemote", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) SaveUser(remote *model.SharedChannelUser) (*model.SharedChannelUser, error) { + start := time.Now() + + result, err := s.SharedChannelStore.SaveUser(remote) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remote"] = remote + + s.Root.debugBar.SendStoreCall("SharedChannelStore.SaveUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) Update(sc *model.SharedChannel) (*model.SharedChannel, error) { + start := time.Now() + + result, err := s.SharedChannelStore.Update(sc) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["sc"] = sc + + s.Root.debugBar.SendStoreCall("SharedChannelStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) UpdateAttachmentLastSyncAt(id string, syncTime int64) error { + start := time.Now() + + err := s.SharedChannelStore.UpdateAttachmentLastSyncAt(id, syncTime) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["syncTime"] = syncTime + + s.Root.debugBar.SendStoreCall("SharedChannelStore.UpdateAttachmentLastSyncAt", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSharedChannelStore) UpdateRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error) { + start := time.Now() + + result, err := s.SharedChannelStore.UpdateRemote(remote) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remote"] = remote + + s.Root.debugBar.SendStoreCall("SharedChannelStore.UpdateRemote", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSharedChannelStore) UpdateRemoteCursor(id string, cursor model.GetPostsSinceForSyncCursor) error { + start := time.Now() + + err := s.SharedChannelStore.UpdateRemoteCursor(id, cursor) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["cursor"] = cursor + + s.Root.debugBar.SendStoreCall("SharedChannelStore.UpdateRemoteCursor", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSharedChannelStore) UpdateUserLastSyncAt(userID string, channelID string, remoteID string) error { + start := time.Now() + + err := s.SharedChannelStore.UpdateUserLastSyncAt(userID, channelID, remoteID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["remoteID"] = remoteID + + s.Root.debugBar.SendStoreCall("SharedChannelStore.UpdateUserLastSyncAt", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSharedChannelStore) UpsertAttachment(remote *model.SharedChannelAttachment) (string, error) { + start := time.Now() + + result, err := s.SharedChannelStore.UpsertAttachment(remote) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["remote"] = remote + + s.Root.debugBar.SendStoreCall("SharedChannelStore.UpsertAttachment", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerStatusStore) Get(userID string) (*model.Status, error) { + start := time.Now() + + result, err := s.StatusStore.Get(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("StatusStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerStatusStore) GetByIds(userIds []string) ([]*model.Status, error) { + start := time.Now() + + result, err := s.StatusStore.GetByIds(userIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userIds"] = userIds + + s.Root.debugBar.SendStoreCall("StatusStore.GetByIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerStatusStore) GetTotalActiveUsersCount() (int64, error) { + start := time.Now() + + result, err := s.StatusStore.GetTotalActiveUsersCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("StatusStore.GetTotalActiveUsersCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerStatusStore) ResetAll() error { + start := time.Now() + + err := s.StatusStore.ResetAll() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("StatusStore.ResetAll", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerStatusStore) SaveOrUpdate(status *model.Status) error { + start := time.Now() + + err := s.StatusStore.SaveOrUpdate(status) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["status"] = status + + s.Root.debugBar.SendStoreCall("StatusStore.SaveOrUpdate", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerStatusStore) UpdateExpiredDNDStatuses() ([]*model.Status, error) { + start := time.Now() + + result, err := s.StatusStore.UpdateExpiredDNDStatuses() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("StatusStore.UpdateExpiredDNDStatuses", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerStatusStore) UpdateLastActivityAt(userID string, lastActivityAt int64) error { + start := time.Now() + + err := s.StatusStore.UpdateLastActivityAt(userID, lastActivityAt) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["lastActivityAt"] = lastActivityAt + + s.Root.debugBar.SendStoreCall("StatusStore.UpdateLastActivityAt", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSystemStore) Get() (model.StringMap, error) { + start := time.Now() + + result, err := s.SystemStore.Get() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("SystemStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSystemStore) GetByName(name string) (*model.System, error) { + start := time.Now() + + result, err := s.SystemStore.GetByName(name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("SystemStore.GetByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSystemStore) InsertIfExists(system *model.System) (*model.System, error) { + start := time.Now() + + result, err := s.SystemStore.InsertIfExists(system) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["system"] = system + + s.Root.debugBar.SendStoreCall("SystemStore.InsertIfExists", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSystemStore) PermanentDeleteByName(name string) (*model.System, error) { + start := time.Now() + + result, err := s.SystemStore.PermanentDeleteByName(name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("SystemStore.PermanentDeleteByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerSystemStore) Save(system *model.System) error { + start := time.Now() + + err := s.SystemStore.Save(system) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["system"] = system + + s.Root.debugBar.SendStoreCall("SystemStore.Save", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSystemStore) SaveOrUpdate(system *model.System) error { + start := time.Now() + + err := s.SystemStore.SaveOrUpdate(system) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["system"] = system + + s.Root.debugBar.SendStoreCall("SystemStore.SaveOrUpdate", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSystemStore) SaveOrUpdateWithWarnMetricHandling(system *model.System) error { + start := time.Now() + + err := s.SystemStore.SaveOrUpdateWithWarnMetricHandling(system) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["system"] = system + + s.Root.debugBar.SendStoreCall("SystemStore.SaveOrUpdateWithWarnMetricHandling", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerSystemStore) Update(system *model.System) error { + start := time.Now() + + err := s.SystemStore.Update(system) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["system"] = system + + s.Root.debugBar.SendStoreCall("SystemStore.Update", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) AnalyticsGetTeamCountForScheme(schemeID string) (int64, error) { + start := time.Now() + + result, err := s.TeamStore.AnalyticsGetTeamCountForScheme(schemeID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["schemeID"] = schemeID + + s.Root.debugBar.SendStoreCall("TeamStore.AnalyticsGetTeamCountForScheme", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) AnalyticsTeamCount(opts *model.TeamSearch) (int64, error) { + start := time.Now() + + result, err := s.TeamStore.AnalyticsTeamCount(opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("TeamStore.AnalyticsTeamCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) ClearAllCustomRoleAssignments() error { + start := time.Now() + + err := s.TeamStore.ClearAllCustomRoleAssignments() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("TeamStore.ClearAllCustomRoleAssignments", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) ClearCaches() { + start := time.Now() + + s.TeamStore.ClearCaches() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("TeamStore.ClearCaches", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerTeamStore) Get(id string) (*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.Get(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("TeamStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetActiveMemberCount(teamID string, restrictions *model.ViewUsersRestrictions) (int64, error) { + start := time.Now() + + result, err := s.TeamStore.GetActiveMemberCount(teamID, restrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["restrictions"] = restrictions + + s.Root.debugBar.SendStoreCall("TeamStore.GetActiveMemberCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetAll() ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetAll() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("TeamStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetAllForExportAfter(limit int, afterID string) ([]*model.TeamForExport, error) { + start := time.Now() + + result, err := s.TeamStore.GetAllForExportAfter(limit, afterID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["afterID"] = afterID + + s.Root.debugBar.SendStoreCall("TeamStore.GetAllForExportAfter", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetAllPage(offset int, limit int, opts *model.TeamSearch) ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetAllPage(offset, limit, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("TeamStore.GetAllPage", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetAllPrivateTeamListing() ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetAllPrivateTeamListing() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("TeamStore.GetAllPrivateTeamListing", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetAllTeamListing() ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetAllTeamListing() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("TeamStore.GetAllTeamListing", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetByEmptyInviteID() ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetByEmptyInviteID() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("TeamStore.GetByEmptyInviteID", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetByInviteId(inviteID string) (*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetByInviteId(inviteID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["inviteID"] = inviteID + + s.Root.debugBar.SendStoreCall("TeamStore.GetByInviteId", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetByName(name string) (*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetByName(name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("TeamStore.GetByName", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetByNames(name []string) ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetByNames(name) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["name"] = name + + s.Root.debugBar.SendStoreCall("TeamStore.GetByNames", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetChannelUnreadsForAllTeams(excludeTeamID string, userID string) ([]*model.ChannelUnread, error) { + start := time.Now() + + result, err := s.TeamStore.GetChannelUnreadsForAllTeams(excludeTeamID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["excludeTeamID"] = excludeTeamID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("TeamStore.GetChannelUnreadsForAllTeams", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetChannelUnreadsForTeam(teamID string, userID string) ([]*model.ChannelUnread, error) { + start := time.Now() + + result, err := s.TeamStore.GetChannelUnreadsForTeam(teamID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("TeamStore.GetChannelUnreadsForTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetCommonTeamIDsForTwoUsers(userID string, otherUserID string) ([]string, error) { + start := time.Now() + + result, err := s.TeamStore.GetCommonTeamIDsForTwoUsers(userID, otherUserID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["otherUserID"] = otherUserID + + s.Root.debugBar.SendStoreCall("TeamStore.GetCommonTeamIDsForTwoUsers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetMany(ids []string) ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetMany(ids) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ids"] = ids + + s.Root.debugBar.SendStoreCall("TeamStore.GetMany", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetMember(ctx context.Context, teamID string, userID string) (*model.TeamMember, error) { + start := time.Now() + + result, err := s.TeamStore.GetMember(ctx, teamID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("TeamStore.GetMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetMembers(teamID string, offset int, limit int, teamMembersGetOptions *model.TeamMembersGetOptions) ([]*model.TeamMember, error) { + start := time.Now() + + result, err := s.TeamStore.GetMembers(teamID, offset, limit, teamMembersGetOptions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["teamMembersGetOptions"] = teamMembersGetOptions + + s.Root.debugBar.SendStoreCall("TeamStore.GetMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetMembersByIds(teamID string, userIds []string, restrictions *model.ViewUsersRestrictions) ([]*model.TeamMember, error) { + start := time.Now() + + result, err := s.TeamStore.GetMembersByIds(teamID, userIds, restrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userIds"] = userIds + + debugBarLayerParams["restrictions"] = restrictions + + s.Root.debugBar.SendStoreCall("TeamStore.GetMembersByIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetNewTeamMembersSince(teamID string, since int64, offset int, limit int) (*model.NewTeamMembersList, int64, error) { + start := time.Now() + + result, resultVar1, err := s.TeamStore.GetNewTeamMembersSince(teamID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("TeamStore.GetNewTeamMembersSince", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerTeamStore) GetTeamMembersForExport(userID string) ([]*model.TeamMemberForExport, error) { + start := time.Now() + + result, err := s.TeamStore.GetTeamMembersForExport(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("TeamStore.GetTeamMembersForExport", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetTeamsByScheme(schemeID string, offset int, limit int) ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetTeamsByScheme(schemeID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["schemeID"] = schemeID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("TeamStore.GetTeamsByScheme", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetTeamsByUserId(userID string) ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.GetTeamsByUserId(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("TeamStore.GetTeamsByUserId", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetTeamsForUser(ctx context.Context, userID string, excludeTeamID string, includeDeleted bool) ([]*model.TeamMember, error) { + start := time.Now() + + result, err := s.TeamStore.GetTeamsForUser(ctx, userID, excludeTeamID, includeDeleted) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["excludeTeamID"] = excludeTeamID + + debugBarLayerParams["includeDeleted"] = includeDeleted + + s.Root.debugBar.SendStoreCall("TeamStore.GetTeamsForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetTeamsForUserWithPagination(userID string, page int, perPage int) ([]*model.TeamMember, error) { + start := time.Now() + + result, err := s.TeamStore.GetTeamsForUserWithPagination(userID, page, perPage) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + s.Root.debugBar.SendStoreCall("TeamStore.GetTeamsForUserWithPagination", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetTotalMemberCount(teamID string, restrictions *model.ViewUsersRestrictions) (int64, error) { + start := time.Now() + + result, err := s.TeamStore.GetTotalMemberCount(teamID, restrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["restrictions"] = restrictions + + s.Root.debugBar.SendStoreCall("TeamStore.GetTotalMemberCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GetUserTeamIds(userID string, allowFromCache bool) ([]string, error) { + start := time.Now() + + result, err := s.TeamStore.GetUserTeamIds(userID, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("TeamStore.GetUserTeamIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) GroupSyncedTeamCount() (int64, error) { + start := time.Now() + + result, err := s.TeamStore.GroupSyncedTeamCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("TeamStore.GroupSyncedTeamCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) InvalidateAllTeamIdsForUser(userID string) { + start := time.Now() + + s.TeamStore.InvalidateAllTeamIdsForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("TeamStore.InvalidateAllTeamIdsForUser", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerTeamStore) MigrateTeamMembers(fromTeamID string, fromUserID string) (map[string]string, error) { + start := time.Now() + + result, err := s.TeamStore.MigrateTeamMembers(fromTeamID, fromUserID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["fromTeamID"] = fromTeamID + + debugBarLayerParams["fromUserID"] = fromUserID + + s.Root.debugBar.SendStoreCall("TeamStore.MigrateTeamMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) PermanentDelete(teamID string) error { + start := time.Now() + + err := s.TeamStore.PermanentDelete(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("TeamStore.PermanentDelete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) RemoveAllMembersByTeam(teamID string) error { + start := time.Now() + + err := s.TeamStore.RemoveAllMembersByTeam(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("TeamStore.RemoveAllMembersByTeam", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) RemoveAllMembersByUser(userID string) error { + start := time.Now() + + err := s.TeamStore.RemoveAllMembersByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("TeamStore.RemoveAllMembersByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) RemoveMember(teamID string, userID string) error { + start := time.Now() + + err := s.TeamStore.RemoveMember(teamID, userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("TeamStore.RemoveMember", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) RemoveMembers(teamID string, userIds []string) error { + start := time.Now() + + err := s.TeamStore.RemoveMembers(teamID, userIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userIds"] = userIds + + s.Root.debugBar.SendStoreCall("TeamStore.RemoveMembers", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) ResetAllTeamSchemes() error { + start := time.Now() + + err := s.TeamStore.ResetAllTeamSchemes() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("TeamStore.ResetAllTeamSchemes", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) Save(team *model.Team) (*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.Save(team) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["team"] = team + + s.Root.debugBar.SendStoreCall("TeamStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) SaveMember(member *model.TeamMember, maxUsersPerTeam int) (*model.TeamMember, error) { + start := time.Now() + + result, err := s.TeamStore.SaveMember(member, maxUsersPerTeam) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["member"] = member + + debugBarLayerParams["maxUsersPerTeam"] = maxUsersPerTeam + + s.Root.debugBar.SendStoreCall("TeamStore.SaveMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) SaveMultipleMembers(members []*model.TeamMember, maxUsersPerTeam int) ([]*model.TeamMember, error) { + start := time.Now() + + result, err := s.TeamStore.SaveMultipleMembers(members, maxUsersPerTeam) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["members"] = members + + debugBarLayerParams["maxUsersPerTeam"] = maxUsersPerTeam + + s.Root.debugBar.SendStoreCall("TeamStore.SaveMultipleMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) SearchAll(opts *model.TeamSearch) ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.SearchAll(opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("TeamStore.SearchAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) SearchAllPaged(opts *model.TeamSearch) ([]*model.Team, int64, error) { + start := time.Now() + + result, resultVar1, err := s.TeamStore.SearchAllPaged(opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("TeamStore.SearchAllPaged", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerTeamStore) SearchOpen(opts *model.TeamSearch) ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.SearchOpen(opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("TeamStore.SearchOpen", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) SearchPrivate(opts *model.TeamSearch) ([]*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.SearchPrivate(opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("TeamStore.SearchPrivate", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) Update(team *model.Team) (*model.Team, error) { + start := time.Now() + + result, err := s.TeamStore.Update(team) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["team"] = team + + s.Root.debugBar.SendStoreCall("TeamStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) UpdateLastTeamIconUpdate(teamID string, curTime int64) error { + start := time.Now() + + err := s.TeamStore.UpdateLastTeamIconUpdate(teamID, curTime) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["curTime"] = curTime + + s.Root.debugBar.SendStoreCall("TeamStore.UpdateLastTeamIconUpdate", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) UpdateMember(member *model.TeamMember) (*model.TeamMember, error) { + start := time.Now() + + result, err := s.TeamStore.UpdateMember(member) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["member"] = member + + s.Root.debugBar.SendStoreCall("TeamStore.UpdateMember", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) UpdateMembersRole(teamID string, userIDs []string) error { + start := time.Now() + + err := s.TeamStore.UpdateMembersRole(teamID, userIDs) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userIDs"] = userIDs + + s.Root.debugBar.SendStoreCall("TeamStore.UpdateMembersRole", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTeamStore) UpdateMultipleMembers(members []*model.TeamMember) ([]*model.TeamMember, error) { + start := time.Now() + + result, err := s.TeamStore.UpdateMultipleMembers(members) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["members"] = members + + s.Root.debugBar.SendStoreCall("TeamStore.UpdateMultipleMembers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTeamStore) UserBelongsToTeams(userID string, teamIds []string) (bool, error) { + start := time.Now() + + result, err := s.TeamStore.UserBelongsToTeams(userID, teamIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamIds"] = teamIds + + s.Root.debugBar.SendStoreCall("TeamStore.UserBelongsToTeams", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTermsOfServiceStore) Get(id string, allowFromCache bool) (*model.TermsOfService, error) { + start := time.Now() + + result, err := s.TermsOfServiceStore.Get(id, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("TermsOfServiceStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTermsOfServiceStore) GetLatest(allowFromCache bool) (*model.TermsOfService, error) { + start := time.Now() + + result, err := s.TermsOfServiceStore.GetLatest(allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("TermsOfServiceStore.GetLatest", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTermsOfServiceStore) Save(termsOfService *model.TermsOfService) (*model.TermsOfService, error) { + start := time.Now() + + result, err := s.TermsOfServiceStore.Save(termsOfService) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["termsOfService"] = termsOfService + + s.Root.debugBar.SendStoreCall("TermsOfServiceStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) DeleteMembershipForUser(userId string, postID string) error { + start := time.Now() + + err := s.ThreadStore.DeleteMembershipForUser(userId, postID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["postID"] = postID + + s.Root.debugBar.SendStoreCall("ThreadStore.DeleteMembershipForUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerThreadStore) DeleteOrphanedRows(limit int) (int64, error) { + start := time.Now() + + result, err := s.ThreadStore.DeleteOrphanedRows(limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ThreadStore.DeleteOrphanedRows", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) Get(id string) (*model.Thread, error) { + start := time.Now() + + result, err := s.ThreadStore.Get(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("ThreadStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetMembershipForUser(userId string, postID string) (*model.ThreadMembership, error) { + start := time.Now() + + result, err := s.ThreadStore.GetMembershipForUser(userId, postID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["postID"] = postID + + s.Root.debugBar.SendStoreCall("ThreadStore.GetMembershipForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetMembershipsForUser(userId string, teamID string) ([]*model.ThreadMembership, error) { + start := time.Now() + + result, err := s.ThreadStore.GetMembershipsForUser(userId, teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("ThreadStore.GetMembershipsForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetTeamsUnreadForUser(userID string, teamIDs []string, includeUrgentMentionCount bool) (map[string]*model.TeamUnread, error) { + start := time.Now() + + result, err := s.ThreadStore.GetTeamsUnreadForUser(userID, teamIDs, includeUrgentMentionCount) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamIDs"] = teamIDs + + debugBarLayerParams["includeUrgentMentionCount"] = includeUrgentMentionCount + + s.Root.debugBar.SendStoreCall("ThreadStore.GetTeamsUnreadForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetThreadFollowers(threadID string, fetchOnlyActive bool) ([]string, error) { + start := time.Now() + + result, err := s.ThreadStore.GetThreadFollowers(threadID, fetchOnlyActive) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["threadID"] = threadID + + debugBarLayerParams["fetchOnlyActive"] = fetchOnlyActive + + s.Root.debugBar.SendStoreCall("ThreadStore.GetThreadFollowers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetThreadForUser(threadMembership *model.ThreadMembership, extended bool, postPriorityIsEnabled bool) (*model.ThreadResponse, error) { + start := time.Now() + + result, err := s.ThreadStore.GetThreadForUser(threadMembership, extended, postPriorityIsEnabled) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["threadMembership"] = threadMembership + + debugBarLayerParams["extended"] = extended + + debugBarLayerParams["postPriorityIsEnabled"] = postPriorityIsEnabled + + s.Root.debugBar.SendStoreCall("ThreadStore.GetThreadForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetThreadUnreadReplyCount(threadMembership *model.ThreadMembership) (int64, error) { + start := time.Now() + + result, err := s.ThreadStore.GetThreadUnreadReplyCount(threadMembership) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["threadMembership"] = threadMembership + + s.Root.debugBar.SendStoreCall("ThreadStore.GetThreadUnreadReplyCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetThreadsForUser(userId string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { + start := time.Now() + + result, err := s.ThreadStore.GetThreadsForUser(userId, teamID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ThreadStore.GetThreadsForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetTopThreadsForTeamSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopThreadList, error) { + start := time.Now() + + result, err := s.ThreadStore.GetTopThreadsForTeamSince(teamID, userID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ThreadStore.GetTopThreadsForTeamSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetTopThreadsForUserSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopThreadList, error) { + start := time.Now() + + result, err := s.ThreadStore.GetTopThreadsForUserSince(teamID, userID, since, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["since"] = since + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("ThreadStore.GetTopThreadsForUserSince", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetTotalThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { + start := time.Now() + + result, err := s.ThreadStore.GetTotalThreads(userId, teamID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ThreadStore.GetTotalThreads", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetTotalUnreadMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { + start := time.Now() + + result, err := s.ThreadStore.GetTotalUnreadMentions(userId, teamID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ThreadStore.GetTotalUnreadMentions", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetTotalUnreadThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { + start := time.Now() + + result, err := s.ThreadStore.GetTotalUnreadThreads(userId, teamID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ThreadStore.GetTotalUnreadThreads", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) GetTotalUnreadUrgentMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { + start := time.Now() + + result, err := s.ThreadStore.GetTotalUnreadUrgentMentions(userId, teamID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userId"] = userId + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ThreadStore.GetTotalUnreadUrgentMentions", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) MaintainMembership(userID string, postID string, opts store.ThreadMembershipOpts) (*model.ThreadMembership, error) { + start := time.Now() + + result, err := s.ThreadStore.MaintainMembership(userID, postID, opts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["postID"] = postID + + debugBarLayerParams["opts"] = opts + + s.Root.debugBar.SendStoreCall("ThreadStore.MaintainMembership", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerThreadStore) MarkAllAsRead(userID string, threadIds []string) error { + start := time.Now() + + err := s.ThreadStore.MarkAllAsRead(userID, threadIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["threadIds"] = threadIds + + s.Root.debugBar.SendStoreCall("ThreadStore.MarkAllAsRead", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerThreadStore) MarkAllAsReadByChannels(userID string, channelIDs []string) error { + start := time.Now() + + err := s.ThreadStore.MarkAllAsReadByChannels(userID, channelIDs) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelIDs"] = channelIDs + + s.Root.debugBar.SendStoreCall("ThreadStore.MarkAllAsReadByChannels", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerThreadStore) MarkAllAsReadByTeam(userID string, teamID string) error { + start := time.Now() + + err := s.ThreadStore.MarkAllAsReadByTeam(userID, teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("ThreadStore.MarkAllAsReadByTeam", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerThreadStore) MarkAsRead(userID string, threadID string, timestamp int64) error { + start := time.Now() + + err := s.ThreadStore.MarkAsRead(userID, threadID, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["threadID"] = threadID + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("ThreadStore.MarkAsRead", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerThreadStore) PermanentDeleteBatchForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { + start := time.Now() + + result, resultVar1, err := s.ThreadStore.PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["now"] = now + + debugBarLayerParams["globalPolicyEndTime"] = globalPolicyEndTime + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["cursor"] = cursor + + s.Root.debugBar.SendStoreCall("ThreadStore.PermanentDeleteBatchForRetentionPolicies", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerThreadStore) PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { + start := time.Now() + + result, resultVar1, err := s.ThreadStore.PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["now"] = now + + debugBarLayerParams["globalPolicyEndTime"] = globalPolicyEndTime + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["cursor"] = cursor + + s.Root.debugBar.SendStoreCall("ThreadStore.PermanentDeleteBatchThreadMembershipsForRetentionPolicies", success, elapsed, debugBarLayerParams) + + return result, resultVar1, err +} + +func (s *DebugBarLayerThreadStore) UpdateMembership(membership *model.ThreadMembership) (*model.ThreadMembership, error) { + start := time.Now() + + result, err := s.ThreadStore.UpdateMembership(membership) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["membership"] = membership + + s.Root.debugBar.SendStoreCall("ThreadStore.UpdateMembership", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTokenStore) Cleanup(expiryTime int64) { + start := time.Now() + + s.TokenStore.Cleanup(expiryTime) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["expiryTime"] = expiryTime + + s.Root.debugBar.SendStoreCall("TokenStore.Cleanup", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerTokenStore) Delete(token string) error { + start := time.Now() + + err := s.TokenStore.Delete(token) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["token"] = token + + s.Root.debugBar.SendStoreCall("TokenStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTokenStore) GetAllTokensByType(tokenType string) ([]*model.Token, error) { + start := time.Now() + + result, err := s.TokenStore.GetAllTokensByType(tokenType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["tokenType"] = tokenType + + s.Root.debugBar.SendStoreCall("TokenStore.GetAllTokensByType", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTokenStore) GetByToken(token string) (*model.Token, error) { + start := time.Now() + + result, err := s.TokenStore.GetByToken(token) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["token"] = token + + s.Root.debugBar.SendStoreCall("TokenStore.GetByToken", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTokenStore) RemoveAllTokensByType(tokenType string) error { + start := time.Now() + + err := s.TokenStore.RemoveAllTokensByType(tokenType) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["tokenType"] = tokenType + + s.Root.debugBar.SendStoreCall("TokenStore.RemoveAllTokensByType", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTokenStore) Save(recovery *model.Token) error { + start := time.Now() + + err := s.TokenStore.Save(recovery) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["recovery"] = recovery + + s.Root.debugBar.SendStoreCall("TokenStore.Save", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerTrueUpReviewStore) CreateTrueUpReviewStatusRecord(reviewStatus *model.TrueUpReviewStatus) (*model.TrueUpReviewStatus, error) { + start := time.Now() + + result, err := s.TrueUpReviewStore.CreateTrueUpReviewStatusRecord(reviewStatus) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["reviewStatus"] = reviewStatus + + s.Root.debugBar.SendStoreCall("TrueUpReviewStore.CreateTrueUpReviewStatusRecord", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTrueUpReviewStore) GetTrueUpReviewStatus(dueDate int64) (*model.TrueUpReviewStatus, error) { + start := time.Now() + + result, err := s.TrueUpReviewStore.GetTrueUpReviewStatus(dueDate) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["dueDate"] = dueDate + + s.Root.debugBar.SendStoreCall("TrueUpReviewStore.GetTrueUpReviewStatus", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerTrueUpReviewStore) Update(reviewStatus *model.TrueUpReviewStatus) (*model.TrueUpReviewStatus, error) { + start := time.Now() + + result, err := s.TrueUpReviewStore.Update(reviewStatus) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["reviewStatus"] = reviewStatus + + s.Root.debugBar.SendStoreCall("TrueUpReviewStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUploadSessionStore) Delete(id string) error { + start := time.Now() + + err := s.UploadSessionStore.Delete(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("UploadSessionStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUploadSessionStore) Get(ctx context.Context, id string) (*model.UploadSession, error) { + start := time.Now() + + result, err := s.UploadSessionStore.Get(ctx, id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("UploadSessionStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUploadSessionStore) GetForUser(userID string) ([]*model.UploadSession, error) { + start := time.Now() + + result, err := s.UploadSessionStore.GetForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UploadSessionStore.GetForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUploadSessionStore) Save(session *model.UploadSession) (*model.UploadSession, error) { + start := time.Now() + + result, err := s.UploadSessionStore.Save(session) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["session"] = session + + s.Root.debugBar.SendStoreCall("UploadSessionStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUploadSessionStore) Update(session *model.UploadSession) error { + start := time.Now() + + err := s.UploadSessionStore.Update(session) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["session"] = session + + s.Root.debugBar.SendStoreCall("UploadSessionStore.Update", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) AnalyticsActiveCount(timestamp int64, options model.UserCountOptions) (int64, error) { + start := time.Now() + + result, err := s.UserStore.AnalyticsActiveCount(timestamp, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["timestamp"] = timestamp + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.AnalyticsActiveCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) AnalyticsActiveCountForPeriod(startTime int64, endTime int64, options model.UserCountOptions) (int64, error) { + start := time.Now() + + result, err := s.UserStore.AnalyticsActiveCountForPeriod(startTime, endTime, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["startTime"] = startTime + + debugBarLayerParams["endTime"] = endTime + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.AnalyticsActiveCountForPeriod", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) AnalyticsGetExternalUsers(hostDomain string) (bool, error) { + start := time.Now() + + result, err := s.UserStore.AnalyticsGetExternalUsers(hostDomain) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["hostDomain"] = hostDomain + + s.Root.debugBar.SendStoreCall("UserStore.AnalyticsGetExternalUsers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) AnalyticsGetGuestCount() (int64, error) { + start := time.Now() + + result, err := s.UserStore.AnalyticsGetGuestCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.AnalyticsGetGuestCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) AnalyticsGetInactiveUsersCount() (int64, error) { + start := time.Now() + + result, err := s.UserStore.AnalyticsGetInactiveUsersCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.AnalyticsGetInactiveUsersCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) AnalyticsGetSystemAdminCount() (int64, error) { + start := time.Now() + + result, err := s.UserStore.AnalyticsGetSystemAdminCount() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.AnalyticsGetSystemAdminCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) AutocompleteUsersInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, error) { + start := time.Now() + + result, err := s.UserStore.AutocompleteUsersInChannel(teamID, channelID, term, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.AutocompleteUsersInChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) ClearAllCustomRoleAssignments() error { + start := time.Now() + + err := s.UserStore.ClearAllCustomRoleAssignments() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.ClearAllCustomRoleAssignments", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) ClearCaches() { + start := time.Now() + + s.UserStore.ClearCaches() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.ClearCaches", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerUserStore) Count(options model.UserCountOptions) (int64, error) { + start := time.Now() + + result, err := s.UserStore.Count(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.Count", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) DeactivateGuests() ([]string, error) { + start := time.Now() + + result, err := s.UserStore.DeactivateGuests() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.DeactivateGuests", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) DemoteUserToGuest(userID string) (*model.User, error) { + start := time.Now() + + result, err := s.UserStore.DemoteUserToGuest(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserStore.DemoteUserToGuest", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) Get(ctx context.Context, id string) (*model.User, error) { + start := time.Now() + + result, err := s.UserStore.Get(ctx, id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("UserStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetAll() ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetAll() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetAllAfter(limit int, afterID string) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetAllAfter(limit, afterID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["afterID"] = afterID + + s.Root.debugBar.SendStoreCall("UserStore.GetAllAfter", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetAllNotInAuthService(authServices []string) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetAllNotInAuthService(authServices) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["authServices"] = authServices + + s.Root.debugBar.SendStoreCall("UserStore.GetAllNotInAuthService", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetAllProfiles(options *model.UserGetOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetAllProfiles(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.GetAllProfiles", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetAllProfilesInChannel(ctx, channelID, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("UserStore.GetAllProfilesInChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetAllUsingAuthService(authService string) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetAllUsingAuthService(authService) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["authService"] = authService + + s.Root.debugBar.SendStoreCall("UserStore.GetAllUsingAuthService", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetAnyUnreadPostCountForChannel(userID string, channelID string) (int64, error) { + start := time.Now() + + result, err := s.UserStore.GetAnyUnreadPostCountForChannel(userID, channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("UserStore.GetAnyUnreadPostCountForChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetByAuth(authData *string, authService string) (*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetByAuth(authData, authService) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["authData"] = authData + + debugBarLayerParams["authService"] = authService + + s.Root.debugBar.SendStoreCall("UserStore.GetByAuth", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetByEmail(email string) (*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetByEmail(email) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["email"] = email + + s.Root.debugBar.SendStoreCall("UserStore.GetByEmail", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetByUsername(username string) (*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetByUsername(username) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["username"] = username + + s.Root.debugBar.SendStoreCall("UserStore.GetByUsername", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetChannelGroupUsers(channelID string) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetChannelGroupUsers(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("UserStore.GetChannelGroupUsers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetEtagForAllProfiles() string { + start := time.Now() + + result := s.UserStore.GetEtagForAllProfiles() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.GetEtagForAllProfiles", success, elapsed, debugBarLayerParams) + + return result +} + +func (s *DebugBarLayerUserStore) GetEtagForProfiles(teamID string) string { + start := time.Now() + + result := s.UserStore.GetEtagForProfiles(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("UserStore.GetEtagForProfiles", success, elapsed, debugBarLayerParams) + + return result +} + +func (s *DebugBarLayerUserStore) GetEtagForProfilesNotInTeam(teamID string) string { + start := time.Now() + + result := s.UserStore.GetEtagForProfilesNotInTeam(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("UserStore.GetEtagForProfilesNotInTeam", success, elapsed, debugBarLayerParams) + + return result +} + +func (s *DebugBarLayerUserStore) GetFirstSystemAdminID() (string, error) { + start := time.Now() + + result, err := s.UserStore.GetFirstSystemAdminID() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.GetFirstSystemAdminID", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetForLogin(loginID string, allowSignInWithUsername bool, allowSignInWithEmail bool) (*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetForLogin(loginID, allowSignInWithUsername, allowSignInWithEmail) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["loginID"] = loginID + + debugBarLayerParams["allowSignInWithUsername"] = allowSignInWithUsername + + debugBarLayerParams["allowSignInWithEmail"] = allowSignInWithEmail + + s.Root.debugBar.SendStoreCall("UserStore.GetForLogin", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetKnownUsers(userID string) ([]string, error) { + start := time.Now() + + result, err := s.UserStore.GetKnownUsers(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserStore.GetKnownUsers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetMany(ctx context.Context, ids []string) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetMany(ctx, ids) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["ids"] = ids + + s.Root.debugBar.SendStoreCall("UserStore.GetMany", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetNewUsersForTeam(teamID string, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetNewUsersForTeam(teamID, offset, limit, viewRestrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + s.Root.debugBar.SendStoreCall("UserStore.GetNewUsersForTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfileByGroupChannelIdsForUser(userID string, channelIds []string) (map[string][]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfileByGroupChannelIdsForUser(userID, channelIds) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelIds"] = channelIds + + s.Root.debugBar.SendStoreCall("UserStore.GetProfileByGroupChannelIdsForUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfileByIds(ctx context.Context, userIds []string, options *store.UserGetByIdsOpts, allowFromCache bool) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfileByIds(ctx, userIds, options, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["ctx"] = ctx + + debugBarLayerParams["userIds"] = userIds + + debugBarLayerParams["options"] = options + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("UserStore.GetProfileByIds", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfiles(options *model.UserGetOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfiles(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.GetProfiles", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfilesByUsernames(usernames []string, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfilesByUsernames(usernames, viewRestrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["usernames"] = usernames + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + s.Root.debugBar.SendStoreCall("UserStore.GetProfilesByUsernames", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfilesInChannel(options *model.UserGetOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfilesInChannel(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.GetProfilesInChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfilesInChannelByAdmin(options *model.UserGetOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfilesInChannelByAdmin(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.GetProfilesInChannelByAdmin", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfilesInChannelByStatus(options *model.UserGetOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfilesInChannelByStatus(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.GetProfilesInChannelByStatus", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfilesNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfilesNotInChannel(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["channelId"] = channelId + + debugBarLayerParams["groupConstrained"] = groupConstrained + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + s.Root.debugBar.SendStoreCall("UserStore.GetProfilesNotInChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfilesNotInTeam(teamID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfilesNotInTeam(teamID, groupConstrained, offset, limit, viewRestrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["groupConstrained"] = groupConstrained + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + s.Root.debugBar.SendStoreCall("UserStore.GetProfilesNotInTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetProfilesWithoutTeam(options *model.UserGetOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetProfilesWithoutTeam(options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.GetProfilesWithoutTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetRecentlyActiveUsersForTeam(teamID string, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetRecentlyActiveUsersForTeam(teamID, offset, limit, viewRestrictions) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + debugBarLayerParams["viewRestrictions"] = viewRestrictions + + s.Root.debugBar.SendStoreCall("UserStore.GetRecentlyActiveUsersForTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetSystemAdminProfiles() (map[string]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetSystemAdminProfiles() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.GetSystemAdminProfiles", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetTeamGroupUsers(teamID string) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetTeamGroupUsers(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("UserStore.GetTeamGroupUsers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetUnreadCount(userID string, isCRTEnabled bool) (int64, error) { + start := time.Now() + + result, err := s.UserStore.GetUnreadCount(userID, isCRTEnabled) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["isCRTEnabled"] = isCRTEnabled + + s.Root.debugBar.SendStoreCall("UserStore.GetUnreadCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetUnreadCountForChannel(userID string, channelID string) (int64, error) { + start := time.Now() + + result, err := s.UserStore.GetUnreadCountForChannel(userID, channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("UserStore.GetUnreadCountForChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetUsersBatchForIndexing(startTime int64, startFileID string, limit int) ([]*model.UserForIndexing, error) { + start := time.Now() + + result, err := s.UserStore.GetUsersBatchForIndexing(startTime, startFileID, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["startTime"] = startTime + + debugBarLayerParams["startFileID"] = startFileID + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("UserStore.GetUsersBatchForIndexing", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) GetUsersWithInvalidEmails(page int, perPage int, restrictedDomains string) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.GetUsersWithInvalidEmails(page, perPage, restrictedDomains) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + debugBarLayerParams["restrictedDomains"] = restrictedDomains + + s.Root.debugBar.SendStoreCall("UserStore.GetUsersWithInvalidEmails", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) InferSystemInstallDate() (int64, error) { + start := time.Now() + + result, err := s.UserStore.InferSystemInstallDate() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("UserStore.InferSystemInstallDate", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) InsertUsers(users []*model.User) error { + start := time.Now() + + err := s.UserStore.InsertUsers(users) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["users"] = users + + s.Root.debugBar.SendStoreCall("UserStore.InsertUsers", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) InvalidateProfileCacheForUser(userID string) { + start := time.Now() + + s.UserStore.InvalidateProfileCacheForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserStore.InvalidateProfileCacheForUser", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerUserStore) InvalidateProfilesInChannelCache(channelID string) { + start := time.Now() + + s.UserStore.InvalidateProfilesInChannelCache(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("UserStore.InvalidateProfilesInChannelCache", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerUserStore) InvalidateProfilesInChannelCacheByUser(userID string) { + start := time.Now() + + s.UserStore.InvalidateProfilesInChannelCacheByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserStore.InvalidateProfilesInChannelCacheByUser", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerUserStore) IsEmpty(excludeBots bool) (bool, error) { + start := time.Now() + + result, err := s.UserStore.IsEmpty(excludeBots) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["excludeBots"] = excludeBots + + s.Root.debugBar.SendStoreCall("UserStore.IsEmpty", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) PermanentDelete(userID string) error { + start := time.Now() + + err := s.UserStore.PermanentDelete(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserStore.PermanentDelete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) PromoteGuestToUser(userID string) error { + start := time.Now() + + err := s.UserStore.PromoteGuestToUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserStore.PromoteGuestToUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) ResetAuthDataToEmailForUsers(service string, userIDs []string, includeDeleted bool, dryRun bool) (int, error) { + start := time.Now() + + result, err := s.UserStore.ResetAuthDataToEmailForUsers(service, userIDs, includeDeleted, dryRun) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["service"] = service + + debugBarLayerParams["userIDs"] = userIDs + + debugBarLayerParams["includeDeleted"] = includeDeleted + + debugBarLayerParams["dryRun"] = dryRun + + s.Root.debugBar.SendStoreCall("UserStore.ResetAuthDataToEmailForUsers", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) ResetLastPictureUpdate(userID string) error { + start := time.Now() + + err := s.UserStore.ResetLastPictureUpdate(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserStore.ResetLastPictureUpdate", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) Save(user *model.User) (*model.User, error) { + start := time.Now() + + result, err := s.UserStore.Save(user) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["user"] = user + + s.Root.debugBar.SendStoreCall("UserStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) Search(teamID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.Search(teamID, term, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.Search", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) SearchInChannel(channelID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.SearchInChannel(channelID, term, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.SearchInChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) SearchInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.SearchInGroup(groupID, term, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.SearchInGroup", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) SearchNotInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.SearchNotInChannel(teamID, channelID, term, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.SearchNotInChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) SearchNotInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.SearchNotInGroup(groupID, term, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["groupID"] = groupID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.SearchNotInGroup", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) SearchNotInTeam(notInTeamID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.SearchNotInTeam(notInTeamID, term, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["notInTeamID"] = notInTeamID + + debugBarLayerParams["term"] = term + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.SearchNotInTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) SearchWithoutTeam(term string, options *model.UserSearchOptions) ([]*model.User, error) { + start := time.Now() + + result, err := s.UserStore.SearchWithoutTeam(term, options) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["term"] = term + + debugBarLayerParams["options"] = options + + s.Root.debugBar.SendStoreCall("UserStore.SearchWithoutTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) Update(user *model.User, allowRoleUpdate bool) (*model.UserUpdate, error) { + start := time.Now() + + result, err := s.UserStore.Update(user, allowRoleUpdate) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["user"] = user + + debugBarLayerParams["allowRoleUpdate"] = allowRoleUpdate + + s.Root.debugBar.SendStoreCall("UserStore.Update", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) UpdateAuthData(userID string, service string, authData *string, email string, resetMfa bool) (string, error) { + start := time.Now() + + result, err := s.UserStore.UpdateAuthData(userID, service, authData, email, resetMfa) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["service"] = service + + debugBarLayerParams["authData"] = authData + + debugBarLayerParams["email"] = email + + debugBarLayerParams["resetMfa"] = resetMfa + + s.Root.debugBar.SendStoreCall("UserStore.UpdateAuthData", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) UpdateFailedPasswordAttempts(userID string, attempts int) error { + start := time.Now() + + err := s.UserStore.UpdateFailedPasswordAttempts(userID, attempts) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["attempts"] = attempts + + s.Root.debugBar.SendStoreCall("UserStore.UpdateFailedPasswordAttempts", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) UpdateLastPictureUpdate(userID string) error { + start := time.Now() + + err := s.UserStore.UpdateLastPictureUpdate(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserStore.UpdateLastPictureUpdate", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) UpdateMfaActive(userID string, active bool) error { + start := time.Now() + + err := s.UserStore.UpdateMfaActive(userID, active) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["active"] = active + + s.Root.debugBar.SendStoreCall("UserStore.UpdateMfaActive", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) UpdateMfaSecret(userID string, secret string) error { + start := time.Now() + + err := s.UserStore.UpdateMfaSecret(userID, secret) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["secret"] = secret + + s.Root.debugBar.SendStoreCall("UserStore.UpdateMfaSecret", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) UpdateNotifyProps(userID string, props map[string]string) error { + start := time.Now() + + err := s.UserStore.UpdateNotifyProps(userID, props) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["props"] = props + + s.Root.debugBar.SendStoreCall("UserStore.UpdateNotifyProps", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) UpdatePassword(userID string, newPassword string) error { + start := time.Now() + + err := s.UserStore.UpdatePassword(userID, newPassword) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["newPassword"] = newPassword + + s.Root.debugBar.SendStoreCall("UserStore.UpdatePassword", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserStore) UpdateUpdateAt(userID string) (int64, error) { + start := time.Now() + + result, err := s.UserStore.UpdateUpdateAt(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserStore.UpdateUpdateAt", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserStore) VerifyEmail(userID string, email string) (string, error) { + start := time.Now() + + result, err := s.UserStore.VerifyEmail(userID, email) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["email"] = email + + s.Root.debugBar.SendStoreCall("UserStore.VerifyEmail", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserAccessTokenStore) Delete(tokenID string) error { + start := time.Now() + + err := s.UserAccessTokenStore.Delete(tokenID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["tokenID"] = tokenID + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserAccessTokenStore) DeleteAllForUser(userID string) error { + start := time.Now() + + err := s.UserAccessTokenStore.DeleteAllForUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.DeleteAllForUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserAccessTokenStore) Get(tokenID string) (*model.UserAccessToken, error) { + start := time.Now() + + result, err := s.UserAccessTokenStore.Get(tokenID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["tokenID"] = tokenID + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.Get", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserAccessTokenStore) GetAll(offset int, limit int) ([]*model.UserAccessToken, error) { + start := time.Now() + + result, err := s.UserAccessTokenStore.GetAll(offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.GetAll", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserAccessTokenStore) GetByToken(tokenString string) (*model.UserAccessToken, error) { + start := time.Now() + + result, err := s.UserAccessTokenStore.GetByToken(tokenString) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["tokenString"] = tokenString + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.GetByToken", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserAccessTokenStore) GetByUser(userID string, page int, perPage int) ([]*model.UserAccessToken, error) { + start := time.Now() + + result, err := s.UserAccessTokenStore.GetByUser(userID, page, perPage) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["page"] = page + + debugBarLayerParams["perPage"] = perPage + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.GetByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserAccessTokenStore) Save(token *model.UserAccessToken) (*model.UserAccessToken, error) { + start := time.Now() + + result, err := s.UserAccessTokenStore.Save(token) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["token"] = token + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserAccessTokenStore) Search(term string) ([]*model.UserAccessToken, error) { + start := time.Now() + + result, err := s.UserAccessTokenStore.Search(term) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["term"] = term + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.Search", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserAccessTokenStore) UpdateTokenDisable(tokenID string) error { + start := time.Now() + + err := s.UserAccessTokenStore.UpdateTokenDisable(tokenID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["tokenID"] = tokenID + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.UpdateTokenDisable", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserAccessTokenStore) UpdateTokenEnable(tokenID string) error { + start := time.Now() + + err := s.UserAccessTokenStore.UpdateTokenEnable(tokenID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["tokenID"] = tokenID + + s.Root.debugBar.SendStoreCall("UserAccessTokenStore.UpdateTokenEnable", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserTermsOfServiceStore) Delete(userID string, termsOfServiceId string) error { + start := time.Now() + + err := s.UserTermsOfServiceStore.Delete(userID, termsOfServiceId) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["termsOfServiceId"] = termsOfServiceId + + s.Root.debugBar.SendStoreCall("UserTermsOfServiceStore.Delete", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerUserTermsOfServiceStore) GetByUser(userID string) (*model.UserTermsOfService, error) { + start := time.Now() + + result, err := s.UserTermsOfServiceStore.GetByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("UserTermsOfServiceStore.GetByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerUserTermsOfServiceStore) Save(userTermsOfService *model.UserTermsOfService) (*model.UserTermsOfService, error) { + start := time.Now() + + result, err := s.UserTermsOfServiceStore.Save(userTermsOfService) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userTermsOfService"] = userTermsOfService + + s.Root.debugBar.SendStoreCall("UserTermsOfServiceStore.Save", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) AnalyticsIncomingCount(teamID string) (int64, error) { + start := time.Now() + + result, err := s.WebhookStore.AnalyticsIncomingCount(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("WebhookStore.AnalyticsIncomingCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) AnalyticsOutgoingCount(teamID string) (int64, error) { + start := time.Now() + + result, err := s.WebhookStore.AnalyticsOutgoingCount(teamID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + s.Root.debugBar.SendStoreCall("WebhookStore.AnalyticsOutgoingCount", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) ClearCaches() { + start := time.Now() + + s.WebhookStore.ClearCaches() + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + s.Root.debugBar.SendStoreCall("WebhookStore.ClearCaches", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerWebhookStore) DeleteIncoming(webhookID string, timestamp int64) error { + start := time.Now() + + err := s.WebhookStore.DeleteIncoming(webhookID, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["webhookID"] = webhookID + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("WebhookStore.DeleteIncoming", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerWebhookStore) DeleteOutgoing(webhookID string, timestamp int64) error { + start := time.Now() + + err := s.WebhookStore.DeleteOutgoing(webhookID, timestamp) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["webhookID"] = webhookID + + debugBarLayerParams["timestamp"] = timestamp + + s.Root.debugBar.SendStoreCall("WebhookStore.DeleteOutgoing", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerWebhookStore) GetIncoming(id string, allowFromCache bool) (*model.IncomingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetIncoming(id, allowFromCache) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + debugBarLayerParams["allowFromCache"] = allowFromCache + + s.Root.debugBar.SendStoreCall("WebhookStore.GetIncoming", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetIncomingByChannel(channelID string) ([]*model.IncomingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetIncomingByChannel(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("WebhookStore.GetIncomingByChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetIncomingByTeam(teamID string, offset int, limit int) ([]*model.IncomingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetIncomingByTeam(teamID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetIncomingByTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetIncomingByTeamByUser(teamID string, userID string, offset int, limit int) ([]*model.IncomingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetIncomingByTeamByUser(teamID, userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetIncomingByTeamByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetIncomingList(offset int, limit int) ([]*model.IncomingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetIncomingList(offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetIncomingList", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetIncomingListByUser(userID string, offset int, limit int) ([]*model.IncomingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetIncomingListByUser(userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetIncomingListByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetOutgoing(id) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["id"] = id + + s.Root.debugBar.SendStoreCall("WebhookStore.GetOutgoing", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetOutgoingByChannel(channelID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetOutgoingByChannel(channelID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetOutgoingByChannel", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetOutgoingByChannelByUser(channelID string, userID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetOutgoingByChannelByUser(channelID, userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetOutgoingByChannelByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetOutgoingByTeam(teamID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetOutgoingByTeam(teamID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetOutgoingByTeam", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetOutgoingByTeamByUser(teamID string, userID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetOutgoingByTeamByUser(teamID, userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["teamID"] = teamID + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetOutgoingByTeamByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetOutgoingList(offset int, limit int) ([]*model.OutgoingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetOutgoingList(offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetOutgoingList", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) GetOutgoingListByUser(userID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.GetOutgoingListByUser(userID, offset, limit) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + debugBarLayerParams["offset"] = offset + + debugBarLayerParams["limit"] = limit + + s.Root.debugBar.SendStoreCall("WebhookStore.GetOutgoingListByUser", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) InvalidateWebhookCache(webhook string) { + start := time.Now() + + s.WebhookStore.InvalidateWebhookCache(webhook) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if true { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["webhook"] = webhook + + s.Root.debugBar.SendStoreCall("WebhookStore.InvalidateWebhookCache", success, elapsed, debugBarLayerParams) + +} + +func (s *DebugBarLayerWebhookStore) PermanentDeleteIncomingByChannel(channelID string) error { + start := time.Now() + + err := s.WebhookStore.PermanentDeleteIncomingByChannel(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("WebhookStore.PermanentDeleteIncomingByChannel", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerWebhookStore) PermanentDeleteIncomingByUser(userID string) error { + start := time.Now() + + err := s.WebhookStore.PermanentDeleteIncomingByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("WebhookStore.PermanentDeleteIncomingByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerWebhookStore) PermanentDeleteOutgoingByChannel(channelID string) error { + start := time.Now() + + err := s.WebhookStore.PermanentDeleteOutgoingByChannel(channelID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["channelID"] = channelID + + s.Root.debugBar.SendStoreCall("WebhookStore.PermanentDeleteOutgoingByChannel", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerWebhookStore) PermanentDeleteOutgoingByUser(userID string) error { + start := time.Now() + + err := s.WebhookStore.PermanentDeleteOutgoingByUser(userID) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["userID"] = userID + + s.Root.debugBar.SendStoreCall("WebhookStore.PermanentDeleteOutgoingByUser", success, elapsed, debugBarLayerParams) + + return err +} + +func (s *DebugBarLayerWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.SaveIncoming(webhook) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["webhook"] = webhook + + s.Root.debugBar.SendStoreCall("WebhookStore.SaveIncoming", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) (*model.OutgoingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.SaveOutgoing(webhook) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["webhook"] = webhook + + s.Root.debugBar.SendStoreCall("WebhookStore.SaveOutgoing", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) UpdateIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.UpdateIncoming(webhook) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["webhook"] = webhook + + s.Root.debugBar.SendStoreCall("WebhookStore.UpdateIncoming", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayerWebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, error) { + start := time.Now() + + result, err := s.WebhookStore.UpdateOutgoing(hook) + + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if err == nil { + success = true + } + + debugBarLayerParams := map[string]any{} + + debugBarLayerParams["hook"] = hook + + s.Root.debugBar.SendStoreCall("WebhookStore.UpdateOutgoing", success, elapsed, debugBarLayerParams) + + return result, err +} + +func (s *DebugBarLayer) Close() { + s.Store.Close() +} + +func (s *DebugBarLayer) DropAllTables() { + s.Store.DropAllTables() +} + +func (s *DebugBarLayer) LockToMaster() { + s.Store.LockToMaster() +} + +func (s *DebugBarLayer) MarkSystemRanUnitTests() { + s.Store.MarkSystemRanUnitTests() +} + +func (s *DebugBarLayer) SetContext(context context.Context) { + s.Store.SetContext(context) +} + +func (s *DebugBarLayer) TotalMasterDbConnections() int { + return s.Store.TotalMasterDbConnections() +} + +func (s *DebugBarLayer) TotalReadDbConnections() int { + return s.Store.TotalReadDbConnections() +} + +func (s *DebugBarLayer) TotalSearchDbConnections() int { + return s.Store.TotalSearchDbConnections() +} + +func (s *DebugBarLayer) UnlockFromMaster() { + s.Store.UnlockFromMaster() +} + +func New(childStore store.Store, debugBar *debugbar.DebugBar) *DebugBarLayer { + newStore := DebugBarLayer{ + Store: childStore, + debugBar: debugBar, + } + + newStore.AuditStore = &DebugBarLayerAuditStore{AuditStore: childStore.Audit(), Root: &newStore} + newStore.BotStore = &DebugBarLayerBotStore{BotStore: childStore.Bot(), Root: &newStore} + newStore.ChannelStore = &DebugBarLayerChannelStore{ChannelStore: childStore.Channel(), Root: &newStore} + newStore.ChannelMemberHistoryStore = &DebugBarLayerChannelMemberHistoryStore{ChannelMemberHistoryStore: childStore.ChannelMemberHistory(), Root: &newStore} + newStore.ClusterDiscoveryStore = &DebugBarLayerClusterDiscoveryStore{ClusterDiscoveryStore: childStore.ClusterDiscovery(), Root: &newStore} + newStore.CommandStore = &DebugBarLayerCommandStore{CommandStore: childStore.Command(), Root: &newStore} + newStore.CommandWebhookStore = &DebugBarLayerCommandWebhookStore{CommandWebhookStore: childStore.CommandWebhook(), Root: &newStore} + newStore.ComplianceStore = &DebugBarLayerComplianceStore{ComplianceStore: childStore.Compliance(), Root: &newStore} + newStore.DraftStore = &DebugBarLayerDraftStore{DraftStore: childStore.Draft(), Root: &newStore} + newStore.EmojiStore = &DebugBarLayerEmojiStore{EmojiStore: childStore.Emoji(), Root: &newStore} + newStore.FileInfoStore = &DebugBarLayerFileInfoStore{FileInfoStore: childStore.FileInfo(), Root: &newStore} + newStore.GroupStore = &DebugBarLayerGroupStore{GroupStore: childStore.Group(), Root: &newStore} + newStore.JobStore = &DebugBarLayerJobStore{JobStore: childStore.Job(), Root: &newStore} + newStore.LicenseStore = &DebugBarLayerLicenseStore{LicenseStore: childStore.License(), Root: &newStore} + newStore.LinkMetadataStore = &DebugBarLayerLinkMetadataStore{LinkMetadataStore: childStore.LinkMetadata(), Root: &newStore} + newStore.NotifyAdminStore = &DebugBarLayerNotifyAdminStore{NotifyAdminStore: childStore.NotifyAdmin(), Root: &newStore} + newStore.OAuthStore = &DebugBarLayerOAuthStore{OAuthStore: childStore.OAuth(), Root: &newStore} + newStore.PluginStore = &DebugBarLayerPluginStore{PluginStore: childStore.Plugin(), Root: &newStore} + newStore.PostStore = &DebugBarLayerPostStore{PostStore: childStore.Post(), Root: &newStore} + newStore.PostAcknowledgementStore = &DebugBarLayerPostAcknowledgementStore{PostAcknowledgementStore: childStore.PostAcknowledgement(), Root: &newStore} + newStore.PostPriorityStore = &DebugBarLayerPostPriorityStore{PostPriorityStore: childStore.PostPriority(), Root: &newStore} + newStore.PreferenceStore = &DebugBarLayerPreferenceStore{PreferenceStore: childStore.Preference(), Root: &newStore} + newStore.ProductNoticesStore = &DebugBarLayerProductNoticesStore{ProductNoticesStore: childStore.ProductNotices(), Root: &newStore} + newStore.ReactionStore = &DebugBarLayerReactionStore{ReactionStore: childStore.Reaction(), Root: &newStore} + newStore.RemoteClusterStore = &DebugBarLayerRemoteClusterStore{RemoteClusterStore: childStore.RemoteCluster(), Root: &newStore} + newStore.RetentionPolicyStore = &DebugBarLayerRetentionPolicyStore{RetentionPolicyStore: childStore.RetentionPolicy(), Root: &newStore} + newStore.RoleStore = &DebugBarLayerRoleStore{RoleStore: childStore.Role(), Root: &newStore} + newStore.SchemeStore = &DebugBarLayerSchemeStore{SchemeStore: childStore.Scheme(), Root: &newStore} + newStore.SessionStore = &DebugBarLayerSessionStore{SessionStore: childStore.Session(), Root: &newStore} + newStore.SharedChannelStore = &DebugBarLayerSharedChannelStore{SharedChannelStore: childStore.SharedChannel(), Root: &newStore} + newStore.StatusStore = &DebugBarLayerStatusStore{StatusStore: childStore.Status(), Root: &newStore} + newStore.SystemStore = &DebugBarLayerSystemStore{SystemStore: childStore.System(), Root: &newStore} + newStore.TeamStore = &DebugBarLayerTeamStore{TeamStore: childStore.Team(), Root: &newStore} + newStore.TermsOfServiceStore = &DebugBarLayerTermsOfServiceStore{TermsOfServiceStore: childStore.TermsOfService(), Root: &newStore} + newStore.ThreadStore = &DebugBarLayerThreadStore{ThreadStore: childStore.Thread(), Root: &newStore} + newStore.TokenStore = &DebugBarLayerTokenStore{TokenStore: childStore.Token(), Root: &newStore} + newStore.TrueUpReviewStore = &DebugBarLayerTrueUpReviewStore{TrueUpReviewStore: childStore.TrueUpReview(), Root: &newStore} + newStore.UploadSessionStore = &DebugBarLayerUploadSessionStore{UploadSessionStore: childStore.UploadSession(), Root: &newStore} + newStore.UserStore = &DebugBarLayerUserStore{UserStore: childStore.User(), Root: &newStore} + newStore.UserAccessTokenStore = &DebugBarLayerUserAccessTokenStore{UserAccessTokenStore: childStore.UserAccessToken(), Root: &newStore} + newStore.UserTermsOfServiceStore = &DebugBarLayerUserTermsOfServiceStore{UserTermsOfServiceStore: childStore.UserTermsOfService(), Root: &newStore} + newStore.WebhookStore = &DebugBarLayerWebhookStore{WebhookStore: childStore.Webhook(), Root: &newStore} + return &newStore +} diff --git a/store/layer_generators/debugbar_layer.go.tmpl b/store/layer_generators/debugbar_layer.go.tmpl new file mode 100644 index 0000000000..aec1bb7fba --- /dev/null +++ b/store/layer_generators/debugbar_layer.go.tmpl @@ -0,0 +1,83 @@ +// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. +// See LICENSE.txt for license information. + +// Code generated by "make store-layers" +// DO NOT EDIT + +package debugbarlayer + +import ( + "context" + "time" + //"fmt" + + "github.com/mattermost/mattermost-server/v6/model" + "github.com/mattermost/mattermost-server/v6/app/platform/debugbar" + "github.com/mattermost/mattermost-server/v6/store" +) + +type {{.Name}} struct { + store.Store + debugBar *debugbar.DebugBar + eventPublish func(event *model.WebSocketEvent) +{{range $index, $element := .SubStores}} {{$index}}Store store.{{$index}}Store +{{end}} +} + +{{range $index, $element := .SubStores}}func (s *{{$.Name}}) {{$index}}() store.{{$index}}Store { + return s.{{$index}}Store +} + +{{end}} + +{{range $index, $element := .SubStores}}type {{$.Name}}{{$index}}Store struct { + store.{{$index}}Store + Root *{{$.Name}} +} + +{{end}} + +{{range $substoreName, $substore := .SubStores}} +{{range $index, $element := $substore.Methods}} +func (s *{{$.Name}}{{$substoreName}}Store) {{$index}}({{$element.Params | joinParamsWithType}}) {{$element.Results | joinResultsForSignature}} { + start := time.Now() + {{if $element.Results | len | eq 0}} + s.{{$substoreName}}Store.{{$index}}({{$element.Params | joinParams}}) + {{else}} + {{genResultsVars $element.Results false }} := s.{{$substoreName}}Store.{{$index}}({{$element.Params | joinParams}}) + {{end}} + elapsed := float64(time.Since(start)) / float64(time.Second) + success := false + if {{$element.Results | errorToBoolean}} { + success = true + } + + debugBarLayerParams := map[string]any{} + {{range $paramIndex, $param := $element.Params}} + debugBarLayerParams["{{$param.Name}}"] = {{$param.Name}} + {{end}} + s.Root.debugBar.SendStoreCall("{{$substoreName}}Store.{{$index}}", success, elapsed, debugBarLayerParams) + + {{ with (genResultsVars $element.Results false ) -}} + return {{ . }} + {{- end }} +} +{{end}} +{{end}} + +{{range $index, $element := .Methods}} +func (s *{{$.Name}}) {{$index}}({{$element.Params | joinParamsWithType}}) {{$element.Results | joinResultsForSignature}} { + {{if $element.Results | len | eq 0}}s.Store.{{$index}}({{$element.Params | joinParams}}) + {{else}}return s.Store.{{$index}}({{$element.Params | joinParams}}) + {{end}}} +{{end}} + +func New(childStore store.Store, debugBar *debugbar.DebugBar) *{{.Name}} { + newStore := {{.Name}}{ + Store: childStore, + debugBar: debugBar, + } + {{range $substoreName, $substore := .SubStores}} + newStore.{{$substoreName}}Store = &{{$.Name}}{{$substoreName}}Store{{"{"}}{{$substoreName}}Store: childStore.{{$substoreName}}(), Root: &newStore}{{end}} + return &newStore +} diff --git a/store/layer_generators/main.go b/store/layer_generators/main.go index cfb95abdb8..bc109eb633 100644 --- a/store/layer_generators/main.go +++ b/store/layer_generators/main.go @@ -28,6 +28,9 @@ func isError(typeName string) bool { } func main() { + if err := buildDebugBarLayer(); err != nil { + log.Fatal(err) + } if err := buildTimerLayer(); err != nil { log.Fatal(err) } @@ -65,6 +68,19 @@ func buildTimerLayer() error { return os.WriteFile(path.Join("timerlayer", "timerlayer.go"), formatedCode, 0644) } +func buildDebugBarLayer() error { + code, err := generateLayer("DebugBarLayer", "debugbar_layer.go.tmpl") + if err != nil { + return err + } + formatedCode, err := format.Source(code) + if err != nil { + return err + } + + return os.WriteFile(path.Join("debugbarlayer", "debugbarlayer.go"), formatedCode, 0644) +} + func buildOpenTracingLayer() error { code, err := generateLayer("OpenTracingLayer", "opentracing_layer.go.tmpl") if err != nil { diff --git a/store/localcachelayer/layer_test.go b/store/localcachelayer/layer_test.go index 16f01b837c..bdc12a20a1 100644 --- a/store/localcachelayer/layer_test.go +++ b/store/localcachelayer/layer_test.go @@ -98,7 +98,7 @@ func initStores() { go func() { var err error defer wg.Done() - st.SqlStore = sqlstore.New(*st.SqlSettings, nil) + st.SqlStore = sqlstore.New(*st.SqlSettings, nil, nil) st.Store, err = NewLocalCacheLayer(st.SqlStore, nil, nil, getMockCacheProvider()) if err != nil { panic(err) diff --git a/store/searchlayer/layer_test.go b/store/searchlayer/layer_test.go index cbc30409c7..d17191672e 100644 --- a/store/searchlayer/layer_test.go +++ b/store/searchlayer/layer_test.go @@ -24,7 +24,7 @@ func TestUpdateConfigRace(t *testing.T) { driverName = model.DatabaseDriverPostgres } settings := storetest.MakeSqlSettings(driverName, false) - store := sqlstore.New(*settings, nil) + store := sqlstore.New(*settings, nil, nil) cfg := &model.Config{} cfg.SetDefaults() diff --git a/store/sqlstore/sqlx_wrapper.go b/store/sqlstore/sqlx_wrapper.go index 3d215ff8a5..d001c43a65 100644 --- a/store/sqlstore/sqlx_wrapper.go +++ b/store/sqlstore/sqlx_wrapper.go @@ -64,15 +64,17 @@ var namedParamRegex = regexp.MustCompile(`:\w+`) type sqlxDBWrapper struct { *sqlx.DB - queryTimeout time.Duration - trace bool + queryTimeout time.Duration + trace bool + debugbarPublish func(string, float64, ...any) } -func newSqlxDBWrapper(db *sqlx.DB, timeout time.Duration, trace bool) *sqlxDBWrapper { +func newSqlxDBWrapper(db *sqlx.DB, timeout time.Duration, trace bool, debugbarPublish func(string, float64, ...any)) *sqlxDBWrapper { return &sqlxDBWrapper{ - DB: db, - queryTimeout: timeout, - trace: trace, + DB: db, + queryTimeout: timeout, + trace: trace, + debugbarPublish: debugbarPublish, } } @@ -86,7 +88,7 @@ func (w *sqlxDBWrapper) Beginx() (*sqlxTxWrapper, error) { return nil, err } - return newSqlxTxWrapper(tx, w.queryTimeout, w.trace), nil + return newSqlxTxWrapper(tx, w.queryTimeout, w.trace, w.debugbarPublish), nil } func (w *sqlxDBWrapper) BeginXWithIsolation(opts *sql.TxOptions) (*sqlxTxWrapper, error) { @@ -95,7 +97,7 @@ func (w *sqlxDBWrapper) BeginXWithIsolation(opts *sql.TxOptions) (*sqlxTxWrapper return nil, err } - return newSqlxTxWrapper(tx, w.queryTimeout, w.trace), nil + return newSqlxTxWrapper(tx, w.queryTimeout, w.trace, w.debugbarPublish), nil } func (w *sqlxDBWrapper) Get(dest any, query string, args ...any) error { @@ -108,6 +110,11 @@ func (w *sqlxDBWrapper) Get(dest any, query string, args ...any) error { printArgs(query, time.Since(then), args) }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } return w.DB.GetContext(ctx, dest, query, args...) } @@ -134,6 +141,12 @@ func (w *sqlxDBWrapper) NamedExec(query string, arg any) (sql.Result, error) { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), arg) + }(time.Now()) + } + return w.DB.NamedExecContext(ctx, query, arg) } @@ -161,6 +174,12 @@ func (w *sqlxDBWrapper) ExecNoTimeout(query string, args ...any) (sql.Result, er }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.DB.ExecContext(context.Background(), query, args...) } @@ -176,6 +195,12 @@ func (w *sqlxDBWrapper) ExecRaw(query string, args ...any) (sql.Result, error) { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.DB.ExecContext(ctx, query, args...) } @@ -192,6 +217,12 @@ func (w *sqlxDBWrapper) NamedQuery(query string, arg any) (*sqlx.Rows, error) { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), arg) + }(time.Now()) + } + return w.DB.NamedQueryContext(ctx, query, arg) } @@ -206,6 +237,12 @@ func (w *sqlxDBWrapper) QueryRowX(query string, args ...any) *sqlx.Row { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.DB.QueryRowxContext(ctx, query, args...) } @@ -220,6 +257,12 @@ func (w *sqlxDBWrapper) QueryX(query string, args ...any) (*sqlx.Rows, error) { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.DB.QueryxContext(ctx, query, args) } @@ -238,6 +281,12 @@ func (w *sqlxDBWrapper) SelectCtx(ctx context.Context, dest any, query string, a }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.DB.SelectContext(ctx, dest, query, args...) } @@ -252,15 +301,17 @@ func (w *sqlxDBWrapper) SelectBuilder(dest any, builder Builder) error { type sqlxTxWrapper struct { *sqlx.Tx - queryTimeout time.Duration - trace bool + queryTimeout time.Duration + trace bool + debugbarPublish func(string, float64, ...any) } -func newSqlxTxWrapper(tx *sqlx.Tx, timeout time.Duration, trace bool) *sqlxTxWrapper { +func newSqlxTxWrapper(tx *sqlx.Tx, timeout time.Duration, trace bool, debugbarPublish func(string, float64, ...any)) *sqlxTxWrapper { return &sqlxTxWrapper{ - Tx: tx, - queryTimeout: timeout, - trace: trace, + Tx: tx, + queryTimeout: timeout, + trace: trace, + debugbarPublish: debugbarPublish, } } @@ -275,6 +326,12 @@ func (w *sqlxTxWrapper) Get(dest any, query string, args ...any) error { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.Tx.GetContext(ctx, dest, query, args...) } @@ -302,6 +359,12 @@ func (w *sqlxTxWrapper) ExecNoTimeout(query string, args ...any) (sql.Result, er }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.Tx.ExecContext(context.Background(), query, args...) } @@ -326,6 +389,12 @@ func (w *sqlxTxWrapper) ExecRaw(query string, args ...any) (sql.Result, error) { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.Tx.ExecContext(ctx, query, args...) } @@ -342,6 +411,12 @@ func (w *sqlxTxWrapper) NamedExec(query string, arg any) (sql.Result, error) { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), arg) + }(time.Now()) + } + return w.Tx.NamedExecContext(ctx, query, arg) } @@ -358,6 +433,12 @@ func (w *sqlxTxWrapper) NamedQuery(query string, arg any) (*sqlx.Rows, error) { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), arg) + }(time.Now()) + } + // There is no tx.NamedQueryContext support in the sqlx API. (https://github.com/jmoiron/sqlx/issues/447) // So we need to implement this ourselves. type result struct { @@ -400,6 +481,12 @@ func (w *sqlxTxWrapper) QueryRowX(query string, args ...any) *sqlx.Row { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.Tx.QueryRowxContext(ctx, query, args...) } @@ -414,6 +501,12 @@ func (w *sqlxTxWrapper) QueryX(query string, args ...any) (*sqlx.Rows, error) { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.Tx.QueryxContext(ctx, query, args) } @@ -428,6 +521,12 @@ func (w *sqlxTxWrapper) Select(dest any, query string, args ...any) error { }(time.Now()) } + if w.debugbarPublish != nil { + defer func(then time.Time) { + w.debugbarPublish(query, float64(time.Since(then))/float64(time.Second), args...) + }(time.Now()) + } + return w.Tx.SelectContext(ctx, dest, query, args...) } diff --git a/store/sqlstore/store.go b/store/sqlstore/store.go index 0634e43bc5..b1acb84133 100644 --- a/store/sqlstore/store.go +++ b/store/sqlstore/store.go @@ -130,6 +130,7 @@ type SqlStore struct { replicaLagHandles []*dbsql.DB stores SqlStoreStores settings *model.SqlSettings + debugbarPublish func(string, float64, ...any) lockedToMaster bool context context.Context license *model.License @@ -140,12 +141,13 @@ type SqlStore struct { pgDefaultTextSearchConfig string } -func New(settings model.SqlSettings, metrics einterfaces.MetricsInterface) *SqlStore { +func New(settings model.SqlSettings, metrics einterfaces.MetricsInterface, debugbarPublish func(string, float64, ...any)) *SqlStore { store := &SqlStore{ - rrCounter: 0, - srCounter: 0, - settings: &settings, - metrics: metrics, + rrCounter: 0, + srCounter: 0, + settings: &settings, + metrics: metrics, + debugbarPublish: debugbarPublish, } store.initConnection() @@ -299,7 +301,9 @@ func (ss *SqlStore) initConnection() { handle := SetupConnection("master", dataSource, ss.settings) ss.masterX = newSqlxDBWrapper(sqlx.NewDb(handle, ss.DriverName()), time.Duration(*ss.settings.QueryTimeout)*time.Second, - *ss.settings.Trace) + *ss.settings.Trace, + ss.debugbarPublish, + ) if ss.DriverName() == model.DatabaseDriverMysql { ss.masterX.MapperFunc(noOpMapper) } @@ -313,7 +317,9 @@ func (ss *SqlStore) initConnection() { handle := SetupConnection(fmt.Sprintf("replica-%v", i), replica, ss.settings) ss.ReplicaXs[i] = newSqlxDBWrapper(sqlx.NewDb(handle, ss.DriverName()), time.Duration(*ss.settings.QueryTimeout)*time.Second, - *ss.settings.Trace) + *ss.settings.Trace, + ss.debugbarPublish, + ) if ss.DriverName() == model.DatabaseDriverMysql { ss.ReplicaXs[i].MapperFunc(noOpMapper) } @@ -329,7 +335,9 @@ func (ss *SqlStore) initConnection() { handle := SetupConnection(fmt.Sprintf("search-replica-%v", i), replica, ss.settings) ss.searchReplicaXs[i] = newSqlxDBWrapper(sqlx.NewDb(handle, ss.DriverName()), time.Duration(*ss.settings.QueryTimeout)*time.Second, - *ss.settings.Trace) + *ss.settings.Trace, + ss.debugbarPublish, + ) if ss.DriverName() == model.DatabaseDriverMysql { ss.searchReplicaXs[i].MapperFunc(noOpMapper) } @@ -434,7 +442,9 @@ func (ss *SqlStore) GetMasterX() *sqlxDBWrapper { func (ss *SqlStore) SetMasterX(db *sql.DB) { ss.masterX = newSqlxDBWrapper(sqlx.NewDb(db, ss.DriverName()), time.Duration(*ss.settings.QueryTimeout)*time.Second, - *ss.settings.Trace) + *ss.settings.Trace, + ss.debugbarPublish, + ) if ss.DriverName() == model.DatabaseDriverMysql { ss.masterX.MapperFunc(noOpMapper) } @@ -1284,3 +1294,17 @@ func (ss *SqlStore) GetAppliedMigrations() ([]model.AppliedMigration, error) { return migrations, nil } + +func (ss *SqlStore) Explain(query string, args []any) (string, error) { + var explain []string + + if strings.HasPrefix(query, "ANALYZE") { + return "", errors.New("not allowed to explain queries with analyze at the beginning") + } + + if err := ss.GetMasterX().Select(&explain, "EXPLAIN "+query, args...); err != nil { + return "", errors.Wrap(err, "unable to run the explain query") + } + + return strings.Join(explain, "\n"), nil +} diff --git a/store/sqlstore/store_test.go b/store/sqlstore/store_test.go index a24b984701..78e1ba1837 100644 --- a/store/sqlstore/store_test.go +++ b/store/sqlstore/store_test.go @@ -132,7 +132,7 @@ func initStores() { wg.Add(1) go func() { defer wg.Done() - st.SqlStore = New(*st.SqlSettings, nil) + st.SqlStore = New(*st.SqlSettings, nil, nil) st.Store = st.SqlStore st.Store.DropAllTables() st.Store.MarkSystemRanUnitTests() @@ -171,7 +171,7 @@ func tearDownStores() { // Keeping it here to help avoiding future regressions. func TestStoreLicenseRace(t *testing.T) { settings := makeSqlSettings(model.DatabaseDriverPostgres) - store := New(*settings, nil) + store := New(*settings, nil, nil) defer func() { store.Close() storetest.CleanupSqlSettings(settings) @@ -268,7 +268,7 @@ func TestGetReplica(t *testing.T) { settings.DataSourceReplicas = dataSourceReplicas settings.DataSourceSearchReplicas = dataSourceSearchReplicas - store := New(*settings, nil) + store := New(*settings, nil, nil) defer func() { store.Close() storetest.CleanupSqlSettings(settings) @@ -338,7 +338,7 @@ func TestGetReplica(t *testing.T) { settings.DataSourceReplicas = dataSourceReplicas settings.DataSourceSearchReplicas = dataSourceSearchReplicas - store := New(*settings, nil) + store := New(*settings, nil, nil) defer func() { store.Close() storetest.CleanupSqlSettings(settings) @@ -402,7 +402,7 @@ func TestGetDbVersion(t *testing.T) { t.Run("Should return db version for "+driver, func(t *testing.T) { t.Parallel() settings := makeSqlSettings(driver) - store := New(*settings, nil) + store := New(*settings, nil, nil) version, err := store.GetDbVersion(false) require.NoError(t, err) @@ -546,7 +546,7 @@ func TestUpAndDownMigrations(t *testing.T) { for _, driver := range testDrivers { t.Run("Should be reversible for "+driver, func(t *testing.T) { settings := makeSqlSettings(driver) - store := New(*settings, nil) + store := New(*settings, nil, nil) defer store.Close() err := store.migrate(migrationsDirectionDown) @@ -635,7 +635,7 @@ func TestGetAllConns(t *testing.T) { settings.DataSourceReplicas = dataSourceReplicas settings.DataSourceSearchReplicas = dataSourceSearchReplicas - store := New(*settings, nil) + store := New(*settings, nil, nil) defer func() { store.Close() storetest.CleanupSqlSettings(settings) @@ -819,7 +819,7 @@ func TestGetDBSchemaVersion(t *testing.T) { t.Run("Should return latest version number of applied migrations for "+driver, func(t *testing.T) { t.Parallel() settings := makeSqlSettings(driver) - store := New(*settings, nil) + store := New(*settings, nil, nil) assetsList, err := assets.ReadDir(filepath.Join("migrations", driver)) require.NoError(t, err) @@ -853,7 +853,7 @@ func TestGetAppliedMigrations(t *testing.T) { t.Run("Should return db applied migrations for "+driver, func(t *testing.T) { t.Parallel() settings := makeSqlSettings(driver) - store := New(*settings, nil) + store := New(*settings, nil, nil) assetsList, err := assets.ReadDir(filepath.Join("migrations", driver)) require.NoError(t, err) diff --git a/store/store.go b/store/store.go index bfebe49e19..2886aeda28 100644 --- a/store/store.go +++ b/store/store.go @@ -88,6 +88,7 @@ type Store interface { PostPriority() PostPriorityStore PostAcknowledgement() PostAcknowledgementStore TrueUpReview() TrueUpReviewStore + Explain(query string, args []interface{}) (string, error) } type RetentionPolicyStore interface { diff --git a/store/storetest/mocks/Store.go b/store/storetest/mocks/Store.go index fc22cd3545..45071bf3d0 100644 --- a/store/storetest/mocks/Store.go +++ b/store/storetest/mocks/Store.go @@ -224,6 +224,27 @@ func (_m *Store) Emoji() store.EmojiStore { return r0 } +// Explain provides a mock function with given fields: query, args +func (_m *Store) Explain(query string, args []interface{}) (string, error) { + ret := _m.Called(query, args) + + var r0 string + if rf, ok := ret.Get(0).(func(string, []interface{}) string); ok { + r0 = rf(query, args) + } else { + r0 = ret.Get(0).(string) + } + + var r1 error + if rf, ok := ret.Get(1).(func(string, []interface{}) error); ok { + r1 = rf(query, args) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // FileInfo provides a mock function with given fields: func (_m *Store) FileInfo() store.FileInfoStore { ret := _m.Called() diff --git a/store/storetest/store.go b/store/storetest/store.go index 683ea3fbf8..f27c8a3b25 100644 --- a/store/storetest/store.go +++ b/store/storetest/store.go @@ -133,6 +133,8 @@ func (s *Store) CheckIntegrity() <-chan model.IntegrityCheckResult { func (s *Store) ReplicaLagAbs() error { return nil } func (s *Store) ReplicaLagTime() error { return nil } +func (s *Store) Explain(query string, args []any) (string, error) { return "", nil } + func (s *Store) AssertExpectations(t mock.TestingT) bool { return mock.AssertExpectationsForObjects(t, &s.TeamStore, diff --git a/testlib/helper.go b/testlib/helper.go index e4b4021404..d38fb764a0 100644 --- a/testlib/helper.go +++ b/testlib/helper.go @@ -103,7 +103,7 @@ func (h *MainHelper) setupStore(withReadReplica bool) { h.SearchEngine = searchengine.NewBroker(config) h.ClusterInterface = &FakeClusterInterface{} - h.SQLStore = sqlstore.New(*h.Settings, nil) + h.SQLStore = sqlstore.New(*h.Settings, nil, nil) h.Store = searchlayer.NewSearchLayer(&TestStore{ h.SQLStore, }, h.SearchEngine, config) @@ -115,7 +115,7 @@ func (h *MainHelper) ToggleReplicasOff() { } h.Settings.DataSourceReplicas = []string{} lic := h.SQLStore.GetLicense() - h.SQLStore = sqlstore.New(*h.Settings, nil) + h.SQLStore = sqlstore.New(*h.Settings, nil, nil) h.SQLStore.UpdateLicense(lic) } @@ -125,7 +125,7 @@ func (h *MainHelper) ToggleReplicasOn() { } h.Settings.DataSourceReplicas = h.replicas lic := h.SQLStore.GetLicense() - h.SQLStore = sqlstore.New(*h.Settings, nil) + h.SQLStore = sqlstore.New(*h.Settings, nil, nil) h.SQLStore.UpdateLicense(lic) } diff --git a/web/handlers.go b/web/handlers.go index b2d49742ab..cc8fdadac6 100644 --- a/web/handlers.go +++ b/web/handlers.go @@ -401,6 +401,20 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { } statusCode = strconv.Itoa(w.(*responseWriterWrapper).StatusCode()) + + if c.App.Srv().DebugBar().IsEnabled() { + elapsed := float64(time.Since(now)) / float64(time.Second) + var endpoint string + if strings.HasPrefix(r.URL.Path, model.APIURLSuffixV5) { + // It's a graphQL query, so use the operation name. + endpoint = c.GraphQLOperationName + } else { + endpoint = h.HandlerName + } + + c.App.Srv().DebugBar().SendApiCall(endpoint, r.Method, statusCode, elapsed) + } + if c.App.Metrics() != nil { c.App.Metrics().IncrementHTTPRequest()