ka/ent/gql_where_input.go

1166 lines
39 KiB
Go
Raw Normal View History

2024-10-04 20:22:25 +02:00
// Code generated by ent, DO NOT EDIT.
package ent
import (
"errors"
"fmt"
"time"
"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"
"github.com/google/uuid"
)
// CategoryWhereInput represents a where input for filtering Category queries.
type CategoryWhereInput struct {
Predicates []predicate.Category `json:"-"`
Not *CategoryWhereInput `json:"not,omitempty"`
Or []*CategoryWhereInput `json:"or,omitempty"`
And []*CategoryWhereInput `json:"and,omitempty"`
// "id" field predicates.
ID *uuid.UUID `json:"id,omitempty"`
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"`
IDIn []uuid.UUID `json:"idIn,omitempty"`
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"`
IDGT *uuid.UUID `json:"idGT,omitempty"`
IDGTE *uuid.UUID `json:"idGTE,omitempty"`
IDLT *uuid.UUID `json:"idLT,omitempty"`
IDLTE *uuid.UUID `json:"idLTE,omitempty"`
// "created_at" field predicates.
CreatedAt *time.Time `json:"createdAt,omitempty"`
CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"`
CreatedAtIn []time.Time `json:"createdAtIn,omitempty"`
CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"`
CreatedAtGT *time.Time `json:"createdAtGT,omitempty"`
CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"`
CreatedAtLT *time.Time `json:"createdAtLT,omitempty"`
CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"`
// "updated_at" field predicates.
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
UpdatedAtNEQ *time.Time `json:"updatedAtNEQ,omitempty"`
UpdatedAtIn []time.Time `json:"updatedAtIn,omitempty"`
UpdatedAtNotIn []time.Time `json:"updatedAtNotIn,omitempty"`
UpdatedAtGT *time.Time `json:"updatedAtGT,omitempty"`
UpdatedAtGTE *time.Time `json:"updatedAtGTE,omitempty"`
UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"`
UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"`
UpdatedAtIsNil bool `json:"updatedAtIsNil,omitempty"`
UpdatedAtNotNil bool `json:"updatedAtNotNil,omitempty"`
// "title" field predicates.
Title *string `json:"title,omitempty"`
TitleNEQ *string `json:"titleNEQ,omitempty"`
TitleIn []string `json:"titleIn,omitempty"`
TitleNotIn []string `json:"titleNotIn,omitempty"`
TitleGT *string `json:"titleGT,omitempty"`
TitleGTE *string `json:"titleGTE,omitempty"`
TitleLT *string `json:"titleLT,omitempty"`
TitleLTE *string `json:"titleLTE,omitempty"`
TitleContains *string `json:"titleContains,omitempty"`
TitleHasPrefix *string `json:"titleHasPrefix,omitempty"`
TitleHasSuffix *string `json:"titleHasSuffix,omitempty"`
TitleEqualFold *string `json:"titleEqualFold,omitempty"`
TitleContainsFold *string `json:"titleContainsFold,omitempty"`
// "description" field predicates.
Description *string `json:"description,omitempty"`
DescriptionNEQ *string `json:"descriptionNEQ,omitempty"`
DescriptionIn []string `json:"descriptionIn,omitempty"`
DescriptionNotIn []string `json:"descriptionNotIn,omitempty"`
DescriptionGT *string `json:"descriptionGT,omitempty"`
DescriptionGTE *string `json:"descriptionGTE,omitempty"`
DescriptionLT *string `json:"descriptionLT,omitempty"`
DescriptionLTE *string `json:"descriptionLTE,omitempty"`
DescriptionContains *string `json:"descriptionContains,omitempty"`
DescriptionHasPrefix *string `json:"descriptionHasPrefix,omitempty"`
DescriptionHasSuffix *string `json:"descriptionHasSuffix,omitempty"`
DescriptionIsNil bool `json:"descriptionIsNil,omitempty"`
DescriptionNotNil bool `json:"descriptionNotNil,omitempty"`
DescriptionEqualFold *string `json:"descriptionEqualFold,omitempty"`
DescriptionContainsFold *string `json:"descriptionContainsFold,omitempty"`
// "posts" edge predicates.
HasPosts *bool `json:"hasPosts,omitempty"`
HasPostsWith []*PostWhereInput `json:"hasPostsWith,omitempty"`
}
// AddPredicates adds custom predicates to the where input to be used during the filtering phase.
func (i *CategoryWhereInput) AddPredicates(predicates ...predicate.Category) {
i.Predicates = append(i.Predicates, predicates...)
}
// Filter applies the CategoryWhereInput filter on the CategoryQuery builder.
func (i *CategoryWhereInput) Filter(q *CategoryQuery) (*CategoryQuery, error) {
if i == nil {
return q, nil
}
p, err := i.P()
if err != nil {
if err == ErrEmptyCategoryWhereInput {
return q, nil
}
return nil, err
}
return q.Where(p), nil
}
// ErrEmptyCategoryWhereInput is returned in case the CategoryWhereInput is empty.
var ErrEmptyCategoryWhereInput = errors.New("ent: empty predicate CategoryWhereInput")
// P returns a predicate for filtering categories.
// An error is returned if the input is empty or invalid.
func (i *CategoryWhereInput) P() (predicate.Category, error) {
var predicates []predicate.Category
if i.Not != nil {
p, err := i.Not.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'not'", err)
}
predicates = append(predicates, category.Not(p))
}
switch n := len(i.Or); {
case n == 1:
p, err := i.Or[0].P()
if err != nil {
return nil, fmt.Errorf("%w: field 'or'", err)
}
predicates = append(predicates, p)
case n > 1:
or := make([]predicate.Category, 0, n)
for _, w := range i.Or {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'or'", err)
}
or = append(or, p)
}
predicates = append(predicates, category.Or(or...))
}
switch n := len(i.And); {
case n == 1:
p, err := i.And[0].P()
if err != nil {
return nil, fmt.Errorf("%w: field 'and'", err)
}
predicates = append(predicates, p)
case n > 1:
and := make([]predicate.Category, 0, n)
for _, w := range i.And {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'and'", err)
}
and = append(and, p)
}
predicates = append(predicates, category.And(and...))
}
predicates = append(predicates, i.Predicates...)
if i.ID != nil {
predicates = append(predicates, category.IDEQ(*i.ID))
}
if i.IDNEQ != nil {
predicates = append(predicates, category.IDNEQ(*i.IDNEQ))
}
if len(i.IDIn) > 0 {
predicates = append(predicates, category.IDIn(i.IDIn...))
}
if len(i.IDNotIn) > 0 {
predicates = append(predicates, category.IDNotIn(i.IDNotIn...))
}
if i.IDGT != nil {
predicates = append(predicates, category.IDGT(*i.IDGT))
}
if i.IDGTE != nil {
predicates = append(predicates, category.IDGTE(*i.IDGTE))
}
if i.IDLT != nil {
predicates = append(predicates, category.IDLT(*i.IDLT))
}
if i.IDLTE != nil {
predicates = append(predicates, category.IDLTE(*i.IDLTE))
}
if i.CreatedAt != nil {
predicates = append(predicates, category.CreatedAtEQ(*i.CreatedAt))
}
if i.CreatedAtNEQ != nil {
predicates = append(predicates, category.CreatedAtNEQ(*i.CreatedAtNEQ))
}
if len(i.CreatedAtIn) > 0 {
predicates = append(predicates, category.CreatedAtIn(i.CreatedAtIn...))
}
if len(i.CreatedAtNotIn) > 0 {
predicates = append(predicates, category.CreatedAtNotIn(i.CreatedAtNotIn...))
}
if i.CreatedAtGT != nil {
predicates = append(predicates, category.CreatedAtGT(*i.CreatedAtGT))
}
if i.CreatedAtGTE != nil {
predicates = append(predicates, category.CreatedAtGTE(*i.CreatedAtGTE))
}
if i.CreatedAtLT != nil {
predicates = append(predicates, category.CreatedAtLT(*i.CreatedAtLT))
}
if i.CreatedAtLTE != nil {
predicates = append(predicates, category.CreatedAtLTE(*i.CreatedAtLTE))
}
if i.UpdatedAt != nil {
predicates = append(predicates, category.UpdatedAtEQ(*i.UpdatedAt))
}
if i.UpdatedAtNEQ != nil {
predicates = append(predicates, category.UpdatedAtNEQ(*i.UpdatedAtNEQ))
}
if len(i.UpdatedAtIn) > 0 {
predicates = append(predicates, category.UpdatedAtIn(i.UpdatedAtIn...))
}
if len(i.UpdatedAtNotIn) > 0 {
predicates = append(predicates, category.UpdatedAtNotIn(i.UpdatedAtNotIn...))
}
if i.UpdatedAtGT != nil {
predicates = append(predicates, category.UpdatedAtGT(*i.UpdatedAtGT))
}
if i.UpdatedAtGTE != nil {
predicates = append(predicates, category.UpdatedAtGTE(*i.UpdatedAtGTE))
}
if i.UpdatedAtLT != nil {
predicates = append(predicates, category.UpdatedAtLT(*i.UpdatedAtLT))
}
if i.UpdatedAtLTE != nil {
predicates = append(predicates, category.UpdatedAtLTE(*i.UpdatedAtLTE))
}
if i.UpdatedAtIsNil {
predicates = append(predicates, category.UpdatedAtIsNil())
}
if i.UpdatedAtNotNil {
predicates = append(predicates, category.UpdatedAtNotNil())
}
if i.Title != nil {
predicates = append(predicates, category.TitleEQ(*i.Title))
}
if i.TitleNEQ != nil {
predicates = append(predicates, category.TitleNEQ(*i.TitleNEQ))
}
if len(i.TitleIn) > 0 {
predicates = append(predicates, category.TitleIn(i.TitleIn...))
}
if len(i.TitleNotIn) > 0 {
predicates = append(predicates, category.TitleNotIn(i.TitleNotIn...))
}
if i.TitleGT != nil {
predicates = append(predicates, category.TitleGT(*i.TitleGT))
}
if i.TitleGTE != nil {
predicates = append(predicates, category.TitleGTE(*i.TitleGTE))
}
if i.TitleLT != nil {
predicates = append(predicates, category.TitleLT(*i.TitleLT))
}
if i.TitleLTE != nil {
predicates = append(predicates, category.TitleLTE(*i.TitleLTE))
}
if i.TitleContains != nil {
predicates = append(predicates, category.TitleContains(*i.TitleContains))
}
if i.TitleHasPrefix != nil {
predicates = append(predicates, category.TitleHasPrefix(*i.TitleHasPrefix))
}
if i.TitleHasSuffix != nil {
predicates = append(predicates, category.TitleHasSuffix(*i.TitleHasSuffix))
}
if i.TitleEqualFold != nil {
predicates = append(predicates, category.TitleEqualFold(*i.TitleEqualFold))
}
if i.TitleContainsFold != nil {
predicates = append(predicates, category.TitleContainsFold(*i.TitleContainsFold))
}
if i.Description != nil {
predicates = append(predicates, category.DescriptionEQ(*i.Description))
}
if i.DescriptionNEQ != nil {
predicates = append(predicates, category.DescriptionNEQ(*i.DescriptionNEQ))
}
if len(i.DescriptionIn) > 0 {
predicates = append(predicates, category.DescriptionIn(i.DescriptionIn...))
}
if len(i.DescriptionNotIn) > 0 {
predicates = append(predicates, category.DescriptionNotIn(i.DescriptionNotIn...))
}
if i.DescriptionGT != nil {
predicates = append(predicates, category.DescriptionGT(*i.DescriptionGT))
}
if i.DescriptionGTE != nil {
predicates = append(predicates, category.DescriptionGTE(*i.DescriptionGTE))
}
if i.DescriptionLT != nil {
predicates = append(predicates, category.DescriptionLT(*i.DescriptionLT))
}
if i.DescriptionLTE != nil {
predicates = append(predicates, category.DescriptionLTE(*i.DescriptionLTE))
}
if i.DescriptionContains != nil {
predicates = append(predicates, category.DescriptionContains(*i.DescriptionContains))
}
if i.DescriptionHasPrefix != nil {
predicates = append(predicates, category.DescriptionHasPrefix(*i.DescriptionHasPrefix))
}
if i.DescriptionHasSuffix != nil {
predicates = append(predicates, category.DescriptionHasSuffix(*i.DescriptionHasSuffix))
}
if i.DescriptionIsNil {
predicates = append(predicates, category.DescriptionIsNil())
}
if i.DescriptionNotNil {
predicates = append(predicates, category.DescriptionNotNil())
}
if i.DescriptionEqualFold != nil {
predicates = append(predicates, category.DescriptionEqualFold(*i.DescriptionEqualFold))
}
if i.DescriptionContainsFold != nil {
predicates = append(predicates, category.DescriptionContainsFold(*i.DescriptionContainsFold))
}
if i.HasPosts != nil {
p := category.HasPosts()
if !*i.HasPosts {
p = category.Not(p)
}
predicates = append(predicates, p)
}
if len(i.HasPostsWith) > 0 {
with := make([]predicate.Post, 0, len(i.HasPostsWith))
for _, w := range i.HasPostsWith {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'HasPostsWith'", err)
}
with = append(with, p)
}
predicates = append(predicates, category.HasPostsWith(with...))
}
switch len(predicates) {
case 0:
return nil, ErrEmptyCategoryWhereInput
case 1:
return predicates[0], nil
default:
return category.And(predicates...), nil
}
}
// PostWhereInput represents a where input for filtering Post queries.
type PostWhereInput struct {
Predicates []predicate.Post `json:"-"`
Not *PostWhereInput `json:"not,omitempty"`
Or []*PostWhereInput `json:"or,omitempty"`
And []*PostWhereInput `json:"and,omitempty"`
// "id" field predicates.
ID *uuid.UUID `json:"id,omitempty"`
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"`
IDIn []uuid.UUID `json:"idIn,omitempty"`
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"`
IDGT *uuid.UUID `json:"idGT,omitempty"`
IDGTE *uuid.UUID `json:"idGTE,omitempty"`
IDLT *uuid.UUID `json:"idLT,omitempty"`
IDLTE *uuid.UUID `json:"idLTE,omitempty"`
// "created_at" field predicates.
CreatedAt *time.Time `json:"createdAt,omitempty"`
CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"`
CreatedAtIn []time.Time `json:"createdAtIn,omitempty"`
CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"`
CreatedAtGT *time.Time `json:"createdAtGT,omitempty"`
CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"`
CreatedAtLT *time.Time `json:"createdAtLT,omitempty"`
CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"`
// "updated_at" field predicates.
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
UpdatedAtNEQ *time.Time `json:"updatedAtNEQ,omitempty"`
UpdatedAtIn []time.Time `json:"updatedAtIn,omitempty"`
UpdatedAtNotIn []time.Time `json:"updatedAtNotIn,omitempty"`
UpdatedAtGT *time.Time `json:"updatedAtGT,omitempty"`
UpdatedAtGTE *time.Time `json:"updatedAtGTE,omitempty"`
UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"`
UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"`
UpdatedAtIsNil bool `json:"updatedAtIsNil,omitempty"`
UpdatedAtNotNil bool `json:"updatedAtNotNil,omitempty"`
// "expires" field predicates.
Expires *bool `json:"expires,omitempty"`
ExpiresNEQ *bool `json:"expiresNEQ,omitempty"`
// "expire_time" field predicates.
ExpireTime *time.Time `json:"expireTime,omitempty"`
ExpireTimeNEQ *time.Time `json:"expireTimeNEQ,omitempty"`
ExpireTimeIn []time.Time `json:"expireTimeIn,omitempty"`
ExpireTimeNotIn []time.Time `json:"expireTimeNotIn,omitempty"`
ExpireTimeGT *time.Time `json:"expireTimeGT,omitempty"`
ExpireTimeGTE *time.Time `json:"expireTimeGTE,omitempty"`
ExpireTimeLT *time.Time `json:"expireTimeLT,omitempty"`
ExpireTimeLTE *time.Time `json:"expireTimeLTE,omitempty"`
ExpireTimeIsNil bool `json:"expireTimeIsNil,omitempty"`
ExpireTimeNotNil bool `json:"expireTimeNotNil,omitempty"`
// "title" field predicates.
Title *string `json:"title,omitempty"`
TitleNEQ *string `json:"titleNEQ,omitempty"`
TitleIn []string `json:"titleIn,omitempty"`
TitleNotIn []string `json:"titleNotIn,omitempty"`
TitleGT *string `json:"titleGT,omitempty"`
TitleGTE *string `json:"titleGTE,omitempty"`
TitleLT *string `json:"titleLT,omitempty"`
TitleLTE *string `json:"titleLTE,omitempty"`
TitleContains *string `json:"titleContains,omitempty"`
TitleHasPrefix *string `json:"titleHasPrefix,omitempty"`
TitleHasSuffix *string `json:"titleHasSuffix,omitempty"`
TitleEqualFold *string `json:"titleEqualFold,omitempty"`
TitleContainsFold *string `json:"titleContainsFold,omitempty"`
// "body" field predicates.
Body *string `json:"body,omitempty"`
BodyNEQ *string `json:"bodyNEQ,omitempty"`
BodyIn []string `json:"bodyIn,omitempty"`
BodyNotIn []string `json:"bodyNotIn,omitempty"`
BodyGT *string `json:"bodyGT,omitempty"`
BodyGTE *string `json:"bodyGTE,omitempty"`
BodyLT *string `json:"bodyLT,omitempty"`
BodyLTE *string `json:"bodyLTE,omitempty"`
BodyContains *string `json:"bodyContains,omitempty"`
BodyHasPrefix *string `json:"bodyHasPrefix,omitempty"`
BodyHasSuffix *string `json:"bodyHasSuffix,omitempty"`
BodyEqualFold *string `json:"bodyEqualFold,omitempty"`
BodyContainsFold *string `json:"bodyContainsFold,omitempty"`
// "category" edge predicates.
HasCategory *bool `json:"hasCategory,omitempty"`
HasCategoryWith []*CategoryWhereInput `json:"hasCategoryWith,omitempty"`
// "profile" edge predicates.
HasProfile *bool `json:"hasProfile,omitempty"`
HasProfileWith []*ProfileWhereInput `json:"hasProfileWith,omitempty"`
}
// AddPredicates adds custom predicates to the where input to be used during the filtering phase.
func (i *PostWhereInput) AddPredicates(predicates ...predicate.Post) {
i.Predicates = append(i.Predicates, predicates...)
}
// Filter applies the PostWhereInput filter on the PostQuery builder.
func (i *PostWhereInput) Filter(q *PostQuery) (*PostQuery, error) {
if i == nil {
return q, nil
}
p, err := i.P()
if err != nil {
if err == ErrEmptyPostWhereInput {
return q, nil
}
return nil, err
}
return q.Where(p), nil
}
// ErrEmptyPostWhereInput is returned in case the PostWhereInput is empty.
var ErrEmptyPostWhereInput = errors.New("ent: empty predicate PostWhereInput")
// P returns a predicate for filtering posts.
// An error is returned if the input is empty or invalid.
func (i *PostWhereInput) P() (predicate.Post, error) {
var predicates []predicate.Post
if i.Not != nil {
p, err := i.Not.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'not'", err)
}
predicates = append(predicates, post.Not(p))
}
switch n := len(i.Or); {
case n == 1:
p, err := i.Or[0].P()
if err != nil {
return nil, fmt.Errorf("%w: field 'or'", err)
}
predicates = append(predicates, p)
case n > 1:
or := make([]predicate.Post, 0, n)
for _, w := range i.Or {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'or'", err)
}
or = append(or, p)
}
predicates = append(predicates, post.Or(or...))
}
switch n := len(i.And); {
case n == 1:
p, err := i.And[0].P()
if err != nil {
return nil, fmt.Errorf("%w: field 'and'", err)
}
predicates = append(predicates, p)
case n > 1:
and := make([]predicate.Post, 0, n)
for _, w := range i.And {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'and'", err)
}
and = append(and, p)
}
predicates = append(predicates, post.And(and...))
}
predicates = append(predicates, i.Predicates...)
if i.ID != nil {
predicates = append(predicates, post.IDEQ(*i.ID))
}
if i.IDNEQ != nil {
predicates = append(predicates, post.IDNEQ(*i.IDNEQ))
}
if len(i.IDIn) > 0 {
predicates = append(predicates, post.IDIn(i.IDIn...))
}
if len(i.IDNotIn) > 0 {
predicates = append(predicates, post.IDNotIn(i.IDNotIn...))
}
if i.IDGT != nil {
predicates = append(predicates, post.IDGT(*i.IDGT))
}
if i.IDGTE != nil {
predicates = append(predicates, post.IDGTE(*i.IDGTE))
}
if i.IDLT != nil {
predicates = append(predicates, post.IDLT(*i.IDLT))
}
if i.IDLTE != nil {
predicates = append(predicates, post.IDLTE(*i.IDLTE))
}
if i.CreatedAt != nil {
predicates = append(predicates, post.CreatedAtEQ(*i.CreatedAt))
}
if i.CreatedAtNEQ != nil {
predicates = append(predicates, post.CreatedAtNEQ(*i.CreatedAtNEQ))
}
if len(i.CreatedAtIn) > 0 {
predicates = append(predicates, post.CreatedAtIn(i.CreatedAtIn...))
}
if len(i.CreatedAtNotIn) > 0 {
predicates = append(predicates, post.CreatedAtNotIn(i.CreatedAtNotIn...))
}
if i.CreatedAtGT != nil {
predicates = append(predicates, post.CreatedAtGT(*i.CreatedAtGT))
}
if i.CreatedAtGTE != nil {
predicates = append(predicates, post.CreatedAtGTE(*i.CreatedAtGTE))
}
if i.CreatedAtLT != nil {
predicates = append(predicates, post.CreatedAtLT(*i.CreatedAtLT))
}
if i.CreatedAtLTE != nil {
predicates = append(predicates, post.CreatedAtLTE(*i.CreatedAtLTE))
}
if i.UpdatedAt != nil {
predicates = append(predicates, post.UpdatedAtEQ(*i.UpdatedAt))
}
if i.UpdatedAtNEQ != nil {
predicates = append(predicates, post.UpdatedAtNEQ(*i.UpdatedAtNEQ))
}
if len(i.UpdatedAtIn) > 0 {
predicates = append(predicates, post.UpdatedAtIn(i.UpdatedAtIn...))
}
if len(i.UpdatedAtNotIn) > 0 {
predicates = append(predicates, post.UpdatedAtNotIn(i.UpdatedAtNotIn...))
}
if i.UpdatedAtGT != nil {
predicates = append(predicates, post.UpdatedAtGT(*i.UpdatedAtGT))
}
if i.UpdatedAtGTE != nil {
predicates = append(predicates, post.UpdatedAtGTE(*i.UpdatedAtGTE))
}
if i.UpdatedAtLT != nil {
predicates = append(predicates, post.UpdatedAtLT(*i.UpdatedAtLT))
}
if i.UpdatedAtLTE != nil {
predicates = append(predicates, post.UpdatedAtLTE(*i.UpdatedAtLTE))
}
if i.UpdatedAtIsNil {
predicates = append(predicates, post.UpdatedAtIsNil())
}
if i.UpdatedAtNotNil {
predicates = append(predicates, post.UpdatedAtNotNil())
}
if i.Expires != nil {
predicates = append(predicates, post.ExpiresEQ(*i.Expires))
}
if i.ExpiresNEQ != nil {
predicates = append(predicates, post.ExpiresNEQ(*i.ExpiresNEQ))
}
if i.ExpireTime != nil {
predicates = append(predicates, post.ExpireTimeEQ(*i.ExpireTime))
}
if i.ExpireTimeNEQ != nil {
predicates = append(predicates, post.ExpireTimeNEQ(*i.ExpireTimeNEQ))
}
if len(i.ExpireTimeIn) > 0 {
predicates = append(predicates, post.ExpireTimeIn(i.ExpireTimeIn...))
}
if len(i.ExpireTimeNotIn) > 0 {
predicates = append(predicates, post.ExpireTimeNotIn(i.ExpireTimeNotIn...))
}
if i.ExpireTimeGT != nil {
predicates = append(predicates, post.ExpireTimeGT(*i.ExpireTimeGT))
}
if i.ExpireTimeGTE != nil {
predicates = append(predicates, post.ExpireTimeGTE(*i.ExpireTimeGTE))
}
if i.ExpireTimeLT != nil {
predicates = append(predicates, post.ExpireTimeLT(*i.ExpireTimeLT))
}
if i.ExpireTimeLTE != nil {
predicates = append(predicates, post.ExpireTimeLTE(*i.ExpireTimeLTE))
}
if i.ExpireTimeIsNil {
predicates = append(predicates, post.ExpireTimeIsNil())
}
if i.ExpireTimeNotNil {
predicates = append(predicates, post.ExpireTimeNotNil())
}
if i.Title != nil {
predicates = append(predicates, post.TitleEQ(*i.Title))
}
if i.TitleNEQ != nil {
predicates = append(predicates, post.TitleNEQ(*i.TitleNEQ))
}
if len(i.TitleIn) > 0 {
predicates = append(predicates, post.TitleIn(i.TitleIn...))
}
if len(i.TitleNotIn) > 0 {
predicates = append(predicates, post.TitleNotIn(i.TitleNotIn...))
}
if i.TitleGT != nil {
predicates = append(predicates, post.TitleGT(*i.TitleGT))
}
if i.TitleGTE != nil {
predicates = append(predicates, post.TitleGTE(*i.TitleGTE))
}
if i.TitleLT != nil {
predicates = append(predicates, post.TitleLT(*i.TitleLT))
}
if i.TitleLTE != nil {
predicates = append(predicates, post.TitleLTE(*i.TitleLTE))
}
if i.TitleContains != nil {
predicates = append(predicates, post.TitleContains(*i.TitleContains))
}
if i.TitleHasPrefix != nil {
predicates = append(predicates, post.TitleHasPrefix(*i.TitleHasPrefix))
}
if i.TitleHasSuffix != nil {
predicates = append(predicates, post.TitleHasSuffix(*i.TitleHasSuffix))
}
if i.TitleEqualFold != nil {
predicates = append(predicates, post.TitleEqualFold(*i.TitleEqualFold))
}
if i.TitleContainsFold != nil {
predicates = append(predicates, post.TitleContainsFold(*i.TitleContainsFold))
}
if i.Body != nil {
predicates = append(predicates, post.BodyEQ(*i.Body))
}
if i.BodyNEQ != nil {
predicates = append(predicates, post.BodyNEQ(*i.BodyNEQ))
}
if len(i.BodyIn) > 0 {
predicates = append(predicates, post.BodyIn(i.BodyIn...))
}
if len(i.BodyNotIn) > 0 {
predicates = append(predicates, post.BodyNotIn(i.BodyNotIn...))
}
if i.BodyGT != nil {
predicates = append(predicates, post.BodyGT(*i.BodyGT))
}
if i.BodyGTE != nil {
predicates = append(predicates, post.BodyGTE(*i.BodyGTE))
}
if i.BodyLT != nil {
predicates = append(predicates, post.BodyLT(*i.BodyLT))
}
if i.BodyLTE != nil {
predicates = append(predicates, post.BodyLTE(*i.BodyLTE))
}
if i.BodyContains != nil {
predicates = append(predicates, post.BodyContains(*i.BodyContains))
}
if i.BodyHasPrefix != nil {
predicates = append(predicates, post.BodyHasPrefix(*i.BodyHasPrefix))
}
if i.BodyHasSuffix != nil {
predicates = append(predicates, post.BodyHasSuffix(*i.BodyHasSuffix))
}
if i.BodyEqualFold != nil {
predicates = append(predicates, post.BodyEqualFold(*i.BodyEqualFold))
}
if i.BodyContainsFold != nil {
predicates = append(predicates, post.BodyContainsFold(*i.BodyContainsFold))
}
if i.HasCategory != nil {
p := post.HasCategory()
if !*i.HasCategory {
p = post.Not(p)
}
predicates = append(predicates, p)
}
if len(i.HasCategoryWith) > 0 {
with := make([]predicate.Category, 0, len(i.HasCategoryWith))
for _, w := range i.HasCategoryWith {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'HasCategoryWith'", err)
}
with = append(with, p)
}
predicates = append(predicates, post.HasCategoryWith(with...))
}
if i.HasProfile != nil {
p := post.HasProfile()
if !*i.HasProfile {
p = post.Not(p)
}
predicates = append(predicates, p)
}
if len(i.HasProfileWith) > 0 {
with := make([]predicate.Profile, 0, len(i.HasProfileWith))
for _, w := range i.HasProfileWith {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'HasProfileWith'", err)
}
with = append(with, p)
}
predicates = append(predicates, post.HasProfileWith(with...))
}
switch len(predicates) {
case 0:
return nil, ErrEmptyPostWhereInput
case 1:
return predicates[0], nil
default:
return post.And(predicates...), nil
}
}
// ProfileWhereInput represents a where input for filtering Profile queries.
type ProfileWhereInput struct {
Predicates []predicate.Profile `json:"-"`
Not *ProfileWhereInput `json:"not,omitempty"`
Or []*ProfileWhereInput `json:"or,omitempty"`
And []*ProfileWhereInput `json:"and,omitempty"`
// "id" field predicates.
ID *uuid.UUID `json:"id,omitempty"`
IDNEQ *uuid.UUID `json:"idNEQ,omitempty"`
IDIn []uuid.UUID `json:"idIn,omitempty"`
IDNotIn []uuid.UUID `json:"idNotIn,omitempty"`
IDGT *uuid.UUID `json:"idGT,omitempty"`
IDGTE *uuid.UUID `json:"idGTE,omitempty"`
IDLT *uuid.UUID `json:"idLT,omitempty"`
IDLTE *uuid.UUID `json:"idLTE,omitempty"`
// "created_at" field predicates.
CreatedAt *time.Time `json:"createdAt,omitempty"`
CreatedAtNEQ *time.Time `json:"createdAtNEQ,omitempty"`
CreatedAtIn []time.Time `json:"createdAtIn,omitempty"`
CreatedAtNotIn []time.Time `json:"createdAtNotIn,omitempty"`
CreatedAtGT *time.Time `json:"createdAtGT,omitempty"`
CreatedAtGTE *time.Time `json:"createdAtGTE,omitempty"`
CreatedAtLT *time.Time `json:"createdAtLT,omitempty"`
CreatedAtLTE *time.Time `json:"createdAtLTE,omitempty"`
// "updated_at" field predicates.
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
UpdatedAtNEQ *time.Time `json:"updatedAtNEQ,omitempty"`
UpdatedAtIn []time.Time `json:"updatedAtIn,omitempty"`
UpdatedAtNotIn []time.Time `json:"updatedAtNotIn,omitempty"`
UpdatedAtGT *time.Time `json:"updatedAtGT,omitempty"`
UpdatedAtGTE *time.Time `json:"updatedAtGTE,omitempty"`
UpdatedAtLT *time.Time `json:"updatedAtLT,omitempty"`
UpdatedAtLTE *time.Time `json:"updatedAtLTE,omitempty"`
UpdatedAtIsNil bool `json:"updatedAtIsNil,omitempty"`
UpdatedAtNotNil bool `json:"updatedAtNotNil,omitempty"`
// "name" field predicates.
Name *string `json:"name,omitempty"`
NameNEQ *string `json:"nameNEQ,omitempty"`
NameIn []string `json:"nameIn,omitempty"`
NameNotIn []string `json:"nameNotIn,omitempty"`
NameGT *string `json:"nameGT,omitempty"`
NameGTE *string `json:"nameGTE,omitempty"`
NameLT *string `json:"nameLT,omitempty"`
NameLTE *string `json:"nameLTE,omitempty"`
NameContains *string `json:"nameContains,omitempty"`
NameHasPrefix *string `json:"nameHasPrefix,omitempty"`
NameHasSuffix *string `json:"nameHasSuffix,omitempty"`
NameIsNil bool `json:"nameIsNil,omitempty"`
NameNotNil bool `json:"nameNotNil,omitempty"`
NameEqualFold *string `json:"nameEqualFold,omitempty"`
NameContainsFold *string `json:"nameContainsFold,omitempty"`
// "address" field predicates.
Address *string `json:"address,omitempty"`
AddressNEQ *string `json:"addressNEQ,omitempty"`
AddressIn []string `json:"addressIn,omitempty"`
AddressNotIn []string `json:"addressNotIn,omitempty"`
AddressGT *string `json:"addressGT,omitempty"`
AddressGTE *string `json:"addressGTE,omitempty"`
AddressLT *string `json:"addressLT,omitempty"`
AddressLTE *string `json:"addressLTE,omitempty"`
AddressContains *string `json:"addressContains,omitempty"`
AddressHasPrefix *string `json:"addressHasPrefix,omitempty"`
AddressHasSuffix *string `json:"addressHasSuffix,omitempty"`
AddressIsNil bool `json:"addressIsNil,omitempty"`
AddressNotNil bool `json:"addressNotNil,omitempty"`
AddressEqualFold *string `json:"addressEqualFold,omitempty"`
AddressContainsFold *string `json:"addressContainsFold,omitempty"`
// "phone" field predicates.
Phone *string `json:"phone,omitempty"`
PhoneNEQ *string `json:"phoneNEQ,omitempty"`
PhoneIn []string `json:"phoneIn,omitempty"`
PhoneNotIn []string `json:"phoneNotIn,omitempty"`
PhoneGT *string `json:"phoneGT,omitempty"`
PhoneGTE *string `json:"phoneGTE,omitempty"`
PhoneLT *string `json:"phoneLT,omitempty"`
PhoneLTE *string `json:"phoneLTE,omitempty"`
PhoneContains *string `json:"phoneContains,omitempty"`
PhoneHasPrefix *string `json:"phoneHasPrefix,omitempty"`
PhoneHasSuffix *string `json:"phoneHasSuffix,omitempty"`
PhoneIsNil bool `json:"phoneIsNil,omitempty"`
PhoneNotNil bool `json:"phoneNotNil,omitempty"`
PhoneEqualFold *string `json:"phoneEqualFold,omitempty"`
PhoneContainsFold *string `json:"phoneContainsFold,omitempty"`
// "posts" edge predicates.
HasPosts *bool `json:"hasPosts,omitempty"`
HasPostsWith []*PostWhereInput `json:"hasPostsWith,omitempty"`
}
// AddPredicates adds custom predicates to the where input to be used during the filtering phase.
func (i *ProfileWhereInput) AddPredicates(predicates ...predicate.Profile) {
i.Predicates = append(i.Predicates, predicates...)
}
// Filter applies the ProfileWhereInput filter on the ProfileQuery builder.
func (i *ProfileWhereInput) Filter(q *ProfileQuery) (*ProfileQuery, error) {
if i == nil {
return q, nil
}
p, err := i.P()
if err != nil {
if err == ErrEmptyProfileWhereInput {
return q, nil
}
return nil, err
}
return q.Where(p), nil
}
// ErrEmptyProfileWhereInput is returned in case the ProfileWhereInput is empty.
var ErrEmptyProfileWhereInput = errors.New("ent: empty predicate ProfileWhereInput")
// P returns a predicate for filtering profiles.
// An error is returned if the input is empty or invalid.
func (i *ProfileWhereInput) P() (predicate.Profile, error) {
var predicates []predicate.Profile
if i.Not != nil {
p, err := i.Not.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'not'", err)
}
predicates = append(predicates, profile.Not(p))
}
switch n := len(i.Or); {
case n == 1:
p, err := i.Or[0].P()
if err != nil {
return nil, fmt.Errorf("%w: field 'or'", err)
}
predicates = append(predicates, p)
case n > 1:
or := make([]predicate.Profile, 0, n)
for _, w := range i.Or {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'or'", err)
}
or = append(or, p)
}
predicates = append(predicates, profile.Or(or...))
}
switch n := len(i.And); {
case n == 1:
p, err := i.And[0].P()
if err != nil {
return nil, fmt.Errorf("%w: field 'and'", err)
}
predicates = append(predicates, p)
case n > 1:
and := make([]predicate.Profile, 0, n)
for _, w := range i.And {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'and'", err)
}
and = append(and, p)
}
predicates = append(predicates, profile.And(and...))
}
predicates = append(predicates, i.Predicates...)
if i.ID != nil {
predicates = append(predicates, profile.IDEQ(*i.ID))
}
if i.IDNEQ != nil {
predicates = append(predicates, profile.IDNEQ(*i.IDNEQ))
}
if len(i.IDIn) > 0 {
predicates = append(predicates, profile.IDIn(i.IDIn...))
}
if len(i.IDNotIn) > 0 {
predicates = append(predicates, profile.IDNotIn(i.IDNotIn...))
}
if i.IDGT != nil {
predicates = append(predicates, profile.IDGT(*i.IDGT))
}
if i.IDGTE != nil {
predicates = append(predicates, profile.IDGTE(*i.IDGTE))
}
if i.IDLT != nil {
predicates = append(predicates, profile.IDLT(*i.IDLT))
}
if i.IDLTE != nil {
predicates = append(predicates, profile.IDLTE(*i.IDLTE))
}
if i.CreatedAt != nil {
predicates = append(predicates, profile.CreatedAtEQ(*i.CreatedAt))
}
if i.CreatedAtNEQ != nil {
predicates = append(predicates, profile.CreatedAtNEQ(*i.CreatedAtNEQ))
}
if len(i.CreatedAtIn) > 0 {
predicates = append(predicates, profile.CreatedAtIn(i.CreatedAtIn...))
}
if len(i.CreatedAtNotIn) > 0 {
predicates = append(predicates, profile.CreatedAtNotIn(i.CreatedAtNotIn...))
}
if i.CreatedAtGT != nil {
predicates = append(predicates, profile.CreatedAtGT(*i.CreatedAtGT))
}
if i.CreatedAtGTE != nil {
predicates = append(predicates, profile.CreatedAtGTE(*i.CreatedAtGTE))
}
if i.CreatedAtLT != nil {
predicates = append(predicates, profile.CreatedAtLT(*i.CreatedAtLT))
}
if i.CreatedAtLTE != nil {
predicates = append(predicates, profile.CreatedAtLTE(*i.CreatedAtLTE))
}
if i.UpdatedAt != nil {
predicates = append(predicates, profile.UpdatedAtEQ(*i.UpdatedAt))
}
if i.UpdatedAtNEQ != nil {
predicates = append(predicates, profile.UpdatedAtNEQ(*i.UpdatedAtNEQ))
}
if len(i.UpdatedAtIn) > 0 {
predicates = append(predicates, profile.UpdatedAtIn(i.UpdatedAtIn...))
}
if len(i.UpdatedAtNotIn) > 0 {
predicates = append(predicates, profile.UpdatedAtNotIn(i.UpdatedAtNotIn...))
}
if i.UpdatedAtGT != nil {
predicates = append(predicates, profile.UpdatedAtGT(*i.UpdatedAtGT))
}
if i.UpdatedAtGTE != nil {
predicates = append(predicates, profile.UpdatedAtGTE(*i.UpdatedAtGTE))
}
if i.UpdatedAtLT != nil {
predicates = append(predicates, profile.UpdatedAtLT(*i.UpdatedAtLT))
}
if i.UpdatedAtLTE != nil {
predicates = append(predicates, profile.UpdatedAtLTE(*i.UpdatedAtLTE))
}
if i.UpdatedAtIsNil {
predicates = append(predicates, profile.UpdatedAtIsNil())
}
if i.UpdatedAtNotNil {
predicates = append(predicates, profile.UpdatedAtNotNil())
}
if i.Name != nil {
predicates = append(predicates, profile.NameEQ(*i.Name))
}
if i.NameNEQ != nil {
predicates = append(predicates, profile.NameNEQ(*i.NameNEQ))
}
if len(i.NameIn) > 0 {
predicates = append(predicates, profile.NameIn(i.NameIn...))
}
if len(i.NameNotIn) > 0 {
predicates = append(predicates, profile.NameNotIn(i.NameNotIn...))
}
if i.NameGT != nil {
predicates = append(predicates, profile.NameGT(*i.NameGT))
}
if i.NameGTE != nil {
predicates = append(predicates, profile.NameGTE(*i.NameGTE))
}
if i.NameLT != nil {
predicates = append(predicates, profile.NameLT(*i.NameLT))
}
if i.NameLTE != nil {
predicates = append(predicates, profile.NameLTE(*i.NameLTE))
}
if i.NameContains != nil {
predicates = append(predicates, profile.NameContains(*i.NameContains))
}
if i.NameHasPrefix != nil {
predicates = append(predicates, profile.NameHasPrefix(*i.NameHasPrefix))
}
if i.NameHasSuffix != nil {
predicates = append(predicates, profile.NameHasSuffix(*i.NameHasSuffix))
}
if i.NameIsNil {
predicates = append(predicates, profile.NameIsNil())
}
if i.NameNotNil {
predicates = append(predicates, profile.NameNotNil())
}
if i.NameEqualFold != nil {
predicates = append(predicates, profile.NameEqualFold(*i.NameEqualFold))
}
if i.NameContainsFold != nil {
predicates = append(predicates, profile.NameContainsFold(*i.NameContainsFold))
}
if i.Address != nil {
predicates = append(predicates, profile.AddressEQ(*i.Address))
}
if i.AddressNEQ != nil {
predicates = append(predicates, profile.AddressNEQ(*i.AddressNEQ))
}
if len(i.AddressIn) > 0 {
predicates = append(predicates, profile.AddressIn(i.AddressIn...))
}
if len(i.AddressNotIn) > 0 {
predicates = append(predicates, profile.AddressNotIn(i.AddressNotIn...))
}
if i.AddressGT != nil {
predicates = append(predicates, profile.AddressGT(*i.AddressGT))
}
if i.AddressGTE != nil {
predicates = append(predicates, profile.AddressGTE(*i.AddressGTE))
}
if i.AddressLT != nil {
predicates = append(predicates, profile.AddressLT(*i.AddressLT))
}
if i.AddressLTE != nil {
predicates = append(predicates, profile.AddressLTE(*i.AddressLTE))
}
if i.AddressContains != nil {
predicates = append(predicates, profile.AddressContains(*i.AddressContains))
}
if i.AddressHasPrefix != nil {
predicates = append(predicates, profile.AddressHasPrefix(*i.AddressHasPrefix))
}
if i.AddressHasSuffix != nil {
predicates = append(predicates, profile.AddressHasSuffix(*i.AddressHasSuffix))
}
if i.AddressIsNil {
predicates = append(predicates, profile.AddressIsNil())
}
if i.AddressNotNil {
predicates = append(predicates, profile.AddressNotNil())
}
if i.AddressEqualFold != nil {
predicates = append(predicates, profile.AddressEqualFold(*i.AddressEqualFold))
}
if i.AddressContainsFold != nil {
predicates = append(predicates, profile.AddressContainsFold(*i.AddressContainsFold))
}
if i.Phone != nil {
predicates = append(predicates, profile.PhoneEQ(*i.Phone))
}
if i.PhoneNEQ != nil {
predicates = append(predicates, profile.PhoneNEQ(*i.PhoneNEQ))
}
if len(i.PhoneIn) > 0 {
predicates = append(predicates, profile.PhoneIn(i.PhoneIn...))
}
if len(i.PhoneNotIn) > 0 {
predicates = append(predicates, profile.PhoneNotIn(i.PhoneNotIn...))
}
if i.PhoneGT != nil {
predicates = append(predicates, profile.PhoneGT(*i.PhoneGT))
}
if i.PhoneGTE != nil {
predicates = append(predicates, profile.PhoneGTE(*i.PhoneGTE))
}
if i.PhoneLT != nil {
predicates = append(predicates, profile.PhoneLT(*i.PhoneLT))
}
if i.PhoneLTE != nil {
predicates = append(predicates, profile.PhoneLTE(*i.PhoneLTE))
}
if i.PhoneContains != nil {
predicates = append(predicates, profile.PhoneContains(*i.PhoneContains))
}
if i.PhoneHasPrefix != nil {
predicates = append(predicates, profile.PhoneHasPrefix(*i.PhoneHasPrefix))
}
if i.PhoneHasSuffix != nil {
predicates = append(predicates, profile.PhoneHasSuffix(*i.PhoneHasSuffix))
}
if i.PhoneIsNil {
predicates = append(predicates, profile.PhoneIsNil())
}
if i.PhoneNotNil {
predicates = append(predicates, profile.PhoneNotNil())
}
if i.PhoneEqualFold != nil {
predicates = append(predicates, profile.PhoneEqualFold(*i.PhoneEqualFold))
}
if i.PhoneContainsFold != nil {
predicates = append(predicates, profile.PhoneContainsFold(*i.PhoneContainsFold))
}
if i.HasPosts != nil {
p := profile.HasPosts()
if !*i.HasPosts {
p = profile.Not(p)
}
predicates = append(predicates, p)
}
if len(i.HasPostsWith) > 0 {
with := make([]predicate.Post, 0, len(i.HasPostsWith))
for _, w := range i.HasPostsWith {
p, err := w.P()
if err != nil {
return nil, fmt.Errorf("%w: field 'HasPostsWith'", err)
}
with = append(with, p)
}
predicates = append(predicates, profile.HasPostsWith(with...))
}
switch len(predicates) {
case 0:
return nil, ErrEmptyProfileWhereInput
case 1:
return predicates[0], nil
default:
return profile.And(predicates...), nil
}
}