Chore: use any rather than interface{} (#74066)
This commit is contained in:
@@ -54,8 +54,8 @@ func (m *actionNameMigrator) migrateActionNames() error {
|
||||
"alert.rules:update": accesscontrol.ActionAlertingRuleUpdate,
|
||||
}
|
||||
|
||||
oldActionNames := make([]interface{}, 0, len(actionNameMapping))
|
||||
newActionNames := make([]interface{}, 0, len(actionNameMapping))
|
||||
oldActionNames := make([]any, 0, len(actionNameMapping))
|
||||
newActionNames := make([]any, 0, len(actionNameMapping))
|
||||
for oldName, newName := range actionNameMapping {
|
||||
oldActionNames = append(oldActionNames, oldName)
|
||||
newActionNames = append(newActionNames, newName)
|
||||
|
||||
@@ -87,7 +87,7 @@ func (m *adminOnlyMigrator) Exec(sess *xorm.Session, mg *migrator.Migrator) erro
|
||||
|
||||
// Remove managed permission for editors and viewers if there was any
|
||||
removeSQL := `DELETE FROM permission WHERE scope = ? AND role_id IN(?` + strings.Repeat(", ?", len(roleIDS)-1) + `) `
|
||||
params := []interface{}{removeSQL, scope}
|
||||
params := []any{removeSQL, scope}
|
||||
for _, id := range roleIDS {
|
||||
params = append(params, id)
|
||||
}
|
||||
|
||||
@@ -345,7 +345,7 @@ func (m *managedFolderAlertActionsMigrator) SQL(dialect migrator.Dialect) string
|
||||
}
|
||||
|
||||
func (m *managedFolderAlertActionsMigrator) Exec(sess *xorm.Session, mg *migrator.Migrator) error {
|
||||
var ids []interface{}
|
||||
var ids []any
|
||||
if err := sess.SQL("SELECT id FROM role WHERE name LIKE 'managed:%'").Find(&ids); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -457,7 +457,7 @@ func (m *managedFolderAlertActionsRepeatMigrator) SQL(dialect migrator.Dialect)
|
||||
}
|
||||
|
||||
func (m *managedFolderAlertActionsRepeatMigrator) Exec(sess *xorm.Session, mg *migrator.Migrator) error {
|
||||
var ids []interface{}
|
||||
var ids []any
|
||||
if err := sess.SQL("SELECT id FROM role WHERE name LIKE 'managed:%'").Find(&ids); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ func (m *DisabledMigrator) Exec(sess *xorm.Session, mg *migrator.Migrator) error
|
||||
return fmt.Errorf("failed to remove managed rbac roles: %w", err)
|
||||
}
|
||||
|
||||
params := []interface{}{"DELETE FROM migration_log WHERE migration_id IN (?, ?, ?, ?, ?, ?, ?, ?)"}
|
||||
params := []any{"DELETE FROM migration_log WHERE migration_id IN (?, ?, ?, ?, ?, ?, ?, ?)"}
|
||||
for _, m := range migrations {
|
||||
params = append(params, m)
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ func (m *permissionMigrator) createRoles(roles []*accesscontrol.Role) ([]*access
|
||||
ts := time.Now()
|
||||
createdRoles := make([]*accesscontrol.Role, 0, len(roles))
|
||||
valueStrings := make([]string, len(roles))
|
||||
args := make([]interface{}, 0, len(roles)*5)
|
||||
args := make([]any, 0, len(roles)*5)
|
||||
|
||||
for i, r := range roles {
|
||||
uid, err := GenerateManagedRoleUID(r.OrgID, r.Name)
|
||||
@@ -160,7 +160,7 @@ func (m *permissionMigrator) createRolesMySQL(roles []*accesscontrol.Role) ([]*a
|
||||
createdRoles := make([]*accesscontrol.Role, 0, len(roles))
|
||||
|
||||
where := make([]string, len(roles))
|
||||
args := make([]interface{}, 0, len(roles)*2)
|
||||
args := make([]any, 0, len(roles)*2)
|
||||
|
||||
for i := range roles {
|
||||
uid, err := GenerateManagedRoleUID(roles[i].OrgID, roles[i].Name)
|
||||
|
||||
Reference in New Issue
Block a user