...
|
...
|
@@ -3,6 +3,7 @@ package repository |
|
|
import (
|
|
|
"context"
|
|
|
"fmt"
|
|
|
"strings"
|
|
|
|
|
|
"github.com/pkg/errors"
|
|
|
"github.com/tiptok/gocomm/pkg/cache"
|
...
|
...
|
@@ -136,6 +137,13 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. |
|
|
if v, ok := queryOptions["authorId"]; ok {
|
|
|
tx = tx.Where("author_id=?", v)
|
|
|
}
|
|
|
if v, ok := queryOptions["tags"]; ok && len(v.([]int64)) > 0 {
|
|
|
values := make([]string, 0)
|
|
|
for _, item := range v.([]int64) {
|
|
|
values = append(values, fmt.Sprintf("%v", item))
|
|
|
}
|
|
|
tx = tx.Where("tags @> ?", "["+strings.Join(values, ",")+"]")
|
|
|
}
|
|
|
if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
|
|
|
return dms, tx.Error
|
|
|
}
|
...
|
...
|
|