Added password token entity.
This commit is contained in:
parent
1ac68b7d9f
commit
c9d50cb3d4
25 changed files with 3489 additions and 20 deletions
|
|
@ -6,6 +6,7 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"goweb/ent/passwordtoken"
|
||||
"goweb/ent/user"
|
||||
"time"
|
||||
|
||||
|
|
@ -52,6 +53,21 @@ func (uc *UserCreate) SetNillableCreatedAt(t *time.Time) *UserCreate {
|
|||
return uc
|
||||
}
|
||||
|
||||
// AddOwnerIDs adds the "owner" edge to the PasswordToken entity by IDs.
|
||||
func (uc *UserCreate) AddOwnerIDs(ids ...int) *UserCreate {
|
||||
uc.mutation.AddOwnerIDs(ids...)
|
||||
return uc
|
||||
}
|
||||
|
||||
// AddOwner adds the "owner" edges to the PasswordToken entity.
|
||||
func (uc *UserCreate) AddOwner(p ...*PasswordToken) *UserCreate {
|
||||
ids := make([]int, len(p))
|
||||
for i := range p {
|
||||
ids[i] = p[i].ID
|
||||
}
|
||||
return uc.AddOwnerIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the UserMutation object of the builder.
|
||||
func (uc *UserCreate) Mutation() *UserMutation {
|
||||
return uc.mutation
|
||||
|
|
@ -217,6 +233,25 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) {
|
|||
})
|
||||
_node.CreatedAt = value
|
||||
}
|
||||
if nodes := uc.mutation.OwnerIDs(); len(nodes) > 0 {
|
||||
edge := &sqlgraph.EdgeSpec{
|
||||
Rel: sqlgraph.O2M,
|
||||
Inverse: true,
|
||||
Table: user.OwnerTable,
|
||||
Columns: []string{user.OwnerColumn},
|
||||
Bidi: false,
|
||||
Target: &sqlgraph.EdgeTarget{
|
||||
IDSpec: &sqlgraph.FieldSpec{
|
||||
Type: field.TypeInt,
|
||||
Column: passwordtoken.FieldID,
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, k := range nodes {
|
||||
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
||||
}
|
||||
_spec.Edges = append(_spec.Edges, edge)
|
||||
}
|
||||
return _node, _spec
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue