381 lines
12 KiB
Go
381 lines
12 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package ent
|
|
|
|
import (
|
|
"code.icod.de/dalu/ka/ent/category"
|
|
"code.icod.de/dalu/ka/ent/post"
|
|
"code.icod.de/dalu/ka/ent/predicate"
|
|
"code.icod.de/dalu/ka/ent/profile"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"entgo.io/ent/entql"
|
|
"entgo.io/ent/schema/field"
|
|
)
|
|
|
|
// schemaGraph holds a representation of ent/schema at runtime.
|
|
var schemaGraph = func() *sqlgraph.Schema {
|
|
graph := &sqlgraph.Schema{Nodes: make([]*sqlgraph.Node, 3)}
|
|
graph.Nodes[0] = &sqlgraph.Node{
|
|
NodeSpec: sqlgraph.NodeSpec{
|
|
Table: category.Table,
|
|
Columns: category.Columns,
|
|
ID: &sqlgraph.FieldSpec{
|
|
Type: field.TypeUUID,
|
|
Column: category.FieldID,
|
|
},
|
|
},
|
|
Type: "Category",
|
|
Fields: map[string]*sqlgraph.FieldSpec{
|
|
category.FieldCreatedAt: {Type: field.TypeTime, Column: category.FieldCreatedAt},
|
|
category.FieldUpdatedAt: {Type: field.TypeTime, Column: category.FieldUpdatedAt},
|
|
category.FieldTitle: {Type: field.TypeString, Column: category.FieldTitle},
|
|
category.FieldDescription: {Type: field.TypeString, Column: category.FieldDescription},
|
|
},
|
|
}
|
|
graph.Nodes[1] = &sqlgraph.Node{
|
|
NodeSpec: sqlgraph.NodeSpec{
|
|
Table: post.Table,
|
|
Columns: post.Columns,
|
|
ID: &sqlgraph.FieldSpec{
|
|
Type: field.TypeUUID,
|
|
Column: post.FieldID,
|
|
},
|
|
},
|
|
Type: "Post",
|
|
Fields: map[string]*sqlgraph.FieldSpec{
|
|
post.FieldCreatedAt: {Type: field.TypeTime, Column: post.FieldCreatedAt},
|
|
post.FieldUpdatedAt: {Type: field.TypeTime, Column: post.FieldUpdatedAt},
|
|
post.FieldExpires: {Type: field.TypeBool, Column: post.FieldExpires},
|
|
post.FieldExpireTime: {Type: field.TypeTime, Column: post.FieldExpireTime},
|
|
post.FieldTitle: {Type: field.TypeString, Column: post.FieldTitle},
|
|
post.FieldBody: {Type: field.TypeString, Column: post.FieldBody},
|
|
},
|
|
}
|
|
graph.Nodes[2] = &sqlgraph.Node{
|
|
NodeSpec: sqlgraph.NodeSpec{
|
|
Table: profile.Table,
|
|
Columns: profile.Columns,
|
|
ID: &sqlgraph.FieldSpec{
|
|
Type: field.TypeUUID,
|
|
Column: profile.FieldID,
|
|
},
|
|
},
|
|
Type: "Profile",
|
|
Fields: map[string]*sqlgraph.FieldSpec{
|
|
profile.FieldCreatedAt: {Type: field.TypeTime, Column: profile.FieldCreatedAt},
|
|
profile.FieldUpdatedAt: {Type: field.TypeTime, Column: profile.FieldUpdatedAt},
|
|
profile.FieldName: {Type: field.TypeString, Column: profile.FieldName},
|
|
profile.FieldAddress: {Type: field.TypeString, Column: profile.FieldAddress},
|
|
profile.FieldPhone: {Type: field.TypeString, Column: profile.FieldPhone},
|
|
},
|
|
}
|
|
graph.MustAddE(
|
|
"posts",
|
|
&sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: category.PostsTable,
|
|
Columns: []string{category.PostsColumn},
|
|
Bidi: false,
|
|
},
|
|
"Category",
|
|
"Post",
|
|
)
|
|
graph.MustAddE(
|
|
"category",
|
|
&sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: post.CategoryTable,
|
|
Columns: []string{post.CategoryColumn},
|
|
Bidi: false,
|
|
},
|
|
"Post",
|
|
"Category",
|
|
)
|
|
graph.MustAddE(
|
|
"profile",
|
|
&sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.M2O,
|
|
Inverse: true,
|
|
Table: post.ProfileTable,
|
|
Columns: []string{post.ProfileColumn},
|
|
Bidi: false,
|
|
},
|
|
"Post",
|
|
"Profile",
|
|
)
|
|
graph.MustAddE(
|
|
"posts",
|
|
&sqlgraph.EdgeSpec{
|
|
Rel: sqlgraph.O2M,
|
|
Inverse: false,
|
|
Table: profile.PostsTable,
|
|
Columns: []string{profile.PostsColumn},
|
|
Bidi: false,
|
|
},
|
|
"Profile",
|
|
"Post",
|
|
)
|
|
return graph
|
|
}()
|
|
|
|
// predicateAdder wraps the addPredicate method.
|
|
// All update, update-one and query builders implement this interface.
|
|
type predicateAdder interface {
|
|
addPredicate(func(s *sql.Selector))
|
|
}
|
|
|
|
// addPredicate implements the predicateAdder interface.
|
|
func (cq *CategoryQuery) addPredicate(pred func(s *sql.Selector)) {
|
|
cq.predicates = append(cq.predicates, pred)
|
|
}
|
|
|
|
// Filter returns a Filter implementation to apply filters on the CategoryQuery builder.
|
|
func (cq *CategoryQuery) Filter() *CategoryFilter {
|
|
return &CategoryFilter{config: cq.config, predicateAdder: cq}
|
|
}
|
|
|
|
// addPredicate implements the predicateAdder interface.
|
|
func (m *CategoryMutation) addPredicate(pred func(s *sql.Selector)) {
|
|
m.predicates = append(m.predicates, pred)
|
|
}
|
|
|
|
// Filter returns an entql.Where implementation to apply filters on the CategoryMutation builder.
|
|
func (m *CategoryMutation) Filter() *CategoryFilter {
|
|
return &CategoryFilter{config: m.config, predicateAdder: m}
|
|
}
|
|
|
|
// CategoryFilter provides a generic filtering capability at runtime for CategoryQuery.
|
|
type CategoryFilter struct {
|
|
predicateAdder
|
|
config
|
|
}
|
|
|
|
// Where applies the entql predicate on the query filter.
|
|
func (f *CategoryFilter) Where(p entql.P) {
|
|
f.addPredicate(func(s *sql.Selector) {
|
|
if err := schemaGraph.EvalP(schemaGraph.Nodes[0].Type, p, s); err != nil {
|
|
s.AddError(err)
|
|
}
|
|
})
|
|
}
|
|
|
|
// WhereID applies the entql [16]byte predicate on the id field.
|
|
func (f *CategoryFilter) WhereID(p entql.ValueP) {
|
|
f.Where(p.Field(category.FieldID))
|
|
}
|
|
|
|
// WhereCreatedAt applies the entql time.Time predicate on the created_at field.
|
|
func (f *CategoryFilter) WhereCreatedAt(p entql.TimeP) {
|
|
f.Where(p.Field(category.FieldCreatedAt))
|
|
}
|
|
|
|
// WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.
|
|
func (f *CategoryFilter) WhereUpdatedAt(p entql.TimeP) {
|
|
f.Where(p.Field(category.FieldUpdatedAt))
|
|
}
|
|
|
|
// WhereTitle applies the entql string predicate on the title field.
|
|
func (f *CategoryFilter) WhereTitle(p entql.StringP) {
|
|
f.Where(p.Field(category.FieldTitle))
|
|
}
|
|
|
|
// WhereDescription applies the entql string predicate on the description field.
|
|
func (f *CategoryFilter) WhereDescription(p entql.StringP) {
|
|
f.Where(p.Field(category.FieldDescription))
|
|
}
|
|
|
|
// WhereHasPosts applies a predicate to check if query has an edge posts.
|
|
func (f *CategoryFilter) WhereHasPosts() {
|
|
f.Where(entql.HasEdge("posts"))
|
|
}
|
|
|
|
// WhereHasPostsWith applies a predicate to check if query has an edge posts with a given conditions (other predicates).
|
|
func (f *CategoryFilter) WhereHasPostsWith(preds ...predicate.Post) {
|
|
f.Where(entql.HasEdgeWith("posts", sqlgraph.WrapFunc(func(s *sql.Selector) {
|
|
for _, p := range preds {
|
|
p(s)
|
|
}
|
|
})))
|
|
}
|
|
|
|
// addPredicate implements the predicateAdder interface.
|
|
func (pq *PostQuery) addPredicate(pred func(s *sql.Selector)) {
|
|
pq.predicates = append(pq.predicates, pred)
|
|
}
|
|
|
|
// Filter returns a Filter implementation to apply filters on the PostQuery builder.
|
|
func (pq *PostQuery) Filter() *PostFilter {
|
|
return &PostFilter{config: pq.config, predicateAdder: pq}
|
|
}
|
|
|
|
// addPredicate implements the predicateAdder interface.
|
|
func (m *PostMutation) addPredicate(pred func(s *sql.Selector)) {
|
|
m.predicates = append(m.predicates, pred)
|
|
}
|
|
|
|
// Filter returns an entql.Where implementation to apply filters on the PostMutation builder.
|
|
func (m *PostMutation) Filter() *PostFilter {
|
|
return &PostFilter{config: m.config, predicateAdder: m}
|
|
}
|
|
|
|
// PostFilter provides a generic filtering capability at runtime for PostQuery.
|
|
type PostFilter struct {
|
|
predicateAdder
|
|
config
|
|
}
|
|
|
|
// Where applies the entql predicate on the query filter.
|
|
func (f *PostFilter) Where(p entql.P) {
|
|
f.addPredicate(func(s *sql.Selector) {
|
|
if err := schemaGraph.EvalP(schemaGraph.Nodes[1].Type, p, s); err != nil {
|
|
s.AddError(err)
|
|
}
|
|
})
|
|
}
|
|
|
|
// WhereID applies the entql [16]byte predicate on the id field.
|
|
func (f *PostFilter) WhereID(p entql.ValueP) {
|
|
f.Where(p.Field(post.FieldID))
|
|
}
|
|
|
|
// WhereCreatedAt applies the entql time.Time predicate on the created_at field.
|
|
func (f *PostFilter) WhereCreatedAt(p entql.TimeP) {
|
|
f.Where(p.Field(post.FieldCreatedAt))
|
|
}
|
|
|
|
// WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.
|
|
func (f *PostFilter) WhereUpdatedAt(p entql.TimeP) {
|
|
f.Where(p.Field(post.FieldUpdatedAt))
|
|
}
|
|
|
|
// WhereExpires applies the entql bool predicate on the expires field.
|
|
func (f *PostFilter) WhereExpires(p entql.BoolP) {
|
|
f.Where(p.Field(post.FieldExpires))
|
|
}
|
|
|
|
// WhereExpireTime applies the entql time.Time predicate on the expire_time field.
|
|
func (f *PostFilter) WhereExpireTime(p entql.TimeP) {
|
|
f.Where(p.Field(post.FieldExpireTime))
|
|
}
|
|
|
|
// WhereTitle applies the entql string predicate on the title field.
|
|
func (f *PostFilter) WhereTitle(p entql.StringP) {
|
|
f.Where(p.Field(post.FieldTitle))
|
|
}
|
|
|
|
// WhereBody applies the entql string predicate on the body field.
|
|
func (f *PostFilter) WhereBody(p entql.StringP) {
|
|
f.Where(p.Field(post.FieldBody))
|
|
}
|
|
|
|
// WhereHasCategory applies a predicate to check if query has an edge category.
|
|
func (f *PostFilter) WhereHasCategory() {
|
|
f.Where(entql.HasEdge("category"))
|
|
}
|
|
|
|
// WhereHasCategoryWith applies a predicate to check if query has an edge category with a given conditions (other predicates).
|
|
func (f *PostFilter) WhereHasCategoryWith(preds ...predicate.Category) {
|
|
f.Where(entql.HasEdgeWith("category", sqlgraph.WrapFunc(func(s *sql.Selector) {
|
|
for _, p := range preds {
|
|
p(s)
|
|
}
|
|
})))
|
|
}
|
|
|
|
// WhereHasProfile applies a predicate to check if query has an edge profile.
|
|
func (f *PostFilter) WhereHasProfile() {
|
|
f.Where(entql.HasEdge("profile"))
|
|
}
|
|
|
|
// WhereHasProfileWith applies a predicate to check if query has an edge profile with a given conditions (other predicates).
|
|
func (f *PostFilter) WhereHasProfileWith(preds ...predicate.Profile) {
|
|
f.Where(entql.HasEdgeWith("profile", sqlgraph.WrapFunc(func(s *sql.Selector) {
|
|
for _, p := range preds {
|
|
p(s)
|
|
}
|
|
})))
|
|
}
|
|
|
|
// addPredicate implements the predicateAdder interface.
|
|
func (pq *ProfileQuery) addPredicate(pred func(s *sql.Selector)) {
|
|
pq.predicates = append(pq.predicates, pred)
|
|
}
|
|
|
|
// Filter returns a Filter implementation to apply filters on the ProfileQuery builder.
|
|
func (pq *ProfileQuery) Filter() *ProfileFilter {
|
|
return &ProfileFilter{config: pq.config, predicateAdder: pq}
|
|
}
|
|
|
|
// addPredicate implements the predicateAdder interface.
|
|
func (m *ProfileMutation) addPredicate(pred func(s *sql.Selector)) {
|
|
m.predicates = append(m.predicates, pred)
|
|
}
|
|
|
|
// Filter returns an entql.Where implementation to apply filters on the ProfileMutation builder.
|
|
func (m *ProfileMutation) Filter() *ProfileFilter {
|
|
return &ProfileFilter{config: m.config, predicateAdder: m}
|
|
}
|
|
|
|
// ProfileFilter provides a generic filtering capability at runtime for ProfileQuery.
|
|
type ProfileFilter struct {
|
|
predicateAdder
|
|
config
|
|
}
|
|
|
|
// Where applies the entql predicate on the query filter.
|
|
func (f *ProfileFilter) Where(p entql.P) {
|
|
f.addPredicate(func(s *sql.Selector) {
|
|
if err := schemaGraph.EvalP(schemaGraph.Nodes[2].Type, p, s); err != nil {
|
|
s.AddError(err)
|
|
}
|
|
})
|
|
}
|
|
|
|
// WhereID applies the entql [16]byte predicate on the id field.
|
|
func (f *ProfileFilter) WhereID(p entql.ValueP) {
|
|
f.Where(p.Field(profile.FieldID))
|
|
}
|
|
|
|
// WhereCreatedAt applies the entql time.Time predicate on the created_at field.
|
|
func (f *ProfileFilter) WhereCreatedAt(p entql.TimeP) {
|
|
f.Where(p.Field(profile.FieldCreatedAt))
|
|
}
|
|
|
|
// WhereUpdatedAt applies the entql time.Time predicate on the updated_at field.
|
|
func (f *ProfileFilter) WhereUpdatedAt(p entql.TimeP) {
|
|
f.Where(p.Field(profile.FieldUpdatedAt))
|
|
}
|
|
|
|
// WhereName applies the entql string predicate on the name field.
|
|
func (f *ProfileFilter) WhereName(p entql.StringP) {
|
|
f.Where(p.Field(profile.FieldName))
|
|
}
|
|
|
|
// WhereAddress applies the entql string predicate on the address field.
|
|
func (f *ProfileFilter) WhereAddress(p entql.StringP) {
|
|
f.Where(p.Field(profile.FieldAddress))
|
|
}
|
|
|
|
// WherePhone applies the entql string predicate on the phone field.
|
|
func (f *ProfileFilter) WherePhone(p entql.StringP) {
|
|
f.Where(p.Field(profile.FieldPhone))
|
|
}
|
|
|
|
// WhereHasPosts applies a predicate to check if query has an edge posts.
|
|
func (f *ProfileFilter) WhereHasPosts() {
|
|
f.Where(entql.HasEdge("posts"))
|
|
}
|
|
|
|
// WhereHasPostsWith applies a predicate to check if query has an edge posts with a given conditions (other predicates).
|
|
func (f *ProfileFilter) WhereHasPostsWith(preds ...predicate.Post) {
|
|
f.Where(entql.HasEdgeWith("posts", sqlgraph.WrapFunc(func(s *sql.Selector) {
|
|
for _, p := range preds {
|
|
p(s)
|
|
}
|
|
})))
|
|
}
|