[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
|
@ -33,13 +33,11 @@ const (
|
|||
ContentsInverseTable = "category_contents"
|
||||
// ContentsColumn is the table column denoting the contents relation/edge.
|
||||
ContentsColumn = "category_contents"
|
||||
// PostsTable is the table that holds the posts relation/edge.
|
||||
PostsTable = "posts"
|
||||
// PostsTable is the table that holds the posts relation/edge. The primary key declared below.
|
||||
PostsTable = "category_posts"
|
||||
// PostsInverseTable is the table name for the Post entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "post" package.
|
||||
PostsInverseTable = "posts"
|
||||
// PostsColumn is the table column denoting the posts relation/edge.
|
||||
PostsColumn = "category_posts"
|
||||
// DailyItemsTable is the table that holds the daily_items relation/edge.
|
||||
DailyItemsTable = "dailies"
|
||||
// DailyItemsInverseTable is the table name for the Daily entity.
|
||||
|
@ -56,6 +54,12 @@ var Columns = []string{
|
|||
FieldUpdatedAt,
|
||||
}
|
||||
|
||||
var (
|
||||
// PostsPrimaryKey and PostsColumn2 are the table columns denoting the
|
||||
// primary key for the posts relation (M2M).
|
||||
PostsPrimaryKey = []string{"category_id", "post_id"}
|
||||
)
|
||||
|
||||
// ValidColumn reports if the column name is valid (part of the table columns).
|
||||
func ValidColumn(column string) bool {
|
||||
for i := range Columns {
|
||||
|
@ -145,7 +149,7 @@ func newPostsStep() *sqlgraph.Step {
|
|||
return sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(PostsInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.O2M, false, PostsTable, PostsColumn),
|
||||
sqlgraph.Edge(sqlgraph.M2M, false, PostsTable, PostsPrimaryKey...),
|
||||
)
|
||||
}
|
||||
func newDailyItemsStep() *sqlgraph.Step {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue