snapshot of https://github.com/ent/ent.git (master, 2026-09-15; blobs > 131072B omitted)
This commit is contained in:
601
entc/integration/gremlin/ent/task_update.go
Normal file
601
entc/integration/gremlin/ent/task_update.go
Normal file
@@ -0,0 +1,601 @@
|
||||
// Copyright 2019-present Facebook Inc. All rights reserved.
|
||||
// This source code is licensed under the Apache 2.0 license found
|
||||
// in the LICENSE file in the root directory of this source tree.
|
||||
|
||||
// Code generated by ent, DO NOT EDIT.
|
||||
|
||||
package ent
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"entgo.io/ent/dialect/gremlin"
|
||||
"entgo.io/ent/dialect/gremlin/graph/dsl"
|
||||
"entgo.io/ent/dialect/gremlin/graph/dsl/__"
|
||||
"entgo.io/ent/dialect/gremlin/graph/dsl/g"
|
||||
"entgo.io/ent/entc/integration/ent/schema/task"
|
||||
"entgo.io/ent/entc/integration/gremlin/ent/predicate"
|
||||
enttask "entgo.io/ent/entc/integration/gremlin/ent/task"
|
||||
)
|
||||
|
||||
// TaskUpdate is the builder for updating Task entities.
|
||||
type TaskUpdate struct {
|
||||
config
|
||||
hooks []Hook
|
||||
mutation *TaskMutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the TaskUpdate builder.
|
||||
func (_u *TaskUpdate) Where(ps ...predicate.Task) *TaskUpdate {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPriority sets the "priority" field.
|
||||
func (_u *TaskUpdate) SetPriority(v task.Priority) *TaskUpdate {
|
||||
_u.mutation.ResetPriority()
|
||||
_u.mutation.SetPriority(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePriority sets the "priority" field if the given value is not nil.
|
||||
func (_u *TaskUpdate) SetNillablePriority(v *task.Priority) *TaskUpdate {
|
||||
if v != nil {
|
||||
_u.SetPriority(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddPriority adds value to the "priority" field.
|
||||
func (_u *TaskUpdate) AddPriority(v task.Priority) *TaskUpdate {
|
||||
_u.mutation.AddPriority(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPriorities sets the "priorities" field.
|
||||
func (_u *TaskUpdate) SetPriorities(v map[string]task.Priority) *TaskUpdate {
|
||||
_u.mutation.SetPriorities(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearPriorities clears the value of the "priorities" field.
|
||||
func (_u *TaskUpdate) ClearPriorities() *TaskUpdate {
|
||||
_u.mutation.ClearPriorities()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (_u *TaskUpdate) SetName(v string) *TaskUpdate {
|
||||
_u.mutation.SetName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableName sets the "name" field if the given value is not nil.
|
||||
func (_u *TaskUpdate) SetNillableName(v *string) *TaskUpdate {
|
||||
if v != nil {
|
||||
_u.SetName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearName clears the value of the "name" field.
|
||||
func (_u *TaskUpdate) ClearName() *TaskUpdate {
|
||||
_u.mutation.ClearName()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOwner sets the "owner" field.
|
||||
func (_u *TaskUpdate) SetOwner(v string) *TaskUpdate {
|
||||
_u.mutation.SetOwner(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableOwner sets the "owner" field if the given value is not nil.
|
||||
func (_u *TaskUpdate) SetNillableOwner(v *string) *TaskUpdate {
|
||||
if v != nil {
|
||||
_u.SetOwner(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearOwner clears the value of the "owner" field.
|
||||
func (_u *TaskUpdate) ClearOwner() *TaskUpdate {
|
||||
_u.mutation.ClearOwner()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOrder sets the "order" field.
|
||||
func (_u *TaskUpdate) SetOrder(v int) *TaskUpdate {
|
||||
_u.mutation.ResetOrder()
|
||||
_u.mutation.SetOrder(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableOrder sets the "order" field if the given value is not nil.
|
||||
func (_u *TaskUpdate) SetNillableOrder(v *int) *TaskUpdate {
|
||||
if v != nil {
|
||||
_u.SetOrder(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddOrder adds value to the "order" field.
|
||||
func (_u *TaskUpdate) AddOrder(v int) *TaskUpdate {
|
||||
_u.mutation.AddOrder(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearOrder clears the value of the "order" field.
|
||||
func (_u *TaskUpdate) ClearOrder() *TaskUpdate {
|
||||
_u.mutation.ClearOrder()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOrderOption sets the "order_option" field.
|
||||
func (_u *TaskUpdate) SetOrderOption(v int) *TaskUpdate {
|
||||
_u.mutation.ResetOrderOption()
|
||||
_u.mutation.SetOrderOption(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableOrderOption sets the "order_option" field if the given value is not nil.
|
||||
func (_u *TaskUpdate) SetNillableOrderOption(v *int) *TaskUpdate {
|
||||
if v != nil {
|
||||
_u.SetOrderOption(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddOrderOption adds value to the "order_option" field.
|
||||
func (_u *TaskUpdate) AddOrderOption(v int) *TaskUpdate {
|
||||
_u.mutation.AddOrderOption(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearOrderOption clears the value of the "order_option" field.
|
||||
func (_u *TaskUpdate) ClearOrderOption() *TaskUpdate {
|
||||
_u.mutation.ClearOrderOption()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOp sets the "op" field.
|
||||
func (_u *TaskUpdate) SetOp(v string) *TaskUpdate {
|
||||
_u.mutation.SetOpField(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableOp sets the "op" field if the given value is not nil.
|
||||
func (_u *TaskUpdate) SetNillableOp(v *string) *TaskUpdate {
|
||||
if v != nil {
|
||||
_u.SetOp(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the TaskMutation object of the builder.
|
||||
func (_u *TaskUpdate) Mutation() *TaskMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Save executes the query and returns the number of nodes affected by the update operation.
|
||||
func (_u *TaskUpdate) Save(ctx context.Context) (int, error) {
|
||||
return withHooks(ctx, _u.gremlinSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *TaskUpdate) SaveX(ctx context.Context) int {
|
||||
affected, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return affected
|
||||
}
|
||||
|
||||
// Exec executes the query.
|
||||
func (_u *TaskUpdate) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *TaskUpdate) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *TaskUpdate) check() error {
|
||||
if v, ok := _u.mutation.Priority(); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return &ValidationError{Name: "priority", err: fmt.Errorf(`ent: validator failed for field "Task.priority": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.GetOp(); ok {
|
||||
if err := enttask.OpValidator(v); err != nil {
|
||||
return &ValidationError{Name: "op", err: fmt.Errorf(`ent: validator failed for field "Task.op": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *TaskUpdate) gremlinSave(ctx context.Context) (int, error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
res := &gremlin.Response{}
|
||||
query, bindings := _u.gremlin().Query()
|
||||
if err := _u.driver.Exec(ctx, query, bindings, res); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if err, ok := isConstantError(res); ok {
|
||||
return 0, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
return res.ReadInt()
|
||||
}
|
||||
|
||||
func (_u *TaskUpdate) gremlin() *dsl.Traversal {
|
||||
v := g.V().HasLabel(enttask.Label)
|
||||
for _, p := range _u.mutation.Predicates() {
|
||||
p(v)
|
||||
}
|
||||
var (
|
||||
trs []*dsl.Traversal
|
||||
)
|
||||
if value, ok := _u.mutation.Priority(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldPriority, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedPriority(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldPriority, __.Union(__.Values(enttask.FieldPriority), __.Constant(value)).Sum())
|
||||
}
|
||||
if value, ok := _u.mutation.Priorities(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldPriorities, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Name(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldName, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Owner(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOwner, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Order(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOrder, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedOrder(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOrder, __.Union(__.Values(enttask.FieldOrder), __.Constant(value)).Sum())
|
||||
}
|
||||
if value, ok := _u.mutation.OrderOption(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOrderOption, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedOrderOption(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOrderOption, __.Union(__.Values(enttask.FieldOrderOption), __.Constant(value)).Sum())
|
||||
}
|
||||
if value, ok := _u.mutation.GetOp(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOp, value)
|
||||
}
|
||||
var properties []any
|
||||
if _u.mutation.PrioritiesCleared() {
|
||||
properties = append(properties, enttask.FieldPriorities)
|
||||
}
|
||||
if _u.mutation.NameCleared() {
|
||||
properties = append(properties, enttask.FieldName)
|
||||
}
|
||||
if _u.mutation.OwnerCleared() {
|
||||
properties = append(properties, enttask.FieldOwner)
|
||||
}
|
||||
if _u.mutation.OrderCleared() {
|
||||
properties = append(properties, enttask.FieldOrder)
|
||||
}
|
||||
if _u.mutation.OrderOptionCleared() {
|
||||
properties = append(properties, enttask.FieldOrderOption)
|
||||
}
|
||||
if len(properties) > 0 {
|
||||
v.SideEffect(__.Properties(properties...).Drop())
|
||||
}
|
||||
v.Count()
|
||||
trs = append(trs, v)
|
||||
return dsl.Join(trs...)
|
||||
}
|
||||
|
||||
// TaskUpdateOne is the builder for updating a single Task entity.
|
||||
type TaskUpdateOne struct {
|
||||
config
|
||||
fields []string
|
||||
hooks []Hook
|
||||
mutation *TaskMutation
|
||||
}
|
||||
|
||||
// SetPriority sets the "priority" field.
|
||||
func (_u *TaskUpdateOne) SetPriority(v task.Priority) *TaskUpdateOne {
|
||||
_u.mutation.ResetPriority()
|
||||
_u.mutation.SetPriority(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillablePriority sets the "priority" field if the given value is not nil.
|
||||
func (_u *TaskUpdateOne) SetNillablePriority(v *task.Priority) *TaskUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetPriority(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddPriority adds value to the "priority" field.
|
||||
func (_u *TaskUpdateOne) AddPriority(v task.Priority) *TaskUpdateOne {
|
||||
_u.mutation.AddPriority(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetPriorities sets the "priorities" field.
|
||||
func (_u *TaskUpdateOne) SetPriorities(v map[string]task.Priority) *TaskUpdateOne {
|
||||
_u.mutation.SetPriorities(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearPriorities clears the value of the "priorities" field.
|
||||
func (_u *TaskUpdateOne) ClearPriorities() *TaskUpdateOne {
|
||||
_u.mutation.ClearPriorities()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetName sets the "name" field.
|
||||
func (_u *TaskUpdateOne) SetName(v string) *TaskUpdateOne {
|
||||
_u.mutation.SetName(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableName sets the "name" field if the given value is not nil.
|
||||
func (_u *TaskUpdateOne) SetNillableName(v *string) *TaskUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetName(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearName clears the value of the "name" field.
|
||||
func (_u *TaskUpdateOne) ClearName() *TaskUpdateOne {
|
||||
_u.mutation.ClearName()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOwner sets the "owner" field.
|
||||
func (_u *TaskUpdateOne) SetOwner(v string) *TaskUpdateOne {
|
||||
_u.mutation.SetOwner(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableOwner sets the "owner" field if the given value is not nil.
|
||||
func (_u *TaskUpdateOne) SetNillableOwner(v *string) *TaskUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetOwner(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearOwner clears the value of the "owner" field.
|
||||
func (_u *TaskUpdateOne) ClearOwner() *TaskUpdateOne {
|
||||
_u.mutation.ClearOwner()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOrder sets the "order" field.
|
||||
func (_u *TaskUpdateOne) SetOrder(v int) *TaskUpdateOne {
|
||||
_u.mutation.ResetOrder()
|
||||
_u.mutation.SetOrder(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableOrder sets the "order" field if the given value is not nil.
|
||||
func (_u *TaskUpdateOne) SetNillableOrder(v *int) *TaskUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetOrder(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddOrder adds value to the "order" field.
|
||||
func (_u *TaskUpdateOne) AddOrder(v int) *TaskUpdateOne {
|
||||
_u.mutation.AddOrder(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearOrder clears the value of the "order" field.
|
||||
func (_u *TaskUpdateOne) ClearOrder() *TaskUpdateOne {
|
||||
_u.mutation.ClearOrder()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOrderOption sets the "order_option" field.
|
||||
func (_u *TaskUpdateOne) SetOrderOption(v int) *TaskUpdateOne {
|
||||
_u.mutation.ResetOrderOption()
|
||||
_u.mutation.SetOrderOption(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableOrderOption sets the "order_option" field if the given value is not nil.
|
||||
func (_u *TaskUpdateOne) SetNillableOrderOption(v *int) *TaskUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetOrderOption(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// AddOrderOption adds value to the "order_option" field.
|
||||
func (_u *TaskUpdateOne) AddOrderOption(v int) *TaskUpdateOne {
|
||||
_u.mutation.AddOrderOption(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// ClearOrderOption clears the value of the "order_option" field.
|
||||
func (_u *TaskUpdateOne) ClearOrderOption() *TaskUpdateOne {
|
||||
_u.mutation.ClearOrderOption()
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetOp sets the "op" field.
|
||||
func (_u *TaskUpdateOne) SetOp(v string) *TaskUpdateOne {
|
||||
_u.mutation.SetOpField(v)
|
||||
return _u
|
||||
}
|
||||
|
||||
// SetNillableOp sets the "op" field if the given value is not nil.
|
||||
func (_u *TaskUpdateOne) SetNillableOp(v *string) *TaskUpdateOne {
|
||||
if v != nil {
|
||||
_u.SetOp(*v)
|
||||
}
|
||||
return _u
|
||||
}
|
||||
|
||||
// Mutation returns the TaskMutation object of the builder.
|
||||
func (_u *TaskUpdateOne) Mutation() *TaskMutation {
|
||||
return _u.mutation
|
||||
}
|
||||
|
||||
// Where appends a list predicates to the TaskUpdate builder.
|
||||
func (_u *TaskUpdateOne) Where(ps ...predicate.Task) *TaskUpdateOne {
|
||||
_u.mutation.Where(ps...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Select allows selecting one or more fields (columns) of the returned entity.
|
||||
// The default is selecting all fields defined in the entity schema.
|
||||
func (_u *TaskUpdateOne) Select(field string, fields ...string) *TaskUpdateOne {
|
||||
_u.fields = append([]string{field}, fields...)
|
||||
return _u
|
||||
}
|
||||
|
||||
// Save executes the query and returns the updated Task entity.
|
||||
func (_u *TaskUpdateOne) Save(ctx context.Context) (*Task, error) {
|
||||
return withHooks(ctx, _u.gremlinSave, _u.mutation, _u.hooks)
|
||||
}
|
||||
|
||||
// SaveX is like Save, but panics if an error occurs.
|
||||
func (_u *TaskUpdateOne) SaveX(ctx context.Context) *Task {
|
||||
node, err := _u.Save(ctx)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return node
|
||||
}
|
||||
|
||||
// Exec executes the query on the entity.
|
||||
func (_u *TaskUpdateOne) Exec(ctx context.Context) error {
|
||||
_, err := _u.Save(ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
// ExecX is like Exec, but panics if an error occurs.
|
||||
func (_u *TaskUpdateOne) ExecX(ctx context.Context) {
|
||||
if err := _u.Exec(ctx); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
// check runs all checks and user-defined validators on the builder.
|
||||
func (_u *TaskUpdateOne) check() error {
|
||||
if v, ok := _u.mutation.Priority(); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return &ValidationError{Name: "priority", err: fmt.Errorf(`ent: validator failed for field "Task.priority": %w`, err)}
|
||||
}
|
||||
}
|
||||
if v, ok := _u.mutation.GetOp(); ok {
|
||||
if err := enttask.OpValidator(v); err != nil {
|
||||
return &ValidationError{Name: "op", err: fmt.Errorf(`ent: validator failed for field "Task.op": %w`, err)}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (_u *TaskUpdateOne) gremlinSave(ctx context.Context) (*Task, error) {
|
||||
if err := _u.check(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res := &gremlin.Response{}
|
||||
id, ok := _u.mutation.ID()
|
||||
if !ok {
|
||||
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Task.id" for update`)}
|
||||
}
|
||||
query, bindings := _u.gremlin(id).Query()
|
||||
if err := _u.driver.Exec(ctx, query, bindings, res); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err, ok := isConstantError(res); ok {
|
||||
return nil, err
|
||||
}
|
||||
_u.mutation.done = true
|
||||
_m := &Task{config: _u.config}
|
||||
if err := _m.FromResponse(res); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return _m, nil
|
||||
}
|
||||
|
||||
func (_u *TaskUpdateOne) gremlin(id string) *dsl.Traversal {
|
||||
v := g.V(id)
|
||||
var (
|
||||
trs []*dsl.Traversal
|
||||
)
|
||||
if value, ok := _u.mutation.Priority(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldPriority, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedPriority(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldPriority, __.Union(__.Values(enttask.FieldPriority), __.Constant(value)).Sum())
|
||||
}
|
||||
if value, ok := _u.mutation.Priorities(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldPriorities, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Name(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldName, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Owner(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOwner, value)
|
||||
}
|
||||
if value, ok := _u.mutation.Order(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOrder, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedOrder(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOrder, __.Union(__.Values(enttask.FieldOrder), __.Constant(value)).Sum())
|
||||
}
|
||||
if value, ok := _u.mutation.OrderOption(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOrderOption, value)
|
||||
}
|
||||
if value, ok := _u.mutation.AddedOrderOption(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOrderOption, __.Union(__.Values(enttask.FieldOrderOption), __.Constant(value)).Sum())
|
||||
}
|
||||
if value, ok := _u.mutation.GetOp(); ok {
|
||||
v.Property(dsl.Single, enttask.FieldOp, value)
|
||||
}
|
||||
var properties []any
|
||||
if _u.mutation.PrioritiesCleared() {
|
||||
properties = append(properties, enttask.FieldPriorities)
|
||||
}
|
||||
if _u.mutation.NameCleared() {
|
||||
properties = append(properties, enttask.FieldName)
|
||||
}
|
||||
if _u.mutation.OwnerCleared() {
|
||||
properties = append(properties, enttask.FieldOwner)
|
||||
}
|
||||
if _u.mutation.OrderCleared() {
|
||||
properties = append(properties, enttask.FieldOrder)
|
||||
}
|
||||
if _u.mutation.OrderOptionCleared() {
|
||||
properties = append(properties, enttask.FieldOrderOption)
|
||||
}
|
||||
if len(properties) > 0 {
|
||||
v.SideEffect(__.Properties(properties...).Drop())
|
||||
}
|
||||
if len(_u.fields) > 0 {
|
||||
fields := make([]any, 0, len(_u.fields)+1)
|
||||
fields = append(fields, true)
|
||||
for _, f := range _u.fields {
|
||||
fields = append(fields, f)
|
||||
}
|
||||
v.ValueMap(fields...)
|
||||
} else {
|
||||
v.ValueMap(true)
|
||||
}
|
||||
trs = append(trs, v)
|
||||
return dsl.Join(trs...)
|
||||
}
|
||||
Reference in New Issue
Block a user