Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func AddAttachments(templateId int, attachmentIds []int) (sql.Result, error) {
- glue := fmt.Sprintf("),(%d,", templateId)
- valuesSyntax := strings.Join(IntSliceToStringSlice(attachmentIds), glue)
- valuesSyntax = fmt.Sprintf("(%d,%s)", templateId, valuesSyntax)
- // Return the query in format ... VALUES (1,20),(1,21),...
- return db.Exec(fmt.Sprintf(`INSERT OR IGNORE INTO templates_attachments VALUES %v`, valuesSyntax))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement