mirror of
https://github.com/ent/ent.git
synced 2026-05-24 09:31:56 +03:00
entc/mutation: expose builder api for getting mutations (#531)
This commit is contained in:
@@ -45,6 +45,11 @@ func (gc *GroupCreate) AddUsers(u ...*User) *GroupCreate {
|
||||
return gc.AddUserIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the GroupMutation object of the builder.
|
||||
func (gc *GroupCreate) Mutation() *GroupMutation {
|
||||
return gc.mutation
|
||||
}
|
||||
|
||||
// Save creates the Group in the database.
|
||||
func (gc *GroupCreate) Save(ctx context.Context) (*Group, error) {
|
||||
if _, ok := gc.mutation.Name(); !ok {
|
||||
|
||||
@@ -53,6 +53,11 @@ func (gu *GroupUpdate) AddUsers(u ...*User) *GroupUpdate {
|
||||
return gu.AddUserIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the GroupMutation object of the builder.
|
||||
func (gu *GroupUpdate) Mutation() *GroupMutation {
|
||||
return gu.mutation
|
||||
}
|
||||
|
||||
// RemoveUserIDs removes the users edge to User by ids.
|
||||
func (gu *GroupUpdate) RemoveUserIDs(ids ...int) *GroupUpdate {
|
||||
gu.mutation.RemoveUserIDs(ids...)
|
||||
@@ -222,6 +227,11 @@ func (guo *GroupUpdateOne) AddUsers(u ...*User) *GroupUpdateOne {
|
||||
return guo.AddUserIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the GroupMutation object of the builder.
|
||||
func (guo *GroupUpdateOne) Mutation() *GroupMutation {
|
||||
return guo.mutation
|
||||
}
|
||||
|
||||
// RemoveUserIDs removes the users edge to User by ids.
|
||||
func (guo *GroupUpdateOne) RemoveUserIDs(ids ...int) *GroupUpdateOne {
|
||||
guo.mutation.RemoveUserIDs(ids...)
|
||||
|
||||
@@ -51,6 +51,11 @@ func (uc *UserCreate) AddGroups(g ...*Group) *UserCreate {
|
||||
return uc.AddGroupIDs(ids...)
|
||||
}
|
||||
|
||||
// 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 {
|
||||
|
||||
@@ -66,6 +66,11 @@ func (uu *UserUpdate) AddGroups(g ...*Group) *UserUpdate {
|
||||
return uu.AddGroupIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the UserMutation object of the builder.
|
||||
func (uu *UserUpdate) Mutation() *UserMutation {
|
||||
return uu.mutation
|
||||
}
|
||||
|
||||
// RemoveGroupIDs removes the groups edge to Group by ids.
|
||||
func (uu *UserUpdate) RemoveGroupIDs(ids ...int) *UserUpdate {
|
||||
uu.mutation.RemoveGroupIDs(ids...)
|
||||
@@ -262,6 +267,11 @@ func (uuo *UserUpdateOne) AddGroups(g ...*Group) *UserUpdateOne {
|
||||
return uuo.AddGroupIDs(ids...)
|
||||
}
|
||||
|
||||
// Mutation returns the UserMutation object of the builder.
|
||||
func (uuo *UserUpdateOne) Mutation() *UserMutation {
|
||||
return uuo.mutation
|
||||
}
|
||||
|
||||
// RemoveGroupIDs removes the groups edge to Group by ids.
|
||||
func (uuo *UserUpdateOne) RemoveGroupIDs(ids ...int) *UserUpdateOne {
|
||||
uuo.mutation.RemoveGroupIDs(ids...)
|
||||
|
||||
Reference in New Issue
Block a user