|
@@ -26,7 +26,7 @@ func (a articleTagRepository) Add(ctx context.Context, articleID int, tagIDs []i
|
|
|
|
|
|
query := "INSERT INTO " + articleTagTableName + " (article_id, tag_id) VALUES "
|
|
|
|
|
|
- var vals []interface{}
|
|
|
+ vals := make([]interface{}, 0, len(tagIDs)*2)
|
|
|
for _, tagID := range tagIDs {
|
|
|
query += "(?, ?),"
|
|
|
vals = append(vals, articleID, tagID)
|
|
@@ -45,7 +45,7 @@ func (a articleTagRepository) Delete(ctx context.Context, articleID int, tagIDs
|
|
|
|
|
|
query := "DELETE FROM " + articleTagTableName + " WHERE article_id = ? AND tag_id IN ("
|
|
|
|
|
|
- var vals []interface{}
|
|
|
+ vals := make([]interface{}, 0, len(tagIDs)+1)
|
|
|
vals = append(vals, articleID)
|
|
|
for _, tagID := range tagIDs {
|
|
|
query += "?,"
|