sqlstore

package
v0.0.0-test Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2021 License: AGPL-3.0 Imports: 50 Imported by: 593

Documentation

Index

Constants

View Source
const MAX_VERSIONS_TO_DELETE_PER_BATCH = 100
View Source
const MAX_VERSION_DELETION_BATCHES = 50
View Source
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 CreateOrg

func CreateOrg(ctx context.Context, cmd *models.CreateOrgCommand) error

func DeleteDashboard

func DeleteDashboard(ctx context.Context, cmd *models.DeleteDashboardCommand) error

func DeleteOldLoginAttempts

func DeleteOldLoginAttempts(ctx context.Context, cmd *models.DeleteOldLoginAttemptsCommand) error

func DeleteOrg

func DeleteOrg(ctx context.Context, cmd *models.DeleteOrgCommand) 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

func EnsureTagsExist(sess *DBSession, tags []*models.Tag) ([]*models.Tag, error)

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 GetAlertsByDashboardId2(dashboardId int64, sess *DBSession) ([]*models.Alert, error)

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 UpdateOrg

func UpdateOrg(ctx context.Context, cmd *models.UpdateOrgCommand) error

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

func WrapDatabaseDriverWithHooks(dbType string) string

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 DBSession

type DBSession struct {
	*xorm.Session
	// contains filtered or unexported fields
}

func (*DBSession) InsertId

func (sess *DBSession) InsertId(bean interface{}) (int64, error)

type DashboardExtras

type DashboardExtras struct {
	Id          int64
	DashboardId int64
	Key         string
	Value       string
}

type DashboardSearchProjection

type DashboardSearchProjection struct {
	ID          int64  `xorm:"id"`
	UID         string `xorm:"uid"`
	Title       string
	Slug        string
	Term        string
	IsFolder    bool
	FolderID    int64  `xorm:"folder_id"`
	FolderUID   string `xorm:"folder_uid"`
	FolderSlug  string
	FolderTitle string
	SortMeta    int64
}

type DashboardSlugDTO

type DashboardSlugDTO struct {
	Slug string
}

type DashboardTag

type DashboardTag struct {
	Id          int64
	DashboardId int64
	Term        string
}

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 (*SQLAnnotationRepo) FindTags

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) AddAPIKey

func (ss *SQLStore) AddAPIKey(ctx context.Context, cmd *models.AddApiKeyCommand) error

AddAPIKey adds the API key to the database.

func (*SQLStore) AddDataSource

func (ss *SQLStore) AddDataSource(ctx context.Context, cmd *models.AddDataSourceCommand) error

func (*SQLStore) AddOrgUser

func (ss *SQLStore) AddOrgUser(ctx context.Context, cmd *models.AddOrgUserCommand) error

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 (ss *SQLStore) CloneUserToServiceAccount(ctx context.Context, siUser *models.SignedInUser) (*models.User, error)

func (*SQLStore) CreateAlertNotificationCommand

func (ss *SQLStore) CreateAlertNotificationCommand(ctx context.Context, cmd *models.CreateAlertNotificationCommand) error

func (*SQLStore) CreateDashboardSnapshot

func (ss *SQLStore) CreateDashboardSnapshot(cmd *models.CreateDashboardSnapshotCommand) error

func (*SQLStore) CreateOrgWithMember

func (ss *SQLStore) CreateOrgWithMember(name string, userID int64) (models.Org, error)

CreateOrgWithMember creates an organization with a certain name and a certain user as member.

func (*SQLStore) CreatePlaylist

func (ss *SQLStore) CreatePlaylist(ctx context.Context, cmd *models.CreatePlaylistCommand) error

func (*SQLStore) CreateTeam

func (ss *SQLStore) CreateTeam(name, email string, orgID int64) (models.Team, error)

func (*SQLStore) CreateTempUser

func (ss *SQLStore) CreateTempUser(ctx context.Context, cmd *models.CreateTempUserCommand) error

func (*SQLStore) CreateUser

func (ss *SQLStore) CreateUser(ctx context.Context, cmd models.CreateUserCommand) (*models.User, error)

func (*SQLStore) DeleteAlertNotification

func (ss *SQLStore) DeleteAlertNotification(ctx context.Context, cmd *models.DeleteAlertNotificationCommand) error

func (*SQLStore) DeleteAlertNotificationWithUid

func (ss *SQLStore) DeleteAlertNotificationWithUid(ctx context.Context, cmd *models.DeleteAlertNotificationWithUidCommand) error

func (*SQLStore) DeleteApiKey

