mirror of
https://github.com/ent/ent.git
synced 2026-05-28 09:49:08 +03:00
entc/mutation: expose builder api for getting mutations (#531)
This commit is contained in:
@@ -48,6 +48,11 @@ func (cc *CardCreate) SetOwner(u *User) *CardCreate {
|
||||
return cc.SetOwnerID(u.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the CardMutation object of the builder.
|
||||
func (cc *CardCreate) Mutation() *CardMutation {
|
||||
return cc.mutation
|
||||
}
|
||||
|
||||
// Save creates the Card in the database.
|
||||
func (cc *CardCreate) Save(ctx context.Context) (*Card, error) {
|
||||
if _, ok := cc.mutation.Expired(); !ok {
|
||||
|
||||
@@ -57,6 +57,11 @@ func (cu *CardUpdate) SetOwner(u *User) *CardUpdate {
|
||||
return cu.SetOwnerID(u.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the CardMutation object of the builder.
|
||||
func (cu *CardUpdate) Mutation() *CardMutation {
|
||||
return cu.mutation
|
||||
}
|
||||
|
||||
// ClearOwner clears the owner edge to User.
|
||||
func (cu *CardUpdate) ClearOwner() *CardUpdate {
|
||||
cu.mutation.ClearOwner()
|
||||
@@ -226,6 +231,11 @@ func (cuo *CardUpdateOne) SetOwner(u *User) *CardUpdateOne {
|
||||
return cuo.SetOwnerID(u.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the CardMutation object of the builder.
|
||||
func (cuo *CardUpdateOne) Mutation() *CardMutation {
|
||||
return cuo.mutation
|
||||
}
|
||||
|
||||
// ClearOwner clears the owner edge to User.
|
||||
func (cuo *CardUpdateOne) ClearOwner() *CardUpdateOne {
|
||||
cuo.mutation.ClearOwner()
|
||||
|
||||
@@ -55,6 +55,11 @@ func (uc *UserCreate) SetCard(c *Card) *UserCreate {
|
||||
return uc.SetCardID(c.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the UserMutation object of the builder.
|
||||
func (uc *UserCreate) Mutation() *UserMutation {
|
||||
return uc.mutation
|
||||
}
|
||||
|
||||
// Save creates the User in the database.
|
||||
func (uc *UserCreate) Save(ctx context.Context) (*User, error) {
|
||||
if _, ok := uc.mutation.Age(); !ok {
|
||||
|
||||
@@ -70,6 +70,11 @@ func (uu *UserUpdate) SetCard(c *Card) *UserUpdate {
|
||||
return uu.SetCardID(c.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the UserMutation object of the builder.
|
||||
func (uu *UserUpdate) Mutation() *UserMutation {
|
||||
return uu.mutation
|
||||
}
|
||||
|
||||
// ClearCard clears the card edge to Card.
|
||||
func (uu *UserUpdate) ClearCard() *UserUpdate {
|
||||
uu.mutation.ClearCard()
|
||||
@@ -258,6 +263,11 @@ func (uuo *UserUpdateOne) SetCard(c *Card) *UserUpdateOne {
|
||||
return uuo.SetCardID(c.ID)
|
||||
}
|
||||
|
||||
// Mutation returns the UserMutation object of the builder.
|
||||
func (uuo *UserUpdateOne) Mutation() *UserMutation {
|
||||
return uuo.mutation
|
||||
}
|
||||
|
||||
// ClearCard clears the card edge to Card.
|
||||
func (uuo *UserUpdateOne) ClearCard() *UserUpdateOne {
|
||||
uuo.mutation.ClearCard()
|
||||
|
||||
Reference in New Issue
Block a user