Implements announcements end-to-end (admin CRUD + read status, user list + mark read) with OR-of-AND targeting. Also breaks the ent<->service import cycle by moving schema-facing constants/targeting into a new domain package.
258 lines
9.2 KiB
Go
258 lines
9.2 KiB
Go
// Code generated by ent, DO NOT EDIT.
|
|
|
|
package announcementread
|
|
|
|
import (
|
|
"time"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
"github.com/Wei-Shaw/sub2api/ent/predicate"
|
|
)
|
|
|
|
// ID filters vertices based on their ID field.
|
|
func ID(id int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldID, id))
|
|
}
|
|
|
|
// IDEQ applies the EQ predicate on the ID field.
|
|
func IDEQ(id int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldID, id))
|
|
}
|
|
|
|
// IDNEQ applies the NEQ predicate on the ID field.
|
|
func IDNEQ(id int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNEQ(FieldID, id))
|
|
}
|
|
|
|
// IDIn applies the In predicate on the ID field.
|
|
func IDIn(ids ...int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldIn(FieldID, ids...))
|
|
}
|
|
|
|
// IDNotIn applies the NotIn predicate on the ID field.
|
|
func IDNotIn(ids ...int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNotIn(FieldID, ids...))
|
|
}
|
|
|
|
// IDGT applies the GT predicate on the ID field.
|
|
func IDGT(id int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldGT(FieldID, id))
|
|
}
|
|
|
|
// IDGTE applies the GTE predicate on the ID field.
|
|
func IDGTE(id int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldGTE(FieldID, id))
|
|
}
|
|
|
|
// IDLT applies the LT predicate on the ID field.
|
|
func IDLT(id int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldLT(FieldID, id))
|
|
}
|
|
|
|
// IDLTE applies the LTE predicate on the ID field.
|
|
func IDLTE(id int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldLTE(FieldID, id))
|
|
}
|
|
|
|
// AnnouncementID applies equality check predicate on the "announcement_id" field. It's identical to AnnouncementIDEQ.
|
|
func AnnouncementID(v int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldAnnouncementID, v))
|
|
}
|
|
|
|
// UserID applies equality check predicate on the "user_id" field. It's identical to UserIDEQ.
|
|
func UserID(v int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldUserID, v))
|
|
}
|
|
|
|
// ReadAt applies equality check predicate on the "read_at" field. It's identical to ReadAtEQ.
|
|
func ReadAt(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldReadAt, v))
|
|
}
|
|
|
|
// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
|
|
func CreatedAt(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldCreatedAt, v))
|
|
}
|
|
|
|
// AnnouncementIDEQ applies the EQ predicate on the "announcement_id" field.
|
|
func AnnouncementIDEQ(v int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldAnnouncementID, v))
|
|
}
|
|
|
|
// AnnouncementIDNEQ applies the NEQ predicate on the "announcement_id" field.
|
|
func AnnouncementIDNEQ(v int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNEQ(FieldAnnouncementID, v))
|
|
}
|
|
|
|
// AnnouncementIDIn applies the In predicate on the "announcement_id" field.
|
|
func AnnouncementIDIn(vs ...int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldIn(FieldAnnouncementID, vs...))
|
|
}
|
|
|
|
// AnnouncementIDNotIn applies the NotIn predicate on the "announcement_id" field.
|
|
func AnnouncementIDNotIn(vs ...int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNotIn(FieldAnnouncementID, vs...))
|
|
}
|
|
|
|
// UserIDEQ applies the EQ predicate on the "user_id" field.
|
|
func UserIDEQ(v int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldUserID, v))
|
|
}
|
|
|
|
// UserIDNEQ applies the NEQ predicate on the "user_id" field.
|
|
func UserIDNEQ(v int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNEQ(FieldUserID, v))
|
|
}
|
|
|
|
// UserIDIn applies the In predicate on the "user_id" field.
|
|
func UserIDIn(vs ...int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldIn(FieldUserID, vs...))
|
|
}
|
|
|
|
// UserIDNotIn applies the NotIn predicate on the "user_id" field.
|
|
func UserIDNotIn(vs ...int64) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNotIn(FieldUserID, vs...))
|
|
}
|
|
|
|
// ReadAtEQ applies the EQ predicate on the "read_at" field.
|
|
func ReadAtEQ(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldReadAt, v))
|
|
}
|
|
|
|
// ReadAtNEQ applies the NEQ predicate on the "read_at" field.
|
|
func ReadAtNEQ(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNEQ(FieldReadAt, v))
|
|
}
|
|
|
|
// ReadAtIn applies the In predicate on the "read_at" field.
|
|
func ReadAtIn(vs ...time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldIn(FieldReadAt, vs...))
|
|
}
|
|
|
|
// ReadAtNotIn applies the NotIn predicate on the "read_at" field.
|
|
func ReadAtNotIn(vs ...time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNotIn(FieldReadAt, vs...))
|
|
}
|
|
|
|
// ReadAtGT applies the GT predicate on the "read_at" field.
|
|
func ReadAtGT(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldGT(FieldReadAt, v))
|
|
}
|
|
|
|
// ReadAtGTE applies the GTE predicate on the "read_at" field.
|
|
func ReadAtGTE(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldGTE(FieldReadAt, v))
|
|
}
|
|
|
|
// ReadAtLT applies the LT predicate on the "read_at" field.
|
|
func ReadAtLT(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldLT(FieldReadAt, v))
|
|
}
|
|
|
|
// ReadAtLTE applies the LTE predicate on the "read_at" field.
|
|
func ReadAtLTE(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldLTE(FieldReadAt, v))
|
|
}
|
|
|
|
// CreatedAtEQ applies the EQ predicate on the "created_at" field.
|
|
func CreatedAtEQ(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldEQ(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
|
|
func CreatedAtNEQ(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNEQ(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtIn applies the In predicate on the "created_at" field.
|
|
func CreatedAtIn(vs ...time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldIn(FieldCreatedAt, vs...))
|
|
}
|
|
|
|
// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
|
|
func CreatedAtNotIn(vs ...time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldNotIn(FieldCreatedAt, vs...))
|
|
}
|
|
|
|
// CreatedAtGT applies the GT predicate on the "created_at" field.
|
|
func CreatedAtGT(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldGT(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtGTE applies the GTE predicate on the "created_at" field.
|
|
func CreatedAtGTE(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldGTE(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtLT applies the LT predicate on the "created_at" field.
|
|
func CreatedAtLT(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldLT(FieldCreatedAt, v))
|
|
}
|
|
|
|
// CreatedAtLTE applies the LTE predicate on the "created_at" field.
|
|
func CreatedAtLTE(v time.Time) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.FieldLTE(FieldCreatedAt, v))
|
|
}
|
|
|
|
// HasAnnouncement applies the HasEdge predicate on the "announcement" edge.
|
|
func HasAnnouncement() predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(func(s *sql.Selector) {
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, AnnouncementTable, AnnouncementColumn),
|
|
)
|
|
sqlgraph.HasNeighbors(s, step)
|
|
})
|
|
}
|
|
|
|
// HasAnnouncementWith applies the HasEdge predicate on the "announcement" edge with a given conditions (other predicates).
|
|
func HasAnnouncementWith(preds ...predicate.Announcement) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(func(s *sql.Selector) {
|
|
step := newAnnouncementStep()
|
|
sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) {
|
|
for _, p := range preds {
|
|
p(s)
|
|
}
|
|
})
|
|
})
|
|
}
|
|
|
|
// HasUser applies the HasEdge predicate on the "user" edge.
|
|
func HasUser() predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(func(s *sql.Selector) {
|
|
step := sqlgraph.NewStep(
|
|
sqlgraph.From(Table, FieldID),
|
|
sqlgraph.Edge(sqlgraph.M2O, true, UserTable, UserColumn),
|
|
)
|
|
sqlgraph.HasNeighbors(s, step)
|
|
})
|
|
}
|
|
|
|
// HasUserWith applies the HasEdge predicate on the "user" edge with a given conditions (other predicates).
|
|
func HasUserWith(preds ...predicate.User) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(func(s *sql.Selector) {
|
|
step := newUserStep()
|
|
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.AnnouncementRead) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.AndPredicates(predicates...))
|
|
}
|
|
|
|
// Or groups predicates with the OR operator between them.
|
|
func Or(predicates ...predicate.AnnouncementRead) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.OrPredicates(predicates...))
|
|
}
|
|
|
|
// Not applies the not operator on the given predicate.
|
|
func Not(p predicate.AnnouncementRead) predicate.AnnouncementRead {
|
|
return predicate.AnnouncementRead(sql.NotPredicates(p))
|
|
}
|