···282282}
283283284284// DeleteRunner deletes a runner by given ID.
285285-func DeleteRunner(ctx context.Context, id int64) error {
286286- runner, err := GetRunnerByID(ctx, id)
287287- if err != nil {
288288- return err
289289- }
290290-285285+func DeleteRunner(ctx context.Context, r *ActionRunner) error {
291286 // Replace the UUID, which was either based on the secret's first 16 bytes or an UUIDv4,
292287 // with a sequence of 8 0xff bytes followed by the little-endian version of the record's
293288 // identifier. This will prevent the deleted record's identifier from colliding with any
294289 // new record.
295290 b := make([]byte, 8)
296296- binary.LittleEndian.PutUint64(b, uint64(id))
297297- runner.UUID = fmt.Sprintf("ffffffff-ffff-ffff-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x",
291291+ binary.LittleEndian.PutUint64(b, uint64(r.ID))
292292+ r.UUID = fmt.Sprintf("ffffffff-ffff-ffff-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x",
298293 b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7])
299294300300- err = UpdateRunner(ctx, runner, "UUID")
295295+ err := UpdateRunner(ctx, r, "UUID")
301296 if err != nil {
302297 return err
303298 }
304299305305- _, err = db.DeleteByID[ActionRunner](ctx, id)
300300+ _, err = db.DeleteByID[ActionRunner](ctx, r.ID)
306301 return err
307302}
308303
+1-1
models/actions/runner_test.go
···3434 require.NoError(t, unittest.PrepareTestDatabase())
3535 before := unittest.AssertExistsAndLoadBean(t, &ActionRunner{ID: recordID})
36363737- err := DeleteRunner(db.DefaultContext, recordID)
3737+ err := DeleteRunner(db.DefaultContext, &ActionRunner{ID: recordID})
3838 require.NoError(t, err)
39394040 var after ActionRunner
···39033903variables.description = Variables will be passed to certain actions and cannot be read otherwise.
39043904variables.id_not_exist = Variable with ID %d does not exist.
39053905variables.edit = Edit Variable
39063906+variables.not_found = Failed to find the variable.
39063907variables.deletion.failed = Failed to remove variable.
39073908variables.deletion.success = The variable has been removed.
39083909variables.creation.failed = Failed to add variable.