Added password token entity.

This commit is contained in:
mikestefanello 2021-12-15 08:48:51 -05:00
parent 1ac68b7d9f
commit c9d50cb3d4
25 changed files with 3489 additions and 20 deletions

View file

@ -19,8 +19,17 @@ const (
FieldPassword = "password"
// FieldCreatedAt holds the string denoting the created_at field in the database.
FieldCreatedAt = "created_at"
// EdgeOwner holds the string denoting the owner edge name in mutations.
EdgeOwner = "owner"
// Table holds the table name of the user in the database.
Table = "users"
// OwnerTable is the table that holds the owner relation/edge.
OwnerTable = "password_tokens"
// OwnerInverseTable is the table name for the PasswordToken entity.
// It exists in this package in order to avoid circular dependency with the "passwordtoken" package.
OwnerInverseTable = "password_tokens"
// OwnerColumn is the table column denoting the owner relation/edge.
OwnerColumn = "password_token_user"
)
// Columns holds all SQL columns for user fields.

View file

@ -7,6 +7,7 @@ import (
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
)
// ID filters vertices based on their ID field.
@ -529,6 +530,34 @@ func CreatedAtLTE(v time.Time) predicate.User {
})
}
// HasOwner applies the HasEdge predicate on the "owner" edge.
func HasOwner() predicate.User {
return predicate.User(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(OwnerTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, OwnerTable, OwnerColumn),
)
sqlgraph.HasNeighbors(s, step)
})
}
// HasOwnerWith applies the HasEdge predicate on the "owner" edge with a given conditions (other predicates).
func HasOwnerWith(preds ...predicate.PasswordToken) predicate.User {
return predicate.User(func(s *sql.Selector) {
step := sqlgraph.NewStep(
sqlgraph.From(Table, FieldID),
sqlgraph.To(OwnerInverseTable, FieldID),
sqlgraph.Edge(sqlgraph.O2M, true, OwnerTable, OwnerColumn),
)
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.User) predicate.User {
return predicate.User(func(s *sql.Selector) {