Documentation ¶
Index ¶
- Constants
- func BatchDisableUsers(ctx context.Context, cmd *models.BatchDisableUsersCommand) error
- func ChangeUserPassword(ctx context.Context, cmd *models.ChangeUserPasswordCommand) error
- func CreateLoginAttempt(ctx context.Context, cmd *models.CreateLoginAttemptCommand) error
- func CreateOrg(ctx context.Context, cmd *models.CreateOrgCommand) error
- func DeleteDashboard(ctx context.Context, cmd *models.DeleteDashboardCommand) error
- func DeleteOldLoginAttempts(ctx context.Context, cmd *models.DeleteOldLoginAttemptsCommand) error
- func DeleteOrg(ctx context.Context, cmd *models.DeleteOrgCommand) error
- func DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
- func DeleteTeam(ctx context.Context, cmd *models.DeleteTeamCommand) error
- func DeleteUser(ctx context.Context, cmd *models.DeleteUserCommand) error
- func DisableUser(ctx context.Context, cmd *models.DisableUserCommand) error
- func EnsureTagsExist(sess *DBSession, tags []*models.Tag) ([]*models.Tag, error)
- func GetAdminStats(ctx context.Context, query *models.GetAdminStatsQuery) error
- func GetAlertNotifiersUsageStats(ctx context.Context, query *models.GetAlertNotifierUsageStatsQuery) error
- func GetAlertsByDashboardId2(dashboardId int64, sess *DBSession) ([]*models.Alert, error)
- func GetDBHealthQuery(ctx context.Context, query *models.GetDBHealthQuery) error
- func GetDashboard(ctx context.Context, query *models.GetDashboardQuery) error
- func GetDashboardPermissionsForUser(ctx context.Context, query *models.GetDashboardPermissionsForUserQuery) error
- func GetDashboardSlugById(ctx context.Context, query *models.GetDashboardSlugByIdQuery) error
- func GetDashboardTags(ctx context.Context, query *models.GetDashboardTagsQuery) error
- func GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error
- func GetDashboardsByPluginId(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error
- func GetDashboardsBySlug(ctx context.Context, query *models.GetDashboardsBySlugQuery) error
- func GetDataSourceAccessStats(ctx context.Context, query *models.GetDataSourceAccessStatsQuery) error
- func GetDataSourceStats(ctx context.Context, query *models.GetDataSourceStatsQuery) error
- func GetOrgById(ctx context.Context, query *models.GetOrgByIdQuery) error
- func GetOrgByName(ctx context.Context, query *models.GetOrgByNameQuery) error
- func GetSignedInUser(ctx context.Context, query *models.GetSignedInUserQuery) error
- func GetSystemStats(ctx context.Context, query *models.GetSystemStatsQuery) error
- func GetSystemUserCountStats(ctx context.Context, query *models.GetSystemUserCountStatsQuery) error
- func GetTeamById(ctx context.Context, query *models.GetTeamByIdQuery) error
- func GetTeamMembers(ctx context.Context, query *models.GetTeamMembersQuery) error
- func GetTeamsByUser(ctx context.Context, query *models.GetTeamsByUserQuery) error
- func GetUserById(ctx context.Context, query *models.GetUserByIdQuery) error
- func GetUserLoginAttemptCount(ctx context.Context, query *models.GetUserLoginAttemptCountQuery) error
- func GetUserOrgList(ctx context.Context, query *models.GetUserOrgListQuery) error
- func HasAdminPermissionInFolders(ctx context.Context, query *models.HasAdminPermissionInFoldersQuery) error
- func HasEditPermissionInFolders(ctx context.Context, query *models.HasEditPermissionInFoldersQuery) error
- func IsAdminOfTeams(ctx context.Context, query *models.IsAdminOfTeamsQuery) error
- func IsTestDBMSSQL() bool
- func IsTestDbMySQL() bool
- func IsTestDbPostgres() bool
- func PauseAlert(ctx context.Context, cmd *models.PauseAlertCommand) error
- func PauseAllAlerts(ctx context.Context, cmd *models.PauseAllAlertCommand) error
- func RemoveTeamMember(ctx context.Context, cmd *models.RemoveTeamMemberCommand) error
- func SaveAlerts(ctx context.Context, cmd *models.SaveAlertsCommand) error
- func SearchOrgs(ctx context.Context, query *models.SearchOrgsQuery) error
- func SearchTeams(ctx context.Context, query *models.SearchTeamsQuery) error
- func SearchUsers(ctx context.Context, query *models.SearchUsersQuery) error
- func ServiceAccountDeletions() []string
- func SetUserHelpFlag(ctx context.Context, cmd *models.SetUserHelpFlagCommand) error
- func SetUsingOrg(ctx context.Context, cmd *models.SetUsingOrgCommand) error
- func UnprovisionDashboard(ctx context.Context, cmd *models.UnprovisionDashboardCommand) error
- func UpdateOrg(ctx context.Context, cmd *models.UpdateOrgCommand) error
- func UpdateOrgAddress(ctx context.Context, cmd *models.UpdateOrgAddressCommand) error
- func UpdateTeam(ctx context.Context, cmd *models.UpdateTeamCommand) error
- func UpdateTeamMember(ctx context.Context, cmd *models.UpdateTeamMemberCommand) error
- func UpdateUser(ctx context.Context, cmd *models.UpdateUserCommand) error
- func UpdateUserLastSeenAt(ctx context.Context, cmd *models.UpdateUserLastSeenAtCommand) error
- func WrapDatabaseDriverWithHooks(dbType string) string
- type AnnotationCleanupService
- type ContextSessionKey
- type DBSession
- type DashboardExtras
- type DashboardSearchProjection
- type DashboardSlugDTO
- type DashboardTag
- type DatabaseConfig
- type ITestDB
- type InitTestDBOpt
- type SQLAnnotationRepo
- func (r *SQLAnnotationRepo) Delete(params *annotations.DeleteParams) error
- func (r *SQLAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.ItemDTO, error)
- func (r *SQLAnnotationRepo) FindTags(query *annotations.TagsQuery) (annotations.FindTagsResult, error)
- func (r *SQLAnnotationRepo) Save(item *annotations.Item) error
- func (r *SQLAnnotationRepo) Update(item *annotations.Item) error
- type SQLBuilder
- func (sb *SQLBuilder) AddParams(params ...interface{})
- func (sb *SQLBuilder) GetParams() []interface{}
- func (sb *SQLBuilder) GetSQLString() string
- func (sb *SQLBuilder) Write(sql string, params ...interface{})
- func (sb *SQLBuilder) WriteDashboardPermissionFilter(user *models.SignedInUser, permission models.PermissionType)
- type SQLStore
- func InitTestDB(t ITestDB, opts ...InitTestDBOpt) *SQLStore
- func InitTestDBWithMigration(t ITestDB, migration registry.DatabaseMigrator, opts ...InitTestDBOpt) *SQLStore
- func ProvideService(cfg *setting.Cfg, cacheService *localcache.CacheService, bus bus.Bus, ...) (*SQLStore, error)
- func ProvideServiceForTests(migrations registry.DatabaseMigrator) (*SQLStore, error)
- func (ss *SQLStore) AddAPIKey(ctx context.Context, cmd *models.AddApiKeyCommand) error
- func (ss *SQLStore) AddDataSource(ctx context.Context, cmd *models.AddDataSourceCommand) error
- func (ss *SQLStore) AddOrgUser(ctx context.Context, cmd *models.AddOrgUserCommand) error
- func (ss *SQLStore) AddTeamMember(userID, orgID, teamID int64, isExternal bool, permission models.PermissionType) error
- func (ss *SQLStore) CloneUserToServiceAccount(ctx context.Context, siUser *models.SignedInUser) (*models.User, error)
- func (ss *SQLStore) CreateAlertNotificationCommand(ctx context.Context, cmd *models.CreateAlertNotificationCommand) error
- func (ss *SQLStore) CreateDashboardSnapshot(cmd *models.CreateDashboardSnapshotCommand) error
- func (ss *SQLStore) CreateOrgWithMember(name string, userID int64) (models.Org, error)
- func (ss *SQLStore) CreatePlaylist(ctx context.Context, cmd *models.CreatePlaylistCommand) error
- func (ss *SQLStore) CreateTeam(name, email string, orgID int64) (models.Team, error)
- func (ss *SQLStore) CreateTempUser(ctx context.Context, cmd *models.CreateTempUserCommand) error
- func (ss *SQLStore) CreateUser(ctx context.Context, cmd models.CreateUserCommand) (*models.User, error)
- func (ss *SQLStore) DeleteAlertNotification(ctx context.Context, cmd *models.DeleteAlertNotificationCommand) error
- func (ss *SQLStore) DeleteAlertNotificationWithUid(ctx context.Context, cmd *models.DeleteAlertNotificationWithUidCommand) error
- func (ss *SQLStore) DeleteApiKey(ctx context.Context, cmd *models.DeleteApiKeyCommand) error
- func (ss *SQLStore) DeleteDashboardSnapshot(cmd *models.DeleteDashboardSnapshotCommand) error
- func (ss *SQLStore) DeleteDataSource(ctx context.Context, cmd *models.DeleteDataSourceCommand) error
- func (ss *SQLStore) DeleteExpiredSnapshots(cmd *models.DeleteExpiredSnapshotsCommand) error
- func (ss *SQLStore) DeleteExpiredVersions(ctx context.Context, cmd *models.DeleteExpiredVersionsCommand) error
- func (ss *SQLStore) DeletePlaylist(ctx context.Context, cmd *models.DeletePlaylistCommand) error
- func (ss *SQLStore) ExpireOldUserInvites(ctx context.Context, cmd *models.ExpireTempUsersCommand) error
- func (ss *SQLStore) GetAPIKeys(ctx context.Context, query *models.GetApiKeysQuery) error
- func (ss *SQLStore) GetAlertById(ctx context.Context, query *models.GetAlertByIdQuery) error
- func (ss *SQLStore) GetAlertNotificationUidWithId(ctx context.Context, query *models.GetAlertNotificationUidQuery) error
- func (ss *SQLStore) GetAlertNotifications(ctx context.Context, query *models.GetAlertNotificationsQuery) error
- func (ss *SQLStore) GetAlertNotificationsWithUid(ctx context.Context, query *models.GetAlertNotificationsWithUidQuery) error
- func (ss *SQLStore) GetAlertNotificationsWithUidToSend(ctx context.Context, query *models.GetAlertNotificationsWithUidToSendQuery) error
- func (ss *SQLStore) GetAlertStatesForDashboard(ctx context.Context, query *models.GetAlertStatesForDashboardQuery) error
- func (ss *SQLStore) GetAllAlertNotifications(ctx context.Context, query *models.GetAllAlertNotificationsQuery) error
- func (ss *SQLStore) GetAllAlertQueryHandler(ctx context.Context, query *models.GetAllAlertsQuery) error
- func (ss *SQLStore) GetApiKeyById(ctx context.Context, query *models.GetApiKeyByIdQuery) error
- func (ss *SQLStore) GetApiKeyByName(ctx context.Context, query *models.GetApiKeyByNameQuery) error
- func (ss *SQLStore) GetDashboard(id, orgID int64, uid, slug string) (*models.Dashboard, error)
- func (ss *SQLStore) GetDashboardAclInfoList(ctx context.Context, query *models.GetDashboardAclInfoListQuery) error
- func (ss *SQLStore) GetDashboardSnapshot(query *models.GetDashboardSnapshotQuery) error
- func (ss *SQLStore) GetDashboardUIDById(ctx context.Context, query *models.GetDashboardRefByIdQuery) error
- func (ss *SQLStore) GetDashboardVersion(ctx context.Context, query *models.GetDashboardVersionQuery) error
- func (ss *SQLStore) GetDashboardVersions(ctx context.Context, query *models.GetDashboardVersionsQuery) error
- func (ss *SQLStore) GetDataSource(ctx context.Context, query *models.GetDataSourceQuery) error
- func (ss *SQLStore) GetDataSources(query *models.GetDataSourcesQuery) error
- func (ss *SQLStore) GetDataSourcesByType(query *models.GetDataSourcesByTypeQuery) error
- func (ss *SQLStore) GetDefaultDataSource(query *models.GetDefaultDataSourceQuery) error
- func (ss *SQLStore) GetFolderByTitle(orgID int64, title string) (*models.Dashboard, error)
- func (ss *SQLStore) GetGlobalQuotaByTarget(ctx context.Context, query *models.GetGlobalQuotaByTargetQuery) error
- func (ss *SQLStore) GetOrCreateAlertNotificationState(ctx context.Context, cmd *models.GetOrCreateNotificationStateQuery) error
- func (ss *SQLStore) GetOrgByName(name string) (*models.Org, error)
- func (ss *SQLStore) GetOrgQuotaByTarget(ctx context.Context, query *models.GetOrgQuotaByTargetQuery) error
- func (ss *SQLStore) GetOrgQuotas(ctx context.Context, query *models.GetOrgQuotasQuery) error
- func (ss *SQLStore) GetOrgUsers(ctx context.Context, query *models.GetOrgUsersQuery) error
- func (ss *SQLStore) GetPlaylist(ctx context.Context, query *models.GetPlaylistByIdQuery) error
- func (ss *SQLStore) GetPlaylistItem(ctx context.Context, query *models.GetPlaylistItemsByIdQuery) error
- func (ss *SQLStore) GetPluginSettingById(ctx context.Context, query *models.GetPluginSettingByIdQuery) error
- func (ss *SQLStore) GetPluginSettings(ctx context.Context, orgID int64) ([]*models.PluginSettingInfoDTO, error)
- func (ss *SQLStore) GetPreferences(ctx context.Context, query *models.GetPreferencesQuery) error
- func (ss *SQLStore) GetPreferencesWithDefaults(ctx context.Context, query *models.GetPreferencesWithDefaultsQuery) error
- func (ss *SQLStore) GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error)
- func (ss *SQLStore) GetProvisionedDataByDashboardID(dashboardID int64) (*models.DashboardProvisioning, error)
- func (ss *SQLStore) GetSignedInUserWithCacheCtx(ctx context.Context, query *models.GetSignedInUserQuery) error
- func (ss *SQLStore) GetTempUserByCode(ctx context.Context, query *models.GetTempUserByCodeQuery) error
- func (ss *SQLStore) GetTempUsersQuery(ctx context.Context, query *models.GetTempUsersQuery) error
- func (ss *SQLStore) GetUserByEmail(ctx context.Context, query *models.GetUserByEmailQuery) error
- func (ss *SQLStore) GetUserByLogin(ctx context.Context, query *models.GetUserByLoginQuery) error
- func (ss *SQLStore) GetUserProfile(ctx context.Context, query *models.GetUserProfileQuery) error
- func (ss *SQLStore) GetUserQuotaByTarget(ctx context.Context, query *models.GetUserQuotaByTargetQuery) error
- func (ss *SQLStore) GetUserQuotas(ctx context.Context, query *models.GetUserQuotasQuery) error
- func (ss *SQLStore) GetUserStars(ctx context.Context, query *models.GetUserStarsQuery) error
- func (ss *SQLStore) HandleAlertsQuery(ctx context.Context, query *models.GetAlertsQuery) error
- func (ss *SQLStore) InTransaction(ctx context.Context, fn func(ctx context.Context) error) error
- func (ss *SQLStore) IsStarredByUserCtx(ctx context.Context, query *models.IsStarredByUserQuery) error
- func (ss *SQLStore) Migrate() error
- func (ss *SQLStore) NewSession(ctx context.Context) *DBSession
- func (ss *SQLStore) Quote(value string) string
- func (ss *SQLStore) RemoveOrgUser(ctx context.Context, cmd *models.RemoveOrgUserCommand) error
- func (ss *SQLStore) Reset() error
- func (ss *SQLStore) SaveAlerts(ctx context.Context, dashID int64, alerts []*models.Alert) error
- func (ss *SQLStore) SaveDashboard(cmd models.SaveDashboardCommand) (*models.Dashboard, error)
- func (ss *SQLStore) SavePreferences(ctx context.Context, cmd *models.SavePreferencesCommand) error
- func (ss *SQLStore) SaveProvisionedDashboard(cmd models.SaveDashboardCommand, provisioning *models.DashboardProvisioning) (*models.Dashboard, error)
- func (ss *SQLStore) SearchDashboardSnapshots(query *models.GetDashboardSnapshotsQuery) error
- func (ss *SQLStore) SearchDashboards(ctx context.Context, query *search.FindPersistedDashboardsQuery) error
- func (ss *SQLStore) SearchOrgUsers(ctx context.Context, query *models.SearchOrgUsersQuery) error
- func (ss *SQLStore) SearchPlaylists(ctx context.Context, query *models.GetPlaylistsQuery) error
- func (ss *SQLStore) SetAlertNotificationStateToCompleteCommand(ctx context.Context, cmd *models.SetAlertNotificationStateToCompleteCommand) error
- func (ss *SQLStore) SetAlertNotificationStateToPendingCommand(ctx context.Context, cmd *models.SetAlertNotificationStateToPendingCommand) error
- func (ss *SQLStore) SetAlertState(ctx context.Context, cmd *models.SetAlertStateCommand) error
- func (ss *SQLStore) StarDashboard(ctx context.Context, cmd *models.StarDashboardCommand) error
- func (ss *SQLStore) Sync() error
- func (ss *SQLStore) UnstarDashboard(ctx context.Context, cmd *models.UnstarDashboardCommand) error
- func (ss *SQLStore) UpdateAlertNotification(ctx context.Context, cmd *models.UpdateAlertNotificationCommand) error
- func (ss *SQLStore) UpdateAlertNotificationWithUid(ctx context.Context, cmd *models.UpdateAlertNotificationWithUidCommand) error
- func (ss *SQLStore) UpdateDashboardACL(dashboardID int64, items []*models.DashboardAcl) error
- func (ss *SQLStore) UpdateDashboardACLCtx(ctx context.Context, dashboardID int64, items []*models.DashboardAcl) error
- func (ss *SQLStore) UpdateDataSource(ctx context.Context, cmd *models.UpdateDataSourceCommand) error
- func (ss *SQLStore) UpdateOrgQuota(ctx context.Context, cmd *models.UpdateOrgQuotaCmd) error
- func (ss *SQLStore) UpdateOrgUser(ctx context.Context, cmd *models.UpdateOrgUserCommand) error
- func (ss *SQLStore) UpdatePlaylist(ctx context.Context, cmd *models.UpdatePlaylistCommand) error
- func (ss *SQLStore) UpdatePluginSetting(ctx context.Context, cmd *models.UpdatePluginSettingCmd) error
- func (ss *SQLStore) UpdatePluginSettingVersion(ctx context.Context, cmd *models.UpdatePluginSettingVersionCmd) error
- func (ss *SQLStore) UpdateTempUserStatus(ctx context.Context, cmd *models.UpdateTempUserStatusCommand) error
- func (ss *SQLStore) UpdateTempUserWithEmailSent(ctx context.Context, cmd *models.UpdateTempUserWithEmailSentCommand) error
- func (ss *SQLStore) UpdateUserPermissions(userID int64, isAdmin bool) error
- func (ss *SQLStore) UpdateUserQuota(ctx context.Context, cmd *models.UpdateUserQuotaCmd) error
- func (ss *SQLStore) ValidateDashboardBeforeSave(dashboard *models.Dashboard, overwrite bool) (bool, error)
- func (ss *SQLStore) WithDbSession(ctx context.Context, callback dbTransactionFunc) error
- func (ss *SQLStore) WithTransactionalDbSession(ctx context.Context, callback dbTransactionFunc) error
- type XormLogger
- func (s *XormLogger) Debug(v ...interface{})
- func (s *XormLogger) Debugf(format string, v ...interface{})
- func (s *XormLogger) Error(v ...interface{})
- func (s *XormLogger) Errorf(format string, v ...interface{})
- func (s *XormLogger) Info(v ...interface{})
- func (s *XormLogger) Infof(format string, v ...interface{})
- func (s *XormLogger) IsShowSQL() bool
- func (s *XormLogger) Level() core.LogLevel
- func (s *XormLogger) SetLevel(l core.LogLevel)
- func (s *XormLogger) ShowSQL(show ...bool)
- func (s *XormLogger) Warn(v ...interface{})
- func (s *XormLogger) Warnf(format string, v ...interface{})
Constants ¶
const MAX_VERSIONS_TO_DELETE_PER_BATCH = 100
const MAX_VERSION_DELETION_BATCHES = 50
const MainOrgName = "Main Org."
MainOrgName is the name of the main organization.
Variables ¶
This section is empty.
Functions ¶
func BatchDisableUsers ¶
func BatchDisableUsers(ctx context.Context, cmd *models.BatchDisableUsersCommand) error
func ChangeUserPassword ¶
func ChangeUserPassword(ctx context.Context, cmd *models.ChangeUserPasswordCommand) error
func CreateLoginAttempt ¶
func CreateLoginAttempt(ctx context.Context, cmd *models.CreateLoginAttemptCommand) error
func DeleteDashboard ¶
func DeleteDashboard(ctx context.Context, cmd *models.DeleteDashboardCommand) error
func DeleteOldLoginAttempts ¶
func DeleteOldLoginAttempts(ctx context.Context, cmd *models.DeleteOldLoginAttemptsCommand) error
func DeleteOrphanedProvisionedDashboards ¶
func DeleteOrphanedProvisionedDashboards(ctx context.Context, cmd *models.DeleteOrphanedProvisionedDashboardsCommand) error
func DeleteTeam ¶
func DeleteTeam(ctx context.Context, cmd *models.DeleteTeamCommand) error
DeleteTeam will delete a team, its member and any permissions connected to the team
func DeleteUser ¶
func DeleteUser(ctx context.Context, cmd *models.DeleteUserCommand) error
func DisableUser ¶
func DisableUser(ctx context.Context, cmd *models.DisableUserCommand) error
func EnsureTagsExist ¶
Will insert if needed any new key/value pars and return ids
func GetAdminStats ¶
func GetAdminStats(ctx context.Context, query *models.GetAdminStatsQuery) error
func GetAlertNotifiersUsageStats ¶
func GetAlertNotifiersUsageStats(ctx context.Context, query *models.GetAlertNotifierUsageStatsQuery) error
func GetAlertsByDashboardId2 ¶
func GetDBHealthQuery ¶
func GetDBHealthQuery(ctx context.Context, query *models.GetDBHealthQuery) error
GetDBHealthQuery executes a query to check the availability of the database.
func GetDashboard ¶
func GetDashboard(ctx context.Context, query *models.GetDashboardQuery) error
func GetDashboardPermissionsForUser ¶
func GetDashboardPermissionsForUser(ctx context.Context, query *models.GetDashboardPermissionsForUserQuery) error
GetDashboardPermissionsForUser returns the maximum permission the specified user has for a dashboard(s) The function takes in a list of dashboard ids and the user id and role
func GetDashboardSlugById ¶
func GetDashboardSlugById(ctx context.Context, query *models.GetDashboardSlugByIdQuery) error
func GetDashboardTags ¶
func GetDashboardTags(ctx context.Context, query *models.GetDashboardTagsQuery) error
func GetDashboards ¶
func GetDashboards(ctx context.Context, query *models.GetDashboardsQuery) error
func GetDashboardsByPluginId ¶
func GetDashboardsByPluginId(ctx context.Context, query *models.GetDashboardsByPluginIdQuery) error
func GetDashboardsBySlug ¶
func GetDashboardsBySlug(ctx context.Context, query *models.GetDashboardsBySlugQuery) error
func GetDataSourceAccessStats ¶
func GetDataSourceAccessStats(ctx context.Context, query *models.GetDataSourceAccessStatsQuery) error
func GetDataSourceStats ¶
func GetDataSourceStats(ctx context.Context, query *models.GetDataSourceStatsQuery) error
func GetOrgById ¶
func GetOrgById(ctx context.Context, query *models.GetOrgByIdQuery) error
func GetOrgByName ¶
func GetOrgByName(ctx context.Context, query *models.GetOrgByNameQuery) error
func GetSignedInUser ¶
func GetSignedInUser(ctx context.Context, query *models.GetSignedInUserQuery) error
func GetSystemStats ¶
func GetSystemStats(ctx context.Context, query *models.GetSystemStatsQuery) error
func GetSystemUserCountStats ¶
func GetSystemUserCountStats(ctx context.Context, query *models.GetSystemUserCountStatsQuery) error
func GetTeamById ¶
func GetTeamById(ctx context.Context, query *models.GetTeamByIdQuery) error
func GetTeamMembers ¶
func GetTeamMembers(ctx context.Context, query *models.GetTeamMembersQuery) error
GetTeamMembers return a list of members for the specified team
func GetTeamsByUser ¶
func GetTeamsByUser(ctx context.Context, query *models.GetTeamsByUserQuery) error
GetTeamsByUser is used by the Guardian when checking a users' permissions
func GetUserById ¶
func GetUserById(ctx context.Context, query *models.GetUserByIdQuery) error
func GetUserLoginAttemptCount ¶
func GetUserLoginAttemptCount(ctx context.Context, query *models.GetUserLoginAttemptCountQuery) error
func GetUserOrgList ¶
func GetUserOrgList(ctx context.Context, query *models.GetUserOrgListQuery) error
func HasAdminPermissionInFolders ¶
func HasAdminPermissionInFolders(ctx context.Context, query *models.HasAdminPermissionInFoldersQuery) error
func HasEditPermissionInFolders ¶
func HasEditPermissionInFolders(ctx context.Context, query *models.HasEditPermissionInFoldersQuery) error
HasEditPermissionInFolders validates that an user have access to a certain folder
func IsAdminOfTeams ¶
func IsAdminOfTeams(ctx context.Context, query *models.IsAdminOfTeamsQuery) error
func IsTestDBMSSQL ¶
func IsTestDBMSSQL() bool
func IsTestDbMySQL ¶
func IsTestDbMySQL() bool
func IsTestDbPostgres ¶
func IsTestDbPostgres() bool
func PauseAlert ¶
func PauseAlert(ctx context.Context, cmd *models.PauseAlertCommand) error
func PauseAllAlerts ¶
func PauseAllAlerts(ctx context.Context, cmd *models.PauseAllAlertCommand) error
func RemoveTeamMember ¶
func RemoveTeamMember(ctx context.Context, cmd *models.RemoveTeamMemberCommand) error
RemoveTeamMember removes a member from a team
func SaveAlerts ¶
func SaveAlerts(ctx context.Context, cmd *models.SaveAlertsCommand) error
func SearchOrgs ¶
func SearchOrgs(ctx context.Context, query *models.SearchOrgsQuery) error
func SearchTeams ¶
func SearchTeams(ctx context.Context, query *models.SearchTeamsQuery) error
func SearchUsers ¶
func SearchUsers(ctx context.Context, query *models.SearchUsersQuery) error
func ServiceAccountDeletions ¶
func ServiceAccountDeletions() []string
func SetUserHelpFlag ¶
func SetUserHelpFlag(ctx context.Context, cmd *models.SetUserHelpFlagCommand) error
func SetUsingOrg ¶
func SetUsingOrg(ctx context.Context, cmd *models.SetUsingOrgCommand) error
func UnprovisionDashboard ¶
func UnprovisionDashboard(ctx context.Context, cmd *models.UnprovisionDashboardCommand) error
UnprovisionDashboard removes row in dashboard_provisioning for the dashboard making it seem as if manually created. The dashboard will still have `created_by = -1` to see it was not created by any particular user.
func UpdateOrgAddress ¶
func UpdateOrgAddress(ctx context.Context, cmd *models.UpdateOrgAddressCommand) error
func UpdateTeam ¶
func UpdateTeam(ctx context.Context, cmd *models.UpdateTeamCommand) error
func UpdateTeamMember ¶
func UpdateTeamMember(ctx context.Context, cmd *models.UpdateTeamMemberCommand) error
UpdateTeamMember updates a team member
func UpdateUser ¶
func UpdateUser(ctx context.Context, cmd *models.UpdateUserCommand) error
func UpdateUserLastSeenAt ¶
func UpdateUserLastSeenAt(ctx context.Context, cmd *models.UpdateUserLastSeenAtCommand) error
func WrapDatabaseDriverWithHooks ¶
WrapDatabaseDriverWithHooks creates a fake database driver that executes pre and post functions which we use to gather metrics about database queries. It also registers the metrics.
Types ¶
type AnnotationCleanupService ¶
type AnnotationCleanupService struct {
// contains filtered or unexported fields
}
AnnotationCleanupService is responsible for cleaning old annotations.
func (*AnnotationCleanupService) CleanAnnotations ¶
func (acs *AnnotationCleanupService) CleanAnnotations(ctx context.Context, cfg *setting.Cfg) (int64, int64, error)
CleanAnnotations deletes old annotations created by alert rules, API requests and human made in the UI. It subsequently deletes orphaned rows from the annotation_tag table. Cleanup actions are performed in batches so that no query takes too long to complete.
Returns the number of annotation and annotation_tag rows deleted. If an error occurs, it returns the number of rows affected so far.
type ContextSessionKey ¶
type ContextSessionKey struct{}
ContextSessionKey is used as key to save values in `context.Context`
type DashboardExtras ¶
type DashboardSlugDTO ¶
type DashboardSlugDTO struct {
Slug string
}
type DashboardTag ¶
type DatabaseConfig ¶
type DatabaseConfig struct { Type string Host string Name string User string Pwd string Path string SslMode string CaCertPath string ClientKeyPath string ClientCertPath string ServerCertName string ConnectionString string IsolationLevel string MaxOpenConn int MaxIdleConn int ConnMaxLifetime int CacheMode string UrlQueryParams map[string][]string SkipMigrations bool }
type ITestDB ¶
type ITestDB interface { Helper() Fatalf(format string, args ...interface{}) Logf(format string, args ...interface{}) Log(args ...interface{}) }
ITestDB is an interface of arguments for testing db
type InitTestDBOpt ¶
type InitTestDBOpt struct { // EnsureDefaultOrgAndUser flags whether to ensure that default org and user exist. EnsureDefaultOrgAndUser bool }
InitTestDBOpt contains options for InitTestDB.
type SQLAnnotationRepo ¶
type SQLAnnotationRepo struct { }
func (*SQLAnnotationRepo) Delete ¶
func (r *SQLAnnotationRepo) Delete(params *annotations.DeleteParams) error
func (*SQLAnnotationRepo) Find ¶
func (r *SQLAnnotationRepo) Find(query *annotations.ItemQuery) ([]*annotations.ItemDTO, error)
func (*SQLAnnotationRepo) FindTags ¶
func (r *SQLAnnotationRepo) FindTags(query *annotations.TagsQuery) (annotations.FindTagsResult, error)
func (*SQLAnnotationRepo) Save ¶
func (r *SQLAnnotationRepo) Save(item *annotations.Item) error
func (*SQLAnnotationRepo) Update ¶
func (r *SQLAnnotationRepo) Update(item *annotations.Item) error
type SQLBuilder ¶
type SQLBuilder struct {
// contains filtered or unexported fields
}
func (*SQLBuilder) AddParams ¶
func (sb *SQLBuilder) AddParams(params ...interface{})
func (*SQLBuilder) GetParams ¶
func (sb *SQLBuilder) GetParams() []interface{}
func (*SQLBuilder) GetSQLString ¶
func (sb *SQLBuilder) GetSQLString() string
func (*SQLBuilder) Write ¶
func (sb *SQLBuilder) Write(sql string, params ...interface{})
func (*SQLBuilder) WriteDashboardPermissionFilter ¶
func (sb *SQLBuilder) WriteDashboardPermissionFilter(user *models.SignedInUser, permission models.PermissionType)
type SQLStore ¶
type SQLStore struct { Cfg *setting.Cfg Bus bus.Bus CacheService *localcache.CacheService Dialect migrator.Dialect // contains filtered or unexported fields }
func InitTestDB ¶
func InitTestDB(t ITestDB, opts ...InitTestDBOpt) *SQLStore
InitTestDB initializes the test DB.
func InitTestDBWithMigration ¶
func InitTestDBWithMigration(t ITestDB, migration registry.DatabaseMigrator, opts ...InitTestDBOpt) *SQLStore
InitTestDBWithMigration initializes the test DB given custom migrations.
func ProvideService ¶
func ProvideService(cfg *setting.Cfg, cacheService *localcache.CacheService, bus bus.Bus, migrations registry.DatabaseMigrator) (*SQLStore, error)
func ProvideServiceForTests ¶
func ProvideServiceForTests(migrations registry.DatabaseMigrator) (*SQLStore, error)
func (*SQLStore) AddDataSource ¶
func (*SQLStore) AddOrgUser ¶
func (*SQLStore) AddTeamMember ¶
func (ss *SQLStore) AddTeamMember(userID, orgID, teamID int64, isExternal bool, permission models.PermissionType) error
AddTeamMember adds a user to a team
func (*SQLStore) CloneUserToServiceAccount ¶
func (*SQLStore) CreateAlertNotificationCommand ¶
func (*SQLStore) CreateDashboardSnapshot ¶
func (ss *SQLStore) CreateDashboardSnapshot(cmd *models.CreateDashboardSnapshotCommand) error
func (*SQLStore) CreateOrgWithMember ¶
CreateOrgWithMember creates an organization with a certain name and a certain user as member.
func (*SQLStore) CreatePlaylist ¶
func (*SQLStore) CreateTeam ¶
func (*SQLStore) CreateTempUser ¶
func (*SQLStore) CreateUser ¶
func (*SQLStore) DeleteAlertNotification ¶
func (*SQLStore) DeleteAlertNotificationWithUid ¶
func (*SQLStore) DeleteApiKey ¶
func (*SQLStore) DeleteDashboardSnapshot ¶
func (ss *SQLStore) DeleteDashboardSnapshot(cmd *models.DeleteDashboardSnapshotCommand) error
func (*SQLStore) DeleteDataSource ¶
func (ss *SQLStore) DeleteDataSource(ctx context.Context, cmd *models.DeleteDataSourceCommand) error
DeleteDataSource removes a datasource by org_id as well as either uid (preferred), id, or name and is added to the bus.
func (*SQLStore) DeleteExpiredSnapshots ¶
func (ss *SQLStore) DeleteExpiredSnapshots(cmd *models.DeleteExpiredSnapshotsCommand) error
DeleteExpiredSnapshots removes snapshots with old expiry dates. SnapShotRemoveExpired is deprecated and should be removed in the future. Snapshot expiry is decided by the user when they share the snapshot.
func (*SQLStore) DeleteExpiredVersions ¶
func (*SQLStore) DeletePlaylist ¶
func (*SQLStore) ExpireOldUserInvites ¶
func (*SQLStore) GetAPIKeys ¶
GetAPIKeys queries the database based on input on GetApiKeysQuery
func (*SQLStore) GetAlertById ¶
func (*SQLStore) GetAlertNotificationUidWithId ¶
func (*SQLStore) GetAlertNotifications ¶
func (*SQLStore) GetAlertNotificationsWithUid ¶
func (*SQLStore) GetAlertNotificationsWithUidToSend ¶
func (*SQLStore) GetAlertStatesForDashboard ¶
func (*SQLStore) GetAllAlertNotifications ¶
func (*SQLStore) GetAllAlertQueryHandler ¶
func (*SQLStore) GetApiKeyById ¶
func (*SQLStore) GetApiKeyByName ¶
func (*SQLStore) GetDashboard ¶
GetDashboard gets a dashboard.
func (*SQLStore) GetDashboardAclInfoList ¶
func (ss *SQLStore) GetDashboardAclInfoList(ctx context.Context, query *models.GetDashboardAclInfoListQuery) error
GetDashboardAclInfoList returns a list of permissions for a dashboard. They can be fetched from three different places. 1) Permissions for the dashboard 2) permissions for its parent folder 3) if no specific permissions have been set for the dashboard or its parent folder then get the default permissions
func (*SQLStore) GetDashboardSnapshot ¶
func (ss *SQLStore) GetDashboardSnapshot(query *models.GetDashboardSnapshotQuery) error
func (*SQLStore) GetDashboardUIDById ¶
func (*SQLStore) GetDashboardVersion ¶
func (ss *SQLStore) GetDashboardVersion(ctx context.Context, query *models.GetDashboardVersionQuery) error
GetDashboardVersion gets the dashboard version for the given dashboard ID and version number.
func (*SQLStore) GetDashboardVersions ¶
func (ss *SQLStore) GetDashboardVersions(ctx context.Context, query *models.GetDashboardVersionsQuery) error
GetDashboardVersions gets all dashboard versions for the given dashboard ID.
func (*SQLStore) GetDataSource ¶
GetDataSource adds a datasource to the query model by querying by org_id as well as either uid (preferred), id, or name and is added to the bus.
func (*SQLStore) GetDataSources ¶
func (ss *SQLStore) GetDataSources(query *models.GetDataSourcesQuery) error
func (*SQLStore) GetDataSourcesByType ¶
func (ss *SQLStore) GetDataSourcesByType(query *models.GetDataSourcesByTypeQuery) error
GetDataSourcesByType returns all datasources for a given type or an error if the specified type is an empty string
func (*SQLStore) GetDefaultDataSource ¶
func (ss *SQLStore) GetDefaultDataSource(query *models.GetDefaultDataSourceQuery) error
GetDefaultDataSource is used to get the default datasource of organization
func (*SQLStore) GetFolderByTitle ¶
GetDashboardByTitle gets a dashboard by its title.
func (*SQLStore) GetGlobalQuotaByTarget ¶
func (*SQLStore) GetOrCreateAlertNotificationState ¶
func (*SQLStore) GetOrgByName ¶
GetOrgByName gets an organization by name.
func (*SQLStore) GetOrgQuotaByTarget ¶
func (*SQLStore) GetOrgQuotas ¶
func (*SQLStore) GetOrgUsers ¶
func (*SQLStore) GetPlaylist ¶
func (*SQLStore) GetPlaylistItem ¶
func (*SQLStore) GetPluginSettingById ¶
func (*SQLStore) GetPluginSettings ¶
func (*SQLStore) GetPreferences ¶
func (*SQLStore) GetPreferencesWithDefaults ¶
func (*SQLStore) GetProvisionedDashboardData ¶
func (ss *SQLStore) GetProvisionedDashboardData(name string) ([]*models.DashboardProvisioning, error)
func (*SQLStore) GetProvisionedDataByDashboardID ¶
func (ss *SQLStore) GetProvisionedDataByDashboardID(dashboardID int64) (*models.DashboardProvisioning, error)
func (*SQLStore) GetSignedInUserWithCacheCtx ¶
func (*SQLStore) GetTempUserByCode ¶
func (*SQLStore) GetTempUsersQuery ¶
func (*SQLStore) GetUserByEmail ¶
func (*SQLStore) GetUserByLogin ¶
func (*SQLStore) GetUserProfile ¶
func (*SQLStore) GetUserQuotaByTarget ¶
func (*SQLStore) GetUserQuotas ¶
func (*SQLStore) GetUserStars ¶
func (*SQLStore) HandleAlertsQuery ¶
func (*SQLStore) InTransaction ¶
func (*SQLStore) IsStarredByUserCtx ¶
func (*SQLStore) Migrate ¶
Migrate performs database migrations. Has to be done in a second phase (after initialization), since other services can register migrations during the initialization phase.
func (*SQLStore) NewSession ¶
NewSession returns a new DBSession
func (*SQLStore) RemoveOrgUser ¶
func (*SQLStore) Reset ¶
Reset resets database state. If default org and user creation is enabled, it will be ensured they exist in the database.
func (*SQLStore) SaveAlerts ¶
func (*SQLStore) SaveDashboard ¶
func (*SQLStore) SavePreferences ¶
func (*SQLStore) SaveProvisionedDashboard ¶
func (ss *SQLStore) SaveProvisionedDashboard(cmd models.SaveDashboardCommand, provisioning *models.DashboardProvisioning) (*models.Dashboard, error)
func (*SQLStore) SearchDashboardSnapshots ¶
func (ss *SQLStore) SearchDashboardSnapshots(query *models.GetDashboardSnapshotsQuery) error
SearchDashboardSnapshots returns a list of all snapshots for admins for other roles, it returns snapshots created by the user
func (*SQLStore) SearchDashboards ¶
func (*SQLStore) SearchOrgUsers ¶
func (*SQLStore) SearchPlaylists ¶
func (*SQLStore) SetAlertNotificationStateToCompleteCommand ¶
func (*SQLStore) SetAlertNotificationStateToPendingCommand ¶
func (*SQLStore) SetAlertState ¶
func (*SQLStore) StarDashboard ¶
func (*SQLStore) UnstarDashboard ¶
func (*SQLStore) UpdateAlertNotification ¶
func (*SQLStore) UpdateAlertNotificationWithUid ¶
func (*SQLStore) UpdateDashboardACL ¶
func (ss *SQLStore) UpdateDashboardACL(dashboardID int64, items []*models.DashboardAcl) error
func (*SQLStore) UpdateDashboardACLCtx ¶
func (*SQLStore) UpdateDataSource ¶
func (*SQLStore) UpdateOrgQuota ¶
func (*SQLStore) UpdateOrgUser ¶
func (*SQLStore) UpdatePlaylist ¶
func (*SQLStore) UpdatePluginSetting ¶
func (*SQLStore) UpdatePluginSettingVersion ¶
func (*SQLStore) UpdateTempUserStatus ¶
func (*SQLStore) UpdateTempUserWithEmailSent ¶
func (*SQLStore) UpdateUserPermissions ¶
func (*SQLStore) UpdateUserQuota ¶
func (*SQLStore) ValidateDashboardBeforeSave ¶
func (*SQLStore) WithDbSession ¶
WithDbSession calls the callback with a session.
type XormLogger ¶
type XormLogger struct {
// contains filtered or unexported fields
}
func NewXormLogger ¶
func NewXormLogger(level glog.Lvl, grafanaLog glog.Logger) *XormLogger
func (*XormLogger) Debug ¶
func (s *XormLogger) Debug(v ...interface{})
Debug implement core.ILogger
func (*XormLogger) Debugf ¶
func (s *XormLogger) Debugf(format string, v ...interface{})
Debugf implement core.ILogger
func (*XormLogger) Error ¶
func (s *XormLogger) Error(v ...interface{})
Error implement core.ILogger
func (*XormLogger) Errorf ¶
func (s *XormLogger) Errorf(format string, v ...interface{})
Errorf implement core.ILogger
func (*XormLogger) Infof ¶
func (s *XormLogger) Infof(format string, v ...interface{})
Infof implement core.ILogger
func (*XormLogger) IsShowSQL ¶
func (s *XormLogger) IsShowSQL() bool
IsShowSQL implement core.ILogger
func (*XormLogger) SetLevel ¶
func (s *XormLogger) SetLevel(l core.LogLevel)
SetLevel implement core.ILogger
func (*XormLogger) ShowSQL ¶
func (s *XormLogger) ShowSQL(show ...bool)
ShowSQL implement core.ILogger
func (*XormLogger) Warnf ¶
func (s *XormLogger) Warnf(format string, v ...interface{})
Warnf implement core.ILogger
Source Files ¶
- alert.go
- alert_notification.go
- annotation.go
- annotation_cleanup.go
- apikey.go
- dashboard.go
- dashboard_acl.go
- dashboard_provisioning.go
- dashboard_snapshot.go
- dashboard_version.go
- database_wrapper.go
- datasource.go
- health.go
- logger.go
- login_attempt.go
- org.go
- org_users.go
- playlist.go
- plugin_setting.go
- preferences.go
- quota.go
- session.go
- sqlbuilder.go
- sqlstore.go
- star.go
- stats.go
- tables.go
- tags.go
- team.go
- temp_user.go
- tls_mysql.go
- transactions.go
- user.go
Directories ¶
Path | Synopsis |
---|---|
Package searchstore converts search queries to SQL.
|
Package searchstore converts search queries to SQL. |