func (task *AddTaskVars) GetInsertQueryAndBinds() (string, []interface{}, error) { if task.PageSets == "" || task.ChromiumBuild.ChromiumRev == "" || task.ChromiumBuild.SkiaRev == "" || task.Description == "" { return "", nil, fmt.Errorf("Invalid parameters") } if err := chromium_builds.Validate(task.ChromiumBuild); err != nil { return "", nil, err } if err := ctfeutil.CheckLengths([]ctfeutil.LengthCheck{ {"page_sets", task.PageSets, 100}, {"desc", task.Description, 255}, }); err != nil { return "", nil, err } return fmt.Sprintf("INSERT INTO %s (username,page_sets,chromium_rev,skia_rev,description,ts_added, repeat_after_days) VALUES (?,?,?,?,?,?,?);", db.TABLE_CAPTURE_SKPS_TASKS), []interface{}{ task.Username, task.PageSets, task.ChromiumBuild.ChromiumRev, task.ChromiumBuild.SkiaRev, task.Description, task.TsAdded, task.RepeatAfterDays, }, nil }
func (task *AddRecreateWebpageArchivesTaskVars) GetInsertQueryAndBinds() (string, []interface{}, error) { if task.PageSets == "" || task.ChromiumBuild.ChromiumRev == "" || task.ChromiumBuild.SkiaRev == "" { return "", nil, fmt.Errorf("Invalid parameters") } if err := chromium_builds.Validate(task.ChromiumBuild); err != nil { return "", nil, err } return fmt.Sprintf("INSERT INTO %s (username,page_sets,chromium_rev,skia_rev,ts_added,repeat_after_days) VALUES (?,?,?,?,?,?);", db.TABLE_RECREATE_WEBPAGE_ARCHIVES_TASKS), []interface{}{ task.Username, task.PageSets, task.ChromiumBuild.ChromiumRev, task.ChromiumBuild.SkiaRev, task.TsAdded, task.RepeatAfterDays, }, nil }