This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"quyun/v2/app/requests"
|
||||
"quyun/v2/database"
|
||||
"quyun/v2/database/models"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
@@ -167,3 +168,9 @@ func (m *posts) Count(ctx context.Context, conds ...gen.Condition) (int64, error
|
||||
}
|
||||
return query.Count()
|
||||
}
|
||||
|
||||
// FilterIdsByKeyword filter posts ids by title keywords
|
||||
func (m *posts) FilterIdsByKeyword(ctx context.Context, keyword string) ([]int64, error) {
|
||||
tbl, query := models.PostQuery.QueryContext(ctx)
|
||||
return query.Select(tbl.ID).Where(tbl.Title.Like(database.WrapLike(keyword))).PluckIDs()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user