599 lines
18 KiB
Go
599 lines
18 KiB
Go
// 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/dialect/gremlin/graph/dsl/p"
|
|
schemadir "entgo.io/ent/entc/integration/ent/schema/dir"
|
|
"entgo.io/ent/entc/integration/gremlin/ent/comment"
|
|
"entgo.io/ent/entc/integration/gremlin/ent/predicate"
|
|
)
|
|
|
|
// CommentUpdate is the builder for updating Comment entities.
|
|
type CommentUpdate struct {
|
|
config
|
|
hooks []Hook
|
|
mutation *CommentMutation
|
|
}
|
|
|
|
// Where appends a list predicates to the CommentUpdate builder.
|
|
func (_u *CommentUpdate) Where(ps ...predicate.Comment) *CommentUpdate {
|
|
_u.mutation.Where(ps...)
|
|
return _u
|
|
}
|
|
|
|
// SetUniqueInt sets the "unique_int" field.
|
|
func (_u *CommentUpdate) SetUniqueInt(v int) *CommentUpdate {
|
|
_u.mutation.ResetUniqueInt()
|
|
_u.mutation.SetUniqueInt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUniqueInt sets the "unique_int" field if the given value is not nil.
|
|
func (_u *CommentUpdate) SetNillableUniqueInt(v *int) *CommentUpdate {
|
|
if v != nil {
|
|
_u.SetUniqueInt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUniqueInt adds value to the "unique_int" field.
|
|
func (_u *CommentUpdate) AddUniqueInt(v int) *CommentUpdate {
|
|
_u.mutation.AddUniqueInt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetUniqueFloat sets the "unique_float" field.
|
|
func (_u *CommentUpdate) SetUniqueFloat(v float64) *CommentUpdate {
|
|
_u.mutation.ResetUniqueFloat()
|
|
_u.mutation.SetUniqueFloat(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUniqueFloat sets the "unique_float" field if the given value is not nil.
|
|
func (_u *CommentUpdate) SetNillableUniqueFloat(v *float64) *CommentUpdate {
|
|
if v != nil {
|
|
_u.SetUniqueFloat(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUniqueFloat adds value to the "unique_float" field.
|
|
func (_u *CommentUpdate) AddUniqueFloat(v float64) *CommentUpdate {
|
|
_u.mutation.AddUniqueFloat(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInt sets the "nillable_int" field.
|
|
func (_u *CommentUpdate) SetNillableInt(v int) *CommentUpdate {
|
|
_u.mutation.ResetNillableInt()
|
|
_u.mutation.SetNillableInt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNillableInt sets the "nillable_int" field if the given value is not nil.
|
|
func (_u *CommentUpdate) SetNillableNillableInt(v *int) *CommentUpdate {
|
|
if v != nil {
|
|
_u.SetNillableInt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddNillableInt adds value to the "nillable_int" field.
|
|
func (_u *CommentUpdate) AddNillableInt(v int) *CommentUpdate {
|
|
_u.mutation.AddNillableInt(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearNillableInt clears the value of the "nillable_int" field.
|
|
func (_u *CommentUpdate) ClearNillableInt() *CommentUpdate {
|
|
_u.mutation.ClearNillableInt()
|
|
return _u
|
|
}
|
|
|
|
// SetTable sets the "table" field.
|
|
func (_u *CommentUpdate) SetTable(v string) *CommentUpdate {
|
|
_u.mutation.SetTable(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableTable sets the "table" field if the given value is not nil.
|
|
func (_u *CommentUpdate) SetNillableTable(v *string) *CommentUpdate {
|
|
if v != nil {
|
|
_u.SetTable(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearTable clears the value of the "table" field.
|
|
func (_u *CommentUpdate) ClearTable() *CommentUpdate {
|
|
_u.mutation.ClearTable()
|
|
return _u
|
|
}
|
|
|
|
// SetDir sets the "dir" field.
|
|
func (_u *CommentUpdate) SetDir(v schemadir.Dir) *CommentUpdate {
|
|
_u.mutation.SetDir(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDir sets the "dir" field if the given value is not nil.
|
|
func (_u *CommentUpdate) SetNillableDir(v *schemadir.Dir) *CommentUpdate {
|
|
if v != nil {
|
|
_u.SetDir(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDir clears the value of the "dir" field.
|
|
func (_u *CommentUpdate) ClearDir() *CommentUpdate {
|
|
_u.mutation.ClearDir()
|
|
return _u
|
|
}
|
|
|
|
// SetClient sets the "client" field.
|
|
func (_u *CommentUpdate) SetClient(v string) *CommentUpdate {
|
|
_u.mutation.SetClient(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableClient sets the "client" field if the given value is not nil.
|
|
func (_u *CommentUpdate) SetNillableClient(v *string) *CommentUpdate {
|
|
if v != nil {
|
|
_u.SetClient(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearClient clears the value of the "client" field.
|
|
func (_u *CommentUpdate) ClearClient() *CommentUpdate {
|
|
_u.mutation.ClearClient()
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the CommentMutation object of the builder.
|
|
func (_u *CommentUpdate) Mutation() *CommentMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
func (_u *CommentUpdate) 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 *CommentUpdate) SaveX(ctx context.Context) int {
|
|
affected, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return affected
|
|
}
|
|
|
|
// Exec executes the query.
|
|
func (_u *CommentUpdate) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *CommentUpdate) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func (_u *CommentUpdate) gremlinSave(ctx context.Context) (int, error) {
|
|
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 *CommentUpdate) gremlin() *dsl.Traversal {
|
|
type constraint struct {
|
|
pred *dsl.Traversal // constraint predicate.
|
|
test *dsl.Traversal // test matches and its constant.
|
|
}
|
|
constraints := make([]*constraint, 0, 2)
|
|
v := g.V().HasLabel(comment.Label)
|
|
for _, p := range _u.mutation.Predicates() {
|
|
p(v)
|
|
}
|
|
var (
|
|
rv = v.Clone()
|
|
_ = rv
|
|
|
|
trs []*dsl.Traversal
|
|
)
|
|
if value, ok := _u.mutation.UniqueInt(); ok {
|
|
constraints = append(constraints, &constraint{
|
|
pred: g.V().Has(comment.Label, comment.FieldUniqueInt, value).Count(),
|
|
test: __.Is(p.NEQ(0)).Constant(NewErrUniqueField(comment.Label, comment.FieldUniqueInt, value)),
|
|
})
|
|
v.Property(dsl.Single, comment.FieldUniqueInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUniqueInt(); ok {
|
|
addValue := rv.Clone().Union(__.Values(comment.FieldUniqueInt), __.Constant(value)).Sum().Next()
|
|
constraints = append(constraints, &constraint{
|
|
pred: g.V().Has(comment.Label, comment.FieldUniqueInt, addValue).Count(),
|
|
test: __.Is(p.NEQ(0)).Constant(NewErrUniqueField(comment.Label, comment.FieldUniqueInt, fmt.Sprintf("+= %v", value))),
|
|
})
|
|
v.Property(dsl.Single, comment.FieldUniqueInt, __.Union(__.Values(comment.FieldUniqueInt), __.Constant(value)).Sum())
|
|
}
|
|
if value, ok := _u.mutation.UniqueFloat(); ok {
|
|
constraints = append(constraints, &constraint{
|
|
pred: g.V().Has(comment.Label, comment.FieldUniqueFloat, value).Count(),
|
|
test: __.Is(p.NEQ(0)).Constant(NewErrUniqueField(comment.Label, comment.FieldUniqueFloat, value)),
|
|
})
|
|
v.Property(dsl.Single, comment.FieldUniqueFloat, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUniqueFloat(); ok {
|
|
addValue := rv.Clone().Union(__.Values(comment.FieldUniqueFloat), __.Constant(value)).Sum().Next()
|
|
constraints = append(constraints, &constraint{
|
|
pred: g.V().Has(comment.Label, comment.FieldUniqueFloat, addValue).Count(),
|
|
test: __.Is(p.NEQ(0)).Constant(NewErrUniqueField(comment.Label, comment.FieldUniqueFloat, fmt.Sprintf("+= %v", value))),
|
|
})
|
|
v.Property(dsl.Single, comment.FieldUniqueFloat, __.Union(__.Values(comment.FieldUniqueFloat), __.Constant(value)).Sum())
|
|
}
|
|
if value, ok := _u.mutation.NillableInt(); ok {
|
|
v.Property(dsl.Single, comment.FieldNillableInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedNillableInt(); ok {
|
|
v.Property(dsl.Single, comment.FieldNillableInt, __.Union(__.Values(comment.FieldNillableInt), __.Constant(value)).Sum())
|
|
}
|
|
if value, ok := _u.mutation.Table(); ok {
|
|
v.Property(dsl.Single, comment.FieldTable, value)
|
|
}
|
|
if value, ok := _u.mutation.Dir(); ok {
|
|
v.Property(dsl.Single, comment.FieldDir, value)
|
|
}
|
|
if value, ok := _u.mutation.GetClient(); ok {
|
|
v.Property(dsl.Single, comment.FieldClient, value)
|
|
}
|
|
var properties []any
|
|
if _u.mutation.NillableIntCleared() {
|
|
properties = append(properties, comment.FieldNillableInt)
|
|
}
|
|
if _u.mutation.TableCleared() {
|
|
properties = append(properties, comment.FieldTable)
|
|
}
|
|
if _u.mutation.DirCleared() {
|
|
properties = append(properties, comment.FieldDir)
|
|
}
|
|
if _u.mutation.ClientCleared() {
|
|
properties = append(properties, comment.FieldClient)
|
|
}
|
|
if len(properties) > 0 {
|
|
v.SideEffect(__.Properties(properties...).Drop())
|
|
}
|
|
v.Count()
|
|
if len(constraints) > 0 {
|
|
constraints = append(constraints, &constraint{
|
|
pred: rv.Count(),
|
|
test: __.Is(p.GT(1)).Constant(&ConstraintError{msg: "update traversal contains more than one vertex"}),
|
|
})
|
|
v = constraints[0].pred.Coalesce(constraints[0].test, v)
|
|
for _, cr := range constraints[1:] {
|
|
v = cr.pred.Coalesce(cr.test, v)
|
|
}
|
|
}
|
|
trs = append(trs, v)
|
|
return dsl.Join(trs...)
|
|
}
|
|
|
|
// CommentUpdateOne is the builder for updating a single Comment entity.
|
|
type CommentUpdateOne struct {
|
|
config
|
|
fields []string
|
|
hooks []Hook
|
|
mutation *CommentMutation
|
|
}
|
|
|
|
// SetUniqueInt sets the "unique_int" field.
|
|
func (_u *CommentUpdateOne) SetUniqueInt(v int) *CommentUpdateOne {
|
|
_u.mutation.ResetUniqueInt()
|
|
_u.mutation.SetUniqueInt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUniqueInt sets the "unique_int" field if the given value is not nil.
|
|
func (_u *CommentUpdateOne) SetNillableUniqueInt(v *int) *CommentUpdateOne {
|
|
if v != nil {
|
|
_u.SetUniqueInt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUniqueInt adds value to the "unique_int" field.
|
|
func (_u *CommentUpdateOne) AddUniqueInt(v int) *CommentUpdateOne {
|
|
_u.mutation.AddUniqueInt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetUniqueFloat sets the "unique_float" field.
|
|
func (_u *CommentUpdateOne) SetUniqueFloat(v float64) *CommentUpdateOne {
|
|
_u.mutation.ResetUniqueFloat()
|
|
_u.mutation.SetUniqueFloat(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableUniqueFloat sets the "unique_float" field if the given value is not nil.
|
|
func (_u *CommentUpdateOne) SetNillableUniqueFloat(v *float64) *CommentUpdateOne {
|
|
if v != nil {
|
|
_u.SetUniqueFloat(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddUniqueFloat adds value to the "unique_float" field.
|
|
func (_u *CommentUpdateOne) AddUniqueFloat(v float64) *CommentUpdateOne {
|
|
_u.mutation.AddUniqueFloat(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableInt sets the "nillable_int" field.
|
|
func (_u *CommentUpdateOne) SetNillableInt(v int) *CommentUpdateOne {
|
|
_u.mutation.ResetNillableInt()
|
|
_u.mutation.SetNillableInt(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableNillableInt sets the "nillable_int" field if the given value is not nil.
|
|
func (_u *CommentUpdateOne) SetNillableNillableInt(v *int) *CommentUpdateOne {
|
|
if v != nil {
|
|
_u.SetNillableInt(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// AddNillableInt adds value to the "nillable_int" field.
|
|
func (_u *CommentUpdateOne) AddNillableInt(v int) *CommentUpdateOne {
|
|
_u.mutation.AddNillableInt(v)
|
|
return _u
|
|
}
|
|
|
|
// ClearNillableInt clears the value of the "nillable_int" field.
|
|
func (_u *CommentUpdateOne) ClearNillableInt() *CommentUpdateOne {
|
|
_u.mutation.ClearNillableInt()
|
|
return _u
|
|
}
|
|
|
|
// SetTable sets the "table" field.
|
|
func (_u *CommentUpdateOne) SetTable(v string) *CommentUpdateOne {
|
|
_u.mutation.SetTable(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableTable sets the "table" field if the given value is not nil.
|
|
func (_u *CommentUpdateOne) SetNillableTable(v *string) *CommentUpdateOne {
|
|
if v != nil {
|
|
_u.SetTable(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearTable clears the value of the "table" field.
|
|
func (_u *CommentUpdateOne) ClearTable() *CommentUpdateOne {
|
|
_u.mutation.ClearTable()
|
|
return _u
|
|
}
|
|
|
|
// SetDir sets the "dir" field.
|
|
func (_u *CommentUpdateOne) SetDir(v schemadir.Dir) *CommentUpdateOne {
|
|
_u.mutation.SetDir(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableDir sets the "dir" field if the given value is not nil.
|
|
func (_u *CommentUpdateOne) SetNillableDir(v *schemadir.Dir) *CommentUpdateOne {
|
|
if v != nil {
|
|
_u.SetDir(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearDir clears the value of the "dir" field.
|
|
func (_u *CommentUpdateOne) ClearDir() *CommentUpdateOne {
|
|
_u.mutation.ClearDir()
|
|
return _u
|
|
}
|
|
|
|
// SetClient sets the "client" field.
|
|
func (_u *CommentUpdateOne) SetClient(v string) *CommentUpdateOne {
|
|
_u.mutation.SetClient(v)
|
|
return _u
|
|
}
|
|
|
|
// SetNillableClient sets the "client" field if the given value is not nil.
|
|
func (_u *CommentUpdateOne) SetNillableClient(v *string) *CommentUpdateOne {
|
|
if v != nil {
|
|
_u.SetClient(*v)
|
|
}
|
|
return _u
|
|
}
|
|
|
|
// ClearClient clears the value of the "client" field.
|
|
func (_u *CommentUpdateOne) ClearClient() *CommentUpdateOne {
|
|
_u.mutation.ClearClient()
|
|
return _u
|
|
}
|
|
|
|
// Mutation returns the CommentMutation object of the builder.
|
|
func (_u *CommentUpdateOne) Mutation() *CommentMutation {
|
|
return _u.mutation
|
|
}
|
|
|
|
// Where appends a list predicates to the CommentUpdate builder.
|
|
func (_u *CommentUpdateOne) Where(ps ...predicate.Comment) *CommentUpdateOne {
|
|
_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 *CommentUpdateOne) Select(field string, fields ...string) *CommentUpdateOne {
|
|
_u.fields = append([]string{field}, fields...)
|
|
return _u
|
|
}
|
|
|
|
// Save executes the query and returns the updated Comment entity.
|
|
func (_u *CommentUpdateOne) Save(ctx context.Context) (*Comment, error) {
|
|
return withHooks(ctx, _u.gremlinSave, _u.mutation, _u.hooks)
|
|
}
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
func (_u *CommentUpdateOne) SaveX(ctx context.Context) *Comment {
|
|
node, err := _u.Save(ctx)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
return node
|
|
}
|
|
|
|
// Exec executes the query on the entity.
|
|
func (_u *CommentUpdateOne) Exec(ctx context.Context) error {
|
|
_, err := _u.Save(ctx)
|
|
return err
|
|
}
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
func (_u *CommentUpdateOne) ExecX(ctx context.Context) {
|
|
if err := _u.Exec(ctx); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
|
|
func (_u *CommentUpdateOne) gremlinSave(ctx context.Context) (*Comment, error) {
|
|
res := &gremlin.Response{}
|
|
id, ok := _u.mutation.ID()
|
|
if !ok {
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Comment.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 := &Comment{config: _u.config}
|
|
if err := _m.FromResponse(res); err != nil {
|
|
return nil, err
|
|
}
|
|
return _m, nil
|
|
}
|
|
|
|
func (_u *CommentUpdateOne) gremlin(id string) *dsl.Traversal {
|
|
type constraint struct {
|
|
pred *dsl.Traversal // constraint predicate.
|
|
test *dsl.Traversal // test matches and its constant.
|
|
}
|
|
constraints := make([]*constraint, 0, 2)
|
|
v := g.V(id)
|
|
var (
|
|
rv = v.Clone()
|
|
_ = rv
|
|
|
|
trs []*dsl.Traversal
|
|
)
|
|
if value, ok := _u.mutation.UniqueInt(); ok {
|
|
constraints = append(constraints, &constraint{
|
|
pred: g.V().Has(comment.Label, comment.FieldUniqueInt, value).Count(),
|
|
test: __.Is(p.NEQ(0)).Constant(NewErrUniqueField(comment.Label, comment.FieldUniqueInt, value)),
|
|
})
|
|
v.Property(dsl.Single, comment.FieldUniqueInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUniqueInt(); ok {
|
|
addValue := rv.Clone().Union(__.Values(comment.FieldUniqueInt), __.Constant(value)).Sum().Next()
|
|
constraints = append(constraints, &constraint{
|
|
pred: g.V().Has(comment.Label, comment.FieldUniqueInt, addValue).Count(),
|
|
test: __.Is(p.NEQ(0)).Constant(NewErrUniqueField(comment.Label, comment.FieldUniqueInt, fmt.Sprintf("+= %v", value))),
|
|
})
|
|
v.Property(dsl.Single, comment.FieldUniqueInt, __.Union(__.Values(comment.FieldUniqueInt), __.Constant(value)).Sum())
|
|
}
|
|
if value, ok := _u.mutation.UniqueFloat(); ok {
|
|
constraints = append(constraints, &constraint{
|
|
pred: g.V().Has(comment.Label, comment.FieldUniqueFloat, value).Count(),
|
|
test: __.Is(p.NEQ(0)).Constant(NewErrUniqueField(comment.Label, comment.FieldUniqueFloat, value)),
|
|
})
|
|
v.Property(dsl.Single, comment.FieldUniqueFloat, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedUniqueFloat(); ok {
|
|
addValue := rv.Clone().Union(__.Values(comment.FieldUniqueFloat), __.Constant(value)).Sum().Next()
|
|
constraints = append(constraints, &constraint{
|
|
pred: g.V().Has(comment.Label, comment.FieldUniqueFloat, addValue).Count(),
|
|
test: __.Is(p.NEQ(0)).Constant(NewErrUniqueField(comment.Label, comment.FieldUniqueFloat, fmt.Sprintf("+= %v", value))),
|
|
})
|
|
v.Property(dsl.Single, comment.FieldUniqueFloat, __.Union(__.Values(comment.FieldUniqueFloat), __.Constant(value)).Sum())
|
|
}
|
|
if value, ok := _u.mutation.NillableInt(); ok {
|
|
v.Property(dsl.Single, comment.FieldNillableInt, value)
|
|
}
|
|
if value, ok := _u.mutation.AddedNillableInt(); ok {
|
|
v.Property(dsl.Single, comment.FieldNillableInt, __.Union(__.Values(comment.FieldNillableInt), __.Constant(value)).Sum())
|
|
}
|
|
if value, ok := _u.mutation.Table(); ok {
|
|
v.Property(dsl.Single, comment.FieldTable, value)
|
|
}
|
|
if value, ok := _u.mutation.Dir(); ok {
|
|
v.Property(dsl.Single, comment.FieldDir, value)
|
|
}
|
|
if value, ok := _u.mutation.GetClient(); ok {
|
|
v.Property(dsl.Single, comment.FieldClient, value)
|
|
}
|
|
var properties []any
|
|
if _u.mutation.NillableIntCleared() {
|
|
properties = append(properties, comment.FieldNillableInt)
|
|
}
|
|
if _u.mutation.TableCleared() {
|
|
properties = append(properties, comment.FieldTable)
|
|
}
|
|
if _u.mutation.DirCleared() {
|
|
properties = append(properties, comment.FieldDir)
|
|
}
|
|
if _u.mutation.ClientCleared() {
|
|
properties = append(properties, comment.FieldClient)
|
|
}
|
|
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)
|
|
}
|
|
if len(constraints) > 0 {
|
|
v = constraints[0].pred.Coalesce(constraints[0].test, v)
|
|
for _, cr := range constraints[1:] {
|
|
v = cr.pred.Coalesce(cr.test, v)
|
|
}
|
|
}
|
|
trs = append(trs, v)
|
|
return dsl.Join(trs...)
|
|
}
|