notification_update.go•21.9 kB
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"time"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/Southclaws/storyden/internal/ent/account"
"github.com/Southclaws/storyden/internal/ent/notification"
"github.com/Southclaws/storyden/internal/ent/predicate"
"github.com/rs/xid"
)
// NotificationUpdate is the builder for updating Notification entities.
type NotificationUpdate struct {
config
hooks []Hook
mutation *NotificationMutation
modifiers []func(*sql.UpdateBuilder)
}
// Where appends a list predicates to the NotificationUpdate builder.
func (_u *NotificationUpdate) Where(ps ...predicate.Notification) *NotificationUpdate {
_u.mutation.Where(ps...)
return _u
}
// SetDeletedAt sets the "deleted_at" field.
func (_u *NotificationUpdate) SetDeletedAt(v time.Time) *NotificationUpdate {
_u.mutation.SetDeletedAt(v)
return _u
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_u *NotificationUpdate) SetNillableDeletedAt(v *time.Time) *NotificationUpdate {
if v != nil {
_u.SetDeletedAt(*v)
}
return _u
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (_u *NotificationUpdate) ClearDeletedAt() *NotificationUpdate {
_u.mutation.ClearDeletedAt()
return _u
}
// SetEventType sets the "event_type" field.
func (_u *NotificationUpdate) SetEventType(v string) *NotificationUpdate {
_u.mutation.SetEventType(v)
return _u
}
// SetNillableEventType sets the "event_type" field if the given value is not nil.
func (_u *NotificationUpdate) SetNillableEventType(v *string) *NotificationUpdate {
if v != nil {
_u.SetEventType(*v)
}
return _u
}
// SetDatagraphKind sets the "datagraph_kind" field.
func (_u *NotificationUpdate) SetDatagraphKind(v string) *NotificationUpdate {
_u.mutation.SetDatagraphKind(v)
return _u
}
// SetNillableDatagraphKind sets the "datagraph_kind" field if the given value is not nil.
func (_u *NotificationUpdate) SetNillableDatagraphKind(v *string) *NotificationUpdate {
if v != nil {
_u.SetDatagraphKind(*v)
}
return _u
}
// ClearDatagraphKind clears the value of the "datagraph_kind" field.
func (_u *NotificationUpdate) ClearDatagraphKind() *NotificationUpdate {
_u.mutation.ClearDatagraphKind()
return _u
}
// SetDatagraphID sets the "datagraph_id" field.
func (_u *NotificationUpdate) SetDatagraphID(v xid.ID) *NotificationUpdate {
_u.mutation.SetDatagraphID(v)
return _u
}
// SetNillableDatagraphID sets the "datagraph_id" field if the given value is not nil.
func (_u *NotificationUpdate) SetNillableDatagraphID(v *xid.ID) *NotificationUpdate {
if v != nil {
_u.SetDatagraphID(*v)
}
return _u
}
// ClearDatagraphID clears the value of the "datagraph_id" field.
func (_u *NotificationUpdate) ClearDatagraphID() *NotificationUpdate {
_u.mutation.ClearDatagraphID()
return _u
}
// SetRead sets the "read" field.
func (_u *NotificationUpdate) SetRead(v bool) *NotificationUpdate {
_u.mutation.SetRead(v)
return _u
}
// SetNillableRead sets the "read" field if the given value is not nil.
func (_u *NotificationUpdate) SetNillableRead(v *bool) *NotificationUpdate {
if v != nil {
_u.SetRead(*v)
}
return _u
}
// SetOwnerAccountID sets the "owner_account_id" field.
func (_u *NotificationUpdate) SetOwnerAccountID(v xid.ID) *NotificationUpdate {
_u.mutation.SetOwnerAccountID(v)
return _u
}
// SetNillableOwnerAccountID sets the "owner_account_id" field if the given value is not nil.
func (_u *NotificationUpdate) SetNillableOwnerAccountID(v *xid.ID) *NotificationUpdate {
if v != nil {
_u.SetOwnerAccountID(*v)
}
return _u
}
// SetSourceAccountID sets the "source_account_id" field.
func (_u *NotificationUpdate) SetSourceAccountID(v xid.ID) *NotificationUpdate {
_u.mutation.SetSourceAccountID(v)
return _u
}
// SetNillableSourceAccountID sets the "source_account_id" field if the given value is not nil.
func (_u *NotificationUpdate) SetNillableSourceAccountID(v *xid.ID) *NotificationUpdate {
if v != nil {
_u.SetSourceAccountID(*v)
}
return _u
}
// ClearSourceAccountID clears the value of the "source_account_id" field.
func (_u *NotificationUpdate) ClearSourceAccountID() *NotificationUpdate {
_u.mutation.ClearSourceAccountID()
return _u
}
// SetOwnerID sets the "owner" edge to the Account entity by ID.
func (_u *NotificationUpdate) SetOwnerID(id xid.ID) *NotificationUpdate {
_u.mutation.SetOwnerID(id)
return _u
}
// SetOwner sets the "owner" edge to the Account entity.
func (_u *NotificationUpdate) SetOwner(v *Account) *NotificationUpdate {
return _u.SetOwnerID(v.ID)
}
// SetSourceID sets the "source" edge to the Account entity by ID.
func (_u *NotificationUpdate) SetSourceID(id xid.ID) *NotificationUpdate {
_u.mutation.SetSourceID(id)
return _u
}
// SetNillableSourceID sets the "source" edge to the Account entity by ID if the given value is not nil.
func (_u *NotificationUpdate) SetNillableSourceID(id *xid.ID) *NotificationUpdate {
if id != nil {
_u = _u.SetSourceID(*id)
}
return _u
}
// SetSource sets the "source" edge to the Account entity.
func (_u *NotificationUpdate) SetSource(v *Account) *NotificationUpdate {
return _u.SetSourceID(v.ID)
}
// Mutation returns the NotificationMutation object of the builder.
func (_u *NotificationUpdate) Mutation() *NotificationMutation {
return _u.mutation
}
// ClearOwner clears the "owner" edge to the Account entity.
func (_u *NotificationUpdate) ClearOwner() *NotificationUpdate {
_u.mutation.ClearOwner()
return _u
}
// ClearSource clears the "source" edge to the Account entity.
func (_u *NotificationUpdate) ClearSource() *NotificationUpdate {
_u.mutation.ClearSource()
return _u
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (_u *NotificationUpdate) Save(ctx context.Context) (int, error) {
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *NotificationUpdate) SaveX(ctx context.Context) int {
affected, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (_u *NotificationUpdate) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *NotificationUpdate) 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 *NotificationUpdate) check() error {
if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Notification.owner"`)
}
return nil
}
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (_u *NotificationUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *NotificationUpdate {
_u.modifiers = append(_u.modifiers, modifiers...)
return _u
}
func (_u *NotificationUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(notification.Table, notification.Columns, sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString))
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.DeletedAt(); ok {
_spec.SetField(notification.FieldDeletedAt, field.TypeTime, value)
}
if _u.mutation.DeletedAtCleared() {
_spec.ClearField(notification.FieldDeletedAt, field.TypeTime)
}
if value, ok := _u.mutation.EventType(); ok {
_spec.SetField(notification.FieldEventType, field.TypeString, value)
}
if value, ok := _u.mutation.DatagraphKind(); ok {
_spec.SetField(notification.FieldDatagraphKind, field.TypeString, value)
}
if _u.mutation.DatagraphKindCleared() {
_spec.ClearField(notification.FieldDatagraphKind, field.TypeString)
}
if value, ok := _u.mutation.DatagraphID(); ok {
_spec.SetField(notification.FieldDatagraphID, field.TypeString, value)
}
if _u.mutation.DatagraphIDCleared() {
_spec.ClearField(notification.FieldDatagraphID, field.TypeString)
}
if value, ok := _u.mutation.Read(); ok {
_spec.SetField(notification.FieldRead, field.TypeBool, value)
}
if _u.mutation.OwnerCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: notification.OwnerTable,
Columns: []string{notification.OwnerColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: notification.OwnerTable,
Columns: []string{notification.OwnerColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.SourceCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: notification.SourceTable,
Columns: []string{notification.SourceColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.SourceIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: notification.SourceTable,
Columns: []string{notification.SourceColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
_spec.AddModifiers(_u.modifiers...)
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{notification.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
_u.mutation.done = true
return _node, nil
}
// NotificationUpdateOne is the builder for updating a single Notification entity.
type NotificationUpdateOne struct {
config
fields []string
hooks []Hook
mutation *NotificationMutation
modifiers []func(*sql.UpdateBuilder)
}
// SetDeletedAt sets the "deleted_at" field.
func (_u *NotificationUpdateOne) SetDeletedAt(v time.Time) *NotificationUpdateOne {
_u.mutation.SetDeletedAt(v)
return _u
}
// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil.
func (_u *NotificationUpdateOne) SetNillableDeletedAt(v *time.Time) *NotificationUpdateOne {
if v != nil {
_u.SetDeletedAt(*v)
}
return _u
}
// ClearDeletedAt clears the value of the "deleted_at" field.
func (_u *NotificationUpdateOne) ClearDeletedAt() *NotificationUpdateOne {
_u.mutation.ClearDeletedAt()
return _u
}
// SetEventType sets the "event_type" field.
func (_u *NotificationUpdateOne) SetEventType(v string) *NotificationUpdateOne {
_u.mutation.SetEventType(v)
return _u
}
// SetNillableEventType sets the "event_type" field if the given value is not nil.
func (_u *NotificationUpdateOne) SetNillableEventType(v *string) *NotificationUpdateOne {
if v != nil {
_u.SetEventType(*v)
}
return _u
}
// SetDatagraphKind sets the "datagraph_kind" field.
func (_u *NotificationUpdateOne) SetDatagraphKind(v string) *NotificationUpdateOne {
_u.mutation.SetDatagraphKind(v)
return _u
}
// SetNillableDatagraphKind sets the "datagraph_kind" field if the given value is not nil.
func (_u *NotificationUpdateOne) SetNillableDatagraphKind(v *string) *NotificationUpdateOne {
if v != nil {
_u.SetDatagraphKind(*v)
}
return _u
}
// ClearDatagraphKind clears the value of the "datagraph_kind" field.
func (_u *NotificationUpdateOne) ClearDatagraphKind() *NotificationUpdateOne {
_u.mutation.ClearDatagraphKind()
return _u
}
// SetDatagraphID sets the "datagraph_id" field.
func (_u *NotificationUpdateOne) SetDatagraphID(v xid.ID) *NotificationUpdateOne {
_u.mutation.SetDatagraphID(v)
return _u
}
// SetNillableDatagraphID sets the "datagraph_id" field if the given value is not nil.
func (_u *NotificationUpdateOne) SetNillableDatagraphID(v *xid.ID) *NotificationUpdateOne {
if v != nil {
_u.SetDatagraphID(*v)
}
return _u
}
// ClearDatagraphID clears the value of the "datagraph_id" field.
func (_u *NotificationUpdateOne) ClearDatagraphID() *NotificationUpdateOne {
_u.mutation.ClearDatagraphID()
return _u
}
// SetRead sets the "read" field.
func (_u *NotificationUpdateOne) SetRead(v bool) *NotificationUpdateOne {
_u.mutation.SetRead(v)
return _u
}
// SetNillableRead sets the "read" field if the given value is not nil.
func (_u *NotificationUpdateOne) SetNillableRead(v *bool) *NotificationUpdateOne {
if v != nil {
_u.SetRead(*v)
}
return _u
}
// SetOwnerAccountID sets the "owner_account_id" field.
func (_u *NotificationUpdateOne) SetOwnerAccountID(v xid.ID) *NotificationUpdateOne {
_u.mutation.SetOwnerAccountID(v)
return _u
}
// SetNillableOwnerAccountID sets the "owner_account_id" field if the given value is not nil.
func (_u *NotificationUpdateOne) SetNillableOwnerAccountID(v *xid.ID) *NotificationUpdateOne {
if v != nil {
_u.SetOwnerAccountID(*v)
}
return _u
}
// SetSourceAccountID sets the "source_account_id" field.
func (_u *NotificationUpdateOne) SetSourceAccountID(v xid.ID) *NotificationUpdateOne {
_u.mutation.SetSourceAccountID(v)
return _u
}
// SetNillableSourceAccountID sets the "source_account_id" field if the given value is not nil.
func (_u *NotificationUpdateOne) SetNillableSourceAccountID(v *xid.ID) *NotificationUpdateOne {
if v != nil {
_u.SetSourceAccountID(*v)
}
return _u
}
// ClearSourceAccountID clears the value of the "source_account_id" field.
func (_u *NotificationUpdateOne) ClearSourceAccountID() *NotificationUpdateOne {
_u.mutation.ClearSourceAccountID()
return _u
}
// SetOwnerID sets the "owner" edge to the Account entity by ID.
func (_u *NotificationUpdateOne) SetOwnerID(id xid.ID) *NotificationUpdateOne {
_u.mutation.SetOwnerID(id)
return _u
}
// SetOwner sets the "owner" edge to the Account entity.
func (_u *NotificationUpdateOne) SetOwner(v *Account) *NotificationUpdateOne {
return _u.SetOwnerID(v.ID)
}
// SetSourceID sets the "source" edge to the Account entity by ID.
func (_u *NotificationUpdateOne) SetSourceID(id xid.ID) *NotificationUpdateOne {
_u.mutation.SetSourceID(id)
return _u
}
// SetNillableSourceID sets the "source" edge to the Account entity by ID if the given value is not nil.
func (_u *NotificationUpdateOne) SetNillableSourceID(id *xid.ID) *NotificationUpdateOne {
if id != nil {
_u = _u.SetSourceID(*id)
}
return _u
}
// SetSource sets the "source" edge to the Account entity.
func (_u *NotificationUpdateOne) SetSource(v *Account) *NotificationUpdateOne {
return _u.SetSourceID(v.ID)
}
// Mutation returns the NotificationMutation object of the builder.
func (_u *NotificationUpdateOne) Mutation() *NotificationMutation {
return _u.mutation
}
// ClearOwner clears the "owner" edge to the Account entity.
func (_u *NotificationUpdateOne) ClearOwner() *NotificationUpdateOne {
_u.mutation.ClearOwner()
return _u
}
// ClearSource clears the "source" edge to the Account entity.
func (_u *NotificationUpdateOne) ClearSource() *NotificationUpdateOne {
_u.mutation.ClearSource()
return _u
}
// Where appends a list predicates to the NotificationUpdate builder.
func (_u *NotificationUpdateOne) Where(ps ...predicate.Notification) *NotificationUpdateOne {
_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 *NotificationUpdateOne) Select(field string, fields ...string) *NotificationUpdateOne {
_u.fields = append([]string{field}, fields...)
return _u
}
// Save executes the query and returns the updated Notification entity.
func (_u *NotificationUpdateOne) Save(ctx context.Context) (*Notification, error) {
return withHooks(ctx, _u.sqlSave, _u.mutation, _u.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (_u *NotificationUpdateOne) SaveX(ctx context.Context) *Notification {
node, err := _u.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (_u *NotificationUpdateOne) Exec(ctx context.Context) error {
_, err := _u.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (_u *NotificationUpdateOne) 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 *NotificationUpdateOne) check() error {
if _u.mutation.OwnerCleared() && len(_u.mutation.OwnerIDs()) > 0 {
return errors.New(`ent: clearing a required unique edge "Notification.owner"`)
}
return nil
}
// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
func (_u *NotificationUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *NotificationUpdateOne {
_u.modifiers = append(_u.modifiers, modifiers...)
return _u
}
func (_u *NotificationUpdateOne) sqlSave(ctx context.Context) (_node *Notification, err error) {
if err := _u.check(); err != nil {
return _node, err
}
_spec := sqlgraph.NewUpdateSpec(notification.Table, notification.Columns, sqlgraph.NewFieldSpec(notification.FieldID, field.TypeString))
id, ok := _u.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Notification.id" for update`)}
}
_spec.Node.ID.Value = id
if fields := _u.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, notification.FieldID)
for _, f := range fields {
if !notification.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != notification.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := _u.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := _u.mutation.DeletedAt(); ok {
_spec.SetField(notification.FieldDeletedAt, field.TypeTime, value)
}
if _u.mutation.DeletedAtCleared() {
_spec.ClearField(notification.FieldDeletedAt, field.TypeTime)
}
if value, ok := _u.mutation.EventType(); ok {
_spec.SetField(notification.FieldEventType, field.TypeString, value)
}
if value, ok := _u.mutation.DatagraphKind(); ok {
_spec.SetField(notification.FieldDatagraphKind, field.TypeString, value)
}
if _u.mutation.DatagraphKindCleared() {
_spec.ClearField(notification.FieldDatagraphKind, field.TypeString)
}
if value, ok := _u.mutation.DatagraphID(); ok {
_spec.SetField(notification.FieldDatagraphID, field.TypeString, value)
}
if _u.mutation.DatagraphIDCleared() {
_spec.ClearField(notification.FieldDatagraphID, field.TypeString)
}
if value, ok := _u.mutation.Read(); ok {
_spec.SetField(notification.FieldRead, field.TypeBool, value)
}
if _u.mutation.OwnerCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: notification.OwnerTable,
Columns: []string{notification.OwnerColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.OwnerIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: notification.OwnerTable,
Columns: []string{notification.OwnerColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
if _u.mutation.SourceCleared() {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: notification.SourceTable,
Columns: []string{notification.SourceColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString),
},
}
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
}
if nodes := _u.mutation.SourceIDs(); len(nodes) > 0 {
edge := &sqlgraph.EdgeSpec{
Rel: sqlgraph.M2O,
Inverse: true,
Table: notification.SourceTable,
Columns: []string{notification.SourceColumn},
Bidi: false,
Target: &sqlgraph.EdgeTarget{
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeString),
},
}
for _, k := range nodes {
edge.Target.Nodes = append(edge.Target.Nodes, k)
}
_spec.Edges.Add = append(_spec.Edges.Add, edge)
}
_spec.AddModifiers(_u.modifiers...)
_node = &Notification{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{notification.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
_u.mutation.done = true
return _node, nil
}