func (ss *SQLStore) DeleteApiKey(ctx context.Context, cmd *models.DeleteApiKeyCommand) error

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 (ss *SQLStore) DeleteExpiredVersions(ctx context.Context, cmd *models.DeleteExpiredVersionsCommand) error

func (*SQLStore) DeletePlaylist

func (ss *SQLStore) DeletePlaylist(ctx context.Context, cmd *models.DeletePlaylistCommand) error

func (*SQLStore) ExpireOldUserInvites

func (ss *SQLStore) ExpireOldUserInvites(ctx context.Context, cmd *models.ExpireTempUsersCommand) error

func (*SQLStore) GetAPIKeys

func (ss *SQLStore) GetAPIKeys(ctx context.Context, query *models.GetApiKeysQuery) error

GetAPIKeys queries the database based on input on GetApiKeysQuery

func (*SQLStore) GetAlertById

func (ss *SQLStore) GetAlertById(ctx context.Context, query *models.GetAlertByIdQuery) error

func (*SQLStore) GetAlertNotificationUidWithId

func (ss *SQLStore) GetAlertNotificationUidWithId(ctx context.Context, query *models.GetAlertNotificationUidQuery) error

func (*SQLStore) GetAlertNotifications

func (ss *SQLStore) GetAlertNotifications(ctx context.Context, query *models.GetAlertNotificationsQuery) error

func (*SQLStore) GetAlertNotificationsWithUid

func (ss *SQLStore) GetAlertNotificationsWithUid(ctx context.Context, query *models.GetAlertNotificationsWithUidQuery) error

func (*SQLStore) GetAlertNotificationsWithUidToSend

func (ss *SQLStore) GetAlertNotificationsWithUidToSend(ctx context.Context, query *models.GetAlertNotificationsWithUidToSendQuery) error

func (*SQLStore) GetAlertStatesForDashboard

func (ss *SQLStore) GetAlertStatesForDashboard(ctx context.Context, query *models.GetAlertStatesForDashboardQuery) error

func (*SQLStore) GetAllAlertNotifications

func (ss *SQLStore) GetAllAlertNotifications(ctx context.Context, query *models.GetAllAlertNotificationsQuery) error

func (*SQLStore) GetAllAlertQueryHandler

func (ss *SQLStore) GetAllAlertQueryHandler(ctx context.Context, query *models.GetAllAlertsQuery) error

func (*SQLStore) GetApiKeyById

func (ss *SQLStore) GetApiKeyById(ctx context.Context, query *models.GetApiKeyByIdQuery) error

func (*SQLStore) GetApiKeyByName

func (ss *SQLStore) GetApiKeyByName(ctx context.Context, query *models.GetApiKeyByNameQuery) error

func (*SQLStore) GetDashboard

func (ss *SQLStore) GetDashboard(id, orgID int64, uid, slug string) (*models.Dashboard, error)

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 (ss *SQLStore) GetDashboardUIDById(ctx context.Context, query *models.GetDashboardRefByIdQuery) error

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

func (ss *SQLStore) GetDataSource(ctx context.Context, query *models.GetDataSourceQuery) error

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

func (ss *SQLStore) GetFolderByTitle(orgID int64, title string) (*models.Dashboard, error)

GetDashboardByTitle gets a dashboard by its title.

func (*SQLStore) GetGlobalQuotaByTarget

func (ss *SQLStore) GetGlobalQuotaByTarget(ctx context.Context, query *models.GetGlobalQuotaByTargetQuery) error

func (*SQLStore) GetOrCreateAlertNotificationState

func (ss *SQLStore) GetOrCreateAlertNotificationState(ctx context.Context, cmd *models.GetOrCreateNotificationStateQuery) error

func (*SQLStore) GetOrgByName

func (ss *SQLStore) GetOrgByName(name string) (*models.Org, error)

GetOrgByName gets an organization by name.

func (*SQLStore) GetOrgQuotaByTarget

func (ss *SQLStore) GetOrgQuotaByTarget(ctx context.Context, query *models.GetOrgQuotaByTargetQuery) error

func (*SQLStore) GetOrgQuotas

func (ss *SQLStore) GetOrgQuotas(ctx context.Context, query *models.GetOrgQuotasQuery) error

func (*SQLStore) GetOrgUsers

func (ss *SQLStore) GetOrgUsers(ctx context.Context, query *models.GetOrgUsersQuery) error

func (*SQLStore) GetPlaylist

func (ss *SQLStore) GetPlaylist(ctx context.Context, query *models.GetPlaylistByIdQuery) error

func (*SQLStore) GetPlaylistItem

func (ss *SQLStore) GetPlaylistItem(ctx context.Context, query *models.GetPlaylistItemsByIdQuery) error

func (*SQLStore) GetPluginSettingById

func (ss *SQLStore) GetPluginSettingById(ctx context.Context, query *models.GetPluginSettingByIdQuery) error

func (*SQLStore) GetPluginSettings

func (ss *SQLStore) GetPluginSettings(ctx context.Context, orgID int64) ([]*models.PluginSettingInfoDTO, error)

func (*SQLStore) GetPreferences

func (ss *SQLStore) GetPreferences(ctx context.Context, query *models.GetPreferencesQuery) error

func (*SQLStore) GetPreferencesWithDefaults

func (ss *SQLStore) GetPreferencesWithDefaults(ctx context.Context, query *models.GetPreferencesWithDefaultsQuery) error

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 (ss *SQLStore) GetSignedInUserWithCacheCtx(ctx context.Context, query *models.GetSignedInUserQuery) error

func (*SQLStore) GetTempUserByCode

func (ss *SQLStore) GetTempUserByCode(ctx context.Context, query *models.GetTempUserByCodeQuery) error

func (*SQLStore) GetTempUsersQuery

func (ss *SQLStore) GetTempUsersQuery(ctx context.Context, query *models.GetTempUsersQuery) error

func (*SQLStore) GetUserByEmail

func (ss *SQLStore) GetUserByEmail(ctx context.Context, query *models.GetUserByEmailQuery) error

func (*SQLStore) GetUserByLogin

func (ss *SQLStore) GetUserByLogin(ctx context.Context, query *models.GetUserByLoginQuery) error

func (*SQLStore) GetUserProfile

func (ss *SQLStore) GetUserProfile(ctx context.Context, query *models.GetUserProfileQuery) error

func (*SQLStore) GetUserQuotaByTarget

func (ss *SQLStore) GetUserQuotaByTarget(ctx context.Context, query *models.GetUserQuotaByTargetQuery) error

func (*SQLStore) GetUserQuotas

func (ss *SQLStore) GetUserQuotas(ctx context.Context, query *models.GetUserQuotasQuery) error

func (*SQLStore) GetUserStars

func (ss *SQLStore) GetUserStars(ctx context.Context, query *models.GetUserStarsQuery) error

func (*SQLStore) HandleAlertsQuery

func (ss *SQLStore) HandleAlertsQuery(ctx context.Context, query *models.GetAlertsQuery) error

func (*SQLStore) InTransaction

func (ss *SQLStore) InTransaction(ctx context.Context, fn func(ctx context.Context) error) error

func (*SQLStore) IsStarredByUserCtx

func (ss *SQLStore) IsStarredByUserCtx(ctx context.Context, query *models.IsStarredByUserQuery) error

func (*SQLStore) Migrate

func (ss *SQLStore) Migrate() error

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

func (ss *SQLStore) NewSession(ctx context.Context) *DBSession

NewSession returns a new DBSession

func (*SQLStore) Quote

func (ss *SQLStore) Quote(value string) string

Quote quotes the value in the used SQL dialect

func (*SQLStore) RemoveOrgUser

func (ss *SQLStore) RemoveOrgUser(ctx context.Context, cmd *models.RemoveOrgUserCommand) error

func (*SQLStore) Reset

func (ss *SQLStore) Reset() error

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 (ss *SQLStore) SaveAlerts(ctx context.Context, dashID int64, alerts []*models.Alert) error

func (*SQLStore) SaveDashboard

func (ss *SQLStore) SaveDashboard(cmd models.SaveDashboardCommand) (*models.Dashboard, error)

func (*SQLStore) SavePreferences

func (ss *SQLStore) SavePreferences(ctx context.Context, cmd *models.SavePreferencesCommand) error

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 (ss *SQLStore) SearchDashboards(ctx context.Context, query *search.FindPersistedDashboardsQuery) error

func (*SQLStore) SearchOrgUsers

func (ss *SQLStore) SearchOrgUsers(ctx context.Context, query *models.SearchOrgUsersQuery) error

func (*SQLStore) SearchPlaylists

func (ss *SQLStore) SearchPlaylists(ctx context.Context, query *models.GetPlaylistsQuery) error

func (*SQLStore) SetAlertNotificationStateToCompleteCommand

func (ss *SQLStore) SetAlertNotificationStateToCompleteCommand(ctx context.Context, cmd *models.SetAlertNotificationStateToCompleteCommand) error

func (*SQLStore) SetAlertNotificationStateToPendingCommand

func (ss *SQLStore) SetAlertNotificationStateToPendingCommand(ctx context.Context, cmd *models.SetAlertNotificationStateToPendingCommand) error

func (*SQLStore) SetAlertState

func (ss *SQLStore) SetAlertState(ctx context.Context, cmd *models.SetAlertStateCommand) error

func (*SQLStore) StarDashboard

func (ss *SQLStore) StarDashboard(ctx context.Context, cmd *models.StarDashboardCommand) error

func (*SQLStore) Sync

func (ss *SQLStore) Sync() error

Sync syncs changes to the database.

func (*SQLStore) UnstarDashboard

func (ss *SQLStore) UnstarDashboard(ctx context.Context, cmd *models.UnstarDashboardCommand) error

func (*SQLStore) UpdateAlertNotification

func (ss *SQLStore) UpdateAlertNotification(ctx context.Context, cmd *models.UpdateAlertNotificationCommand) error

func (*SQLStore) UpdateAlertNotificationWithUid

func (ss *SQLStore) UpdateAlertNotificationWithUid(ctx context.Context, cmd *models.UpdateAlertNotificationWithUidCommand) error

func (*SQLStore) UpdateDashboardACL

func (ss *SQLStore) UpdateDashboardACL(dashboardID int64, items []*models.DashboardAcl) error

func (*SQLStore) UpdateDashboardACLCtx

func (ss *SQLStore) UpdateDashboardACLCtx(ctx context.Context, dashboardID int64, items []*models.DashboardAcl) error

func (*SQLStore) UpdateDataSource

func (ss *SQLStore) UpdateDataSource(ctx context.Context, cmd *models.UpdateDataSourceCommand) error

func (*SQLStore) UpdateOrgQuota

func (ss *SQLStore) UpdateOrgQuota(ctx context.Context, cmd *models.UpdateOrgQuotaCmd) error

func (*SQLStore) UpdateOrgUser

func (ss *SQLStore) UpdateOrgUser(ctx context.Context, cmd *models.UpdateOrgUserCommand) error

func (*SQLStore) UpdatePlaylist

func (ss *SQLStore) UpdatePlaylist(ctx context.Context, cmd *models.UpdatePlaylistCommand) error

func (*SQLStore) UpdatePluginSetting

func (ss *SQLStore) UpdatePluginSetting(ctx context.Context, cmd *models.UpdatePluginSettingCmd) error

func (*SQLStore) UpdatePluginSettingVersion

func (ss *SQLStore) UpdatePluginSettingVersion(ctx context.Context, cmd *models.UpdatePluginSettingVersionCmd) error

func (*SQLStore) UpdateTempUserStatus

func (ss *SQLStore) UpdateTempUserStatus(ctx context.Context, cmd *models.UpdateTempUserStatusCommand) error

func (*SQLStore) UpdateTempUserWithEmailSent

func (ss *SQLStore) UpdateTempUserWithEmailSent(ctx context.Context, cmd *models.UpdateTempUserWithEmailSentCommand) error

func (*SQLStore) UpdateUserPermissions

func (ss *SQLStore) UpdateUserPermissions(userID int64, isAdmin bool) error

func (*SQLStore) UpdateUserQuota

func (ss *SQLStore) UpdateUserQuota(ctx context.Context, cmd *models.UpdateUserQuotaCmd) error

func (*SQLStore) ValidateDashboardBeforeSave

func (ss *SQLStore) ValidateDashboardBeforeSave(dashboard *models.Dashboard, overwrite bool) (bool, error)

func (*SQLStore) WithDbSession

func (ss *SQLStore) WithDbSession(ctx context.Context, callback dbTransactionFunc) error

WithDbSession calls the callback with a session.

func (*SQLStore) WithTransactionalDbSession

func (ss *SQLStore) WithTransactionalDbSession(ctx context.Context, callback dbTransactionFunc) error

WithTransactionalDbSession calls the callback with a session within a transaction.

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) Info

func (s *XormLogger) Info(v ...interface{})

Info 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) Level

func (s *XormLogger) Level() core.LogLevel

Level 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) Warn

func (s *XormLogger) Warn(v ...interface{})

Warn implement core.ILogger

func (*XormLogger) Warnf

func (s *XormLogger) Warnf(format string, v ...interface{})

Warnf implement core.ILogger

Directories

Path Synopsis
Package searchstore converts search queries to SQL.
Package searchstore converts search queries to SQL.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL