mirror of
https://github.com/hay-kot/homebox.git
synced 2025-07-26 04:20:28 +00:00
add group_id to notifier
This commit is contained in:
parent
43b34e2899
commit
37857682e6
18 changed files with 919 additions and 18 deletions
|
@ -19,6 +19,8 @@ const (
|
|||
FieldUpdatedAt = "updated_at"
|
||||
// FieldUserID holds the string denoting the user_id field in the database.
|
||||
FieldUserID = "user_id"
|
||||
// FieldGroupID holds the string denoting the group_id field in the database.
|
||||
FieldGroupID = "group_id"
|
||||
// FieldName holds the string denoting the name field in the database.
|
||||
FieldName = "name"
|
||||
// FieldURL holds the string denoting the url field in the database.
|
||||
|
@ -27,6 +29,8 @@ const (
|
|||
FieldIsActive = "is_active"
|
||||
// EdgeUser holds the string denoting the user edge name in mutations.
|
||||
EdgeUser = "user"
|
||||
// EdgeGroup holds the string denoting the group edge name in mutations.
|
||||
EdgeGroup = "group"
|
||||
// Table holds the table name of the notifier in the database.
|
||||
Table = "notifiers"
|
||||
// UserTable is the table that holds the user relation/edge.
|
||||
|
@ -36,6 +40,13 @@ const (
|
|||
UserInverseTable = "users"
|
||||
// UserColumn is the table column denoting the user relation/edge.
|
||||
UserColumn = "user_id"
|
||||
// GroupTable is the table that holds the group relation/edge.
|
||||
GroupTable = "notifiers"
|
||||
// GroupInverseTable is the table name for the Group entity.
|
||||
// It exists in this package in order to avoid circular dependency with the "group" package.
|
||||
GroupInverseTable = "groups"
|
||||
// GroupColumn is the table column denoting the group relation/edge.
|
||||
GroupColumn = "group_id"
|
||||
)
|
||||
|
||||
// Columns holds all SQL columns for notifier fields.
|
||||
|
@ -44,6 +55,7 @@ var Columns = []string{
|
|||
FieldCreatedAt,
|
||||
FieldUpdatedAt,
|
||||
FieldUserID,
|
||||
FieldGroupID,
|
||||
FieldName,
|
||||
FieldURL,
|
||||
FieldIsActive,
|
||||
|
|
|
@ -71,6 +71,11 @@ func UserID(v uuid.UUID) predicate.Notifier {
|
|||
return predicate.Notifier(sql.FieldEQ(FieldUserID, v))
|
||||
}
|
||||
|
||||
// GroupID applies equality check predicate on the "group_id" field. It's identical to GroupIDEQ.
|
||||
func GroupID(v uuid.UUID) predicate.Notifier {
|
||||
return predicate.Notifier(sql.FieldEQ(FieldGroupID, v))
|
||||
}
|
||||
|
||||
// Name applies equality check predicate on the "name" field. It's identical to NameEQ.
|
||||
func Name(v string) predicate.Notifier {
|
||||
return predicate.Notifier(sql.FieldEQ(FieldName, v))
|
||||
|
@ -186,6 +191,26 @@ func UserIDNotIn(vs ...uuid.UUID) predicate.Notifier {
|
|||
return predicate.Notifier(sql.FieldNotIn(FieldUserID, vs...))
|
||||
}
|
||||
|
||||
// GroupIDEQ applies the EQ predicate on the "group_id" field.
|
||||
func GroupIDEQ(v uuid.UUID) predicate.Notifier {
|
||||
return predicate.Notifier(sql.FieldEQ(FieldGroupID, v))
|
||||
}
|
||||
|
||||
// GroupIDNEQ applies the NEQ predicate on the "group_id" field.
|
||||
func GroupIDNEQ(v uuid.UUID) predicate.Notifier {
|
||||
return predicate.Notifier(sql.FieldNEQ(FieldGroupID, v))
|
||||
}
|
||||
|
||||
// GroupIDIn applies the In predicate on the "group_id" field.
|
||||
func GroupIDIn(vs ...uuid.UUID) predicate.Notifier {
|
||||
return predicate.Notifier(sql.FieldIn(FieldGroupID, vs...))
|
||||
}
|
||||
|
||||
// GroupIDNotIn applies the NotIn predicate on the "group_id" field.
|
||||
func GroupIDNotIn(vs ...uuid.UUID) predicate.Notifier {
|
||||
return predicate.Notifier(sql.FieldNotIn(FieldGroupID, vs...))
|
||||
}
|
||||
|
||||
// NameEQ applies the EQ predicate on the "name" field.
|
||||
func NameEQ(v string) predicate.Notifier {
|
||||
return predicate.Notifier(sql.FieldEQ(FieldName, v))
|
||||
|
@ -353,6 +378,33 @@ func HasUserWith(preds ...predicate.User) predicate.Notifier {
|
|||
})
|
||||
}
|
||||
|
||||
// HasGroup applies the HasEdge predicate on the "group" edge.
|
||||
func HasGroup() predicate.Notifier {
|
||||
return predicate.Notifier(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, GroupTable, GroupColumn),
|
||||
)
|
||||
sqlgraph.HasNeighbors(s, step)
|
||||
})
|
||||
}
|
||||
|
||||
// HasGroupWith applies the HasEdge predicate on the "group" edge with a given conditions (other predicates).
|
||||
func HasGroupWith(preds ...predicate.Group) predicate.Notifier {
|
||||
return predicate.Notifier(func(s *sql.Selector) {
|
||||
step := sqlgraph.NewStep(
|
||||
sqlgraph.From(Table, FieldID),
|
||||
sqlgraph.To(GroupInverseTable, FieldID),
|
||||
sqlgraph.Edge(sqlgraph.M2O, true, GroupTable, GroupColumn),
|
||||
)
|
||||
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.Notifier) predicate.Notifier {
|
||||
return predicate.Notifier(func(s *sql.Selector) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue