You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
557 lines
16 KiB
557 lines
16 KiB
4 years ago
|
// Code generated by entc, DO NOT EDIT.
|
||
|
|
||
|
package comment
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"entgo.io/ent/dialect/sql"
|
||
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
||
|
"github.com/go-kratos/examples/blog/internal/data/ent/predicate"
|
||
|
)
|
||
|
|
||
|
// ID filters vertices based on their ID field.
|
||
|
func ID(id int64) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldID), id))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// IDEQ applies the EQ predicate on the ID field.
|
||
|
func IDEQ(id int64) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldID), id))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// IDNEQ applies the NEQ predicate on the ID field.
|
||
|
func IDNEQ(id int64) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.NEQ(s.C(FieldID), id))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// IDIn applies the In predicate on the ID field.
|
||
|
func IDIn(ids ...int64) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(ids) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
v := make([]interface{}, len(ids))
|
||
|
for i := range v {
|
||
|
v[i] = ids[i]
|
||
|
}
|
||
|
s.Where(sql.In(s.C(FieldID), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// IDNotIn applies the NotIn predicate on the ID field.
|
||
|
func IDNotIn(ids ...int64) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(ids) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
v := make([]interface{}, len(ids))
|
||
|
for i := range v {
|
||
|
v[i] = ids[i]
|
||
|
}
|
||
|
s.Where(sql.NotIn(s.C(FieldID), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// IDGT applies the GT predicate on the ID field.
|
||
|
func IDGT(id int64) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GT(s.C(FieldID), id))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// IDGTE applies the GTE predicate on the ID field.
|
||
|
func IDGTE(id int64) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GTE(s.C(FieldID), id))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// IDLT applies the LT predicate on the ID field.
|
||
|
func IDLT(id int64) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LT(s.C(FieldID), id))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// IDLTE applies the LTE predicate on the ID field.
|
||
|
func IDLTE(id int64) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LTE(s.C(FieldID), id))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
|
||
|
func Name(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// Content applies equality check predicate on the "content" field. It's identical to ContentEQ.
|
||
|
func Content(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
||
|
func CreatedAt(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldCreatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ.
|
||
|
func UpdatedAt(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldUpdatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameEQ applies the EQ predicate on the "name" field.
|
||
|
func NameEQ(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameNEQ applies the NEQ predicate on the "name" field.
|
||
|
func NameNEQ(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.NEQ(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameIn applies the In predicate on the "name" field.
|
||
|
func NameIn(vs ...string) predicate.Comment {
|
||
|
v := make([]interface{}, len(vs))
|
||
|
for i := range v {
|
||
|
v[i] = vs[i]
|
||
|
}
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(v) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
s.Where(sql.In(s.C(FieldName), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameNotIn applies the NotIn predicate on the "name" field.
|
||
|
func NameNotIn(vs ...string) predicate.Comment {
|
||
|
v := make([]interface{}, len(vs))
|
||
|
for i := range v {
|
||
|
v[i] = vs[i]
|
||
|
}
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(v) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
s.Where(sql.NotIn(s.C(FieldName), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameGT applies the GT predicate on the "name" field.
|
||
|
func NameGT(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GT(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameGTE applies the GTE predicate on the "name" field.
|
||
|
func NameGTE(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GTE(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameLT applies the LT predicate on the "name" field.
|
||
|
func NameLT(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LT(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameLTE applies the LTE predicate on the "name" field.
|
||
|
func NameLTE(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LTE(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameContains applies the Contains predicate on the "name" field.
|
||
|
func NameContains(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.Contains(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameHasPrefix applies the HasPrefix predicate on the "name" field.
|
||
|
func NameHasPrefix(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.HasPrefix(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameHasSuffix applies the HasSuffix predicate on the "name" field.
|
||
|
func NameHasSuffix(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.HasSuffix(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameEqualFold applies the EqualFold predicate on the "name" field.
|
||
|
func NameEqualFold(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EqualFold(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// NameContainsFold applies the ContainsFold predicate on the "name" field.
|
||
|
func NameContainsFold(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.ContainsFold(s.C(FieldName), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentEQ applies the EQ predicate on the "content" field.
|
||
|
func ContentEQ(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentNEQ applies the NEQ predicate on the "content" field.
|
||
|
func ContentNEQ(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.NEQ(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentIn applies the In predicate on the "content" field.
|
||
|
func ContentIn(vs ...string) predicate.Comment {
|
||
|
v := make([]interface{}, len(vs))
|
||
|
for i := range v {
|
||
|
v[i] = vs[i]
|
||
|
}
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(v) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
s.Where(sql.In(s.C(FieldContent), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentNotIn applies the NotIn predicate on the "content" field.
|
||
|
func ContentNotIn(vs ...string) predicate.Comment {
|
||
|
v := make([]interface{}, len(vs))
|
||
|
for i := range v {
|
||
|
v[i] = vs[i]
|
||
|
}
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(v) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
s.Where(sql.NotIn(s.C(FieldContent), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentGT applies the GT predicate on the "content" field.
|
||
|
func ContentGT(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GT(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentGTE applies the GTE predicate on the "content" field.
|
||
|
func ContentGTE(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GTE(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentLT applies the LT predicate on the "content" field.
|
||
|
func ContentLT(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LT(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentLTE applies the LTE predicate on the "content" field.
|
||
|
func ContentLTE(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LTE(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentContains applies the Contains predicate on the "content" field.
|
||
|
func ContentContains(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.Contains(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentHasPrefix applies the HasPrefix predicate on the "content" field.
|
||
|
func ContentHasPrefix(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.HasPrefix(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentHasSuffix applies the HasSuffix predicate on the "content" field.
|
||
|
func ContentHasSuffix(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.HasSuffix(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentEqualFold applies the EqualFold predicate on the "content" field.
|
||
|
func ContentEqualFold(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EqualFold(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// ContentContainsFold applies the ContainsFold predicate on the "content" field.
|
||
|
func ContentContainsFold(v string) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.ContainsFold(s.C(FieldContent), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
||
|
func CreatedAtEQ(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldCreatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
||
|
func CreatedAtNEQ(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.NEQ(s.C(FieldCreatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// CreatedAtIn applies the In predicate on the "created_at" field.
|
||
|
func CreatedAtIn(vs ...time.Time) predicate.Comment {
|
||
|
v := make([]interface{}, len(vs))
|
||
|
for i := range v {
|
||
|
v[i] = vs[i]
|
||
|
}
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(v) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
s.Where(sql.In(s.C(FieldCreatedAt), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
||
|
func CreatedAtNotIn(vs ...time.Time) predicate.Comment {
|
||
|
v := make([]interface{}, len(vs))
|
||
|
for i := range v {
|
||
|
v[i] = vs[i]
|
||
|
}
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(v) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
s.Where(sql.NotIn(s.C(FieldCreatedAt), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
||
|
func CreatedAtGT(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GT(s.C(FieldCreatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
||
|
func CreatedAtGTE(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GTE(s.C(FieldCreatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
||
|
func CreatedAtLT(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LT(s.C(FieldCreatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
||
|
func CreatedAtLTE(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LTE(s.C(FieldCreatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// UpdatedAtEQ applies the EQ predicate on the "updated_at" field.
|
||
|
func UpdatedAtEQ(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.EQ(s.C(FieldUpdatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field.
|
||
|
func UpdatedAtNEQ(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.NEQ(s.C(FieldUpdatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// UpdatedAtIn applies the In predicate on the "updated_at" field.
|
||
|
func UpdatedAtIn(vs ...time.Time) predicate.Comment {
|
||
|
v := make([]interface{}, len(vs))
|
||
|
for i := range v {
|
||
|
v[i] = vs[i]
|
||
|
}
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(v) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
s.Where(sql.In(s.C(FieldUpdatedAt), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field.
|
||
|
func UpdatedAtNotIn(vs ...time.Time) predicate.Comment {
|
||
|
v := make([]interface{}, len(vs))
|
||
|
for i := range v {
|
||
|
v[i] = vs[i]
|
||
|
}
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
// if not arguments were provided, append the FALSE constants,
|
||
|
// since we can't apply "IN ()". This will make this predicate falsy.
|
||
|
if len(v) == 0 {
|
||
|
s.Where(sql.False())
|
||
|
return
|
||
|
}
|
||
|
s.Where(sql.NotIn(s.C(FieldUpdatedAt), v...))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// UpdatedAtGT applies the GT predicate on the "updated_at" field.
|
||
|
func UpdatedAtGT(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GT(s.C(FieldUpdatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// UpdatedAtGTE applies the GTE predicate on the "updated_at" field.
|
||
|
func UpdatedAtGTE(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.GTE(s.C(FieldUpdatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// UpdatedAtLT applies the LT predicate on the "updated_at" field.
|
||
|
func UpdatedAtLT(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LT(s.C(FieldUpdatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// UpdatedAtLTE applies the LTE predicate on the "updated_at" field.
|
||
|
func UpdatedAtLTE(v time.Time) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s.Where(sql.LTE(s.C(FieldUpdatedAt), v))
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// HasPost applies the HasEdge predicate on the "post" edge.
|
||
|
func HasPost() predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
step := sqlgraph.NewStep(
|
||
|
sqlgraph.From(Table, FieldID),
|
||
|
sqlgraph.To(PostTable, FieldID),
|
||
|
sqlgraph.Edge(sqlgraph.M2O, true, PostTable, PostColumn),
|
||
|
)
|
||
|
sqlgraph.HasNeighbors(s, step)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// HasPostWith applies the HasEdge predicate on the "post" edge with a given conditions (other predicates).
|
||
|
func HasPostWith(preds ...predicate.Article) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
step := sqlgraph.NewStep(
|
||
|
sqlgraph.From(Table, FieldID),
|
||
|
sqlgraph.To(PostInverseTable, FieldID),
|
||
|
sqlgraph.Edge(sqlgraph.M2O, true, PostTable, PostColumn),
|
||
|
)
|
||
|
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
||
|
for _, p := range preds {
|
||
|
p(s)
|
||
|
}
|
||
|
})
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// And groups predicates with the AND operator between them.
|
||
|
func And(predicates ...predicate.Comment) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s1 := s.Clone().SetP(nil)
|
||
|
for _, p := range predicates {
|
||
|
p(s1)
|
||
|
}
|
||
|
s.Where(s1.P())
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// Or groups predicates with the OR operator between them.
|
||
|
func Or(predicates ...predicate.Comment) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
s1 := s.Clone().SetP(nil)
|
||
|
for i, p := range predicates {
|
||
|
if i > 0 {
|
||
|
s1.Or()
|
||
|
}
|
||
|
p(s1)
|
||
|
}
|
||
|
s.Where(s1.P())
|
||
|
})
|
||
|
}
|
||
|
|
||
|
// Not applies the not operator on the given predicate.
|
||
|
func Not(p predicate.Comment) predicate.Comment {
|
||
|
return predicate.Comment(func(s *sql.Selector) {
|
||
|
p(s.Not())
|
||
|
})
|
||
|
}
|