[feature/backend] add categories param in posts
This commit is contained in:
parent
958e3c2886
commit
be8bf22017
21 changed files with 448 additions and 281 deletions
|
@ -281,21 +281,21 @@ func HasContributorsWith(preds ...predicate.PostContributor) predicate.Post {
|
|||
})
|
||||
}
|
||||
|
||||
// HasCategory applies the HasEdge predicate on the "category" edge.
|
||||
func HasCategory() predicate.Post {
|
||||
// HasCategories applies the HasEdge predicate on the "categories" edge.
|
||||
func HasCategories() predicate.Post {
|
||||
return predicate.Post(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, CategoryTable, CategoryColumn),
|
||||
sqlgraph.Edge(sqlgraph.M2M, true, CategoriesTable, CategoriesPrimaryKey...),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasCategoryWith applies the HasEdge predicate on the "category" edge with a given conditions (other predicates).
|
||||
func HasCategoryWith(preds ...predicate.Category) predicate.Post {
|
||||
// HasCategoriesWith applies the HasEdge predicate on the "categories" edge with a given conditions (other predicates).
|
||||
func HasCategoriesWith(preds ...predicate.Category) predicate.Post {
|
||||
return predicate.Post(func(s *sql.Selector) {
|
||||
step := newCategoryStep()
|
||||
step := newCategoriesStep()
|
||||
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||||
for _, p := range preds {
|
||||
p(s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue