removes unused db method (#34082)

This commit is contained in:
Owen Diehl
2021-05-13 14:28:10 -04:00
committed by GitHub
parent baca873a84
commit fc90c36d50
3 changed files with 0 additions and 35 deletions

View File

@@ -13,20 +13,6 @@ var (
ErrNoAlertmanagerConfiguration = fmt.Errorf("could not find an Alertmanager configuration")
)
func getAlertmanagerConfigurationByID(sess *sqlstore.DBSession, id int64) (*models.AlertConfiguration, error) {
c := &models.AlertConfiguration{}
has, err := sess.ID(id).Get(c)
if err != nil {
return nil, err
}
if !has {
return nil, ErrNoAlertmanagerConfiguration
}
return c, nil
}
func getLatestAlertmanagerConfiguration(sess *sqlstore.DBSession) (*models.AlertConfiguration, error) {
c := &models.AlertConfiguration{}
// The ID is already an auto incremental column, using the ID as an order should guarantee the latest.
@@ -55,19 +41,6 @@ func (st *DBstore) GetLatestAlertmanagerConfiguration(query *models.GetLatestAle
})
}
// GetAlertmanagerConfiguration returns the alertmanager configuration identified by the query.
// It returns ErrNoAlertmanagerConfiguration if no such configuration is found.
func (st *DBstore) GetAlertmanagerConfiguration(query *models.GetAlertmanagerConfigurationQuery) error {
return st.SQLStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
c, err := getAlertmanagerConfigurationByID(sess, query.ID)
if err != nil {
return err
}
query.Result = c
return nil
})
}
// SaveAlertmanagerConfiguration creates an alertmanager configuration.
func (st *DBstore) SaveAlertmanagerConfiguration(cmd *models.SaveAlertmanagerConfigurationCmd) error {
return st.SQLStore.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {

View File

@@ -17,7 +17,6 @@ const AlertDefinitionMaxTitleLength = 190
// AlertingStore is the database interface used by the Alertmanager service.
type AlertingStore interface {
GetLatestAlertmanagerConfiguration(*models.GetLatestAlertmanagerConfigurationQuery) error
GetAlertmanagerConfiguration(*models.GetAlertmanagerConfigurationQuery) error
SaveAlertmanagerConfiguration(*models.SaveAlertmanagerConfigurationCmd) error
}