2025-02-06 09:31:49 +01:00
|
|
|
// Code generated by ent, DO NOT EDIT.
|
2022-04-08 21:26:25 +02:00
|
|
|
|
|
|
|
package ent
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"code.icod.de/postfix/manager/ent/account"
|
|
|
|
"code.icod.de/postfix/manager/ent/domain"
|
|
|
|
"code.icod.de/postfix/manager/ent/logentry"
|
|
|
|
"code.icod.de/postfix/manager/ent/predicate"
|
|
|
|
"entgo.io/ent/dialect/sql"
|
|
|
|
"entgo.io/ent/dialect/sql/sqlgraph"
|
|
|
|
"entgo.io/ent/schema/field"
|
|
|
|
)
|
|
|
|
|
|
|
|
// LogentryUpdate is the builder for updating Logentry entities.
|
|
|
|
type LogentryUpdate struct {
|
|
|
|
config
|
|
|
|
hooks []Hook
|
|
|
|
mutation *LogentryMutation
|
|
|
|
}
|
|
|
|
|
|
|
|
// Where appends a list predicates to the LogentryUpdate builder.
|
|
|
|
func (lu *LogentryUpdate) Where(ps ...predicate.Logentry) *LogentryUpdate {
|
|
|
|
lu.mutation.Where(ps...)
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAction sets the "action" field.
|
|
|
|
func (lu *LogentryUpdate) SetAction(s string) *LogentryUpdate {
|
|
|
|
lu.mutation.SetAction(s)
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
2025-02-06 09:31:49 +01:00
|
|
|
// SetNillableAction sets the "action" field if the given value is not nil.
|
|
|
|
func (lu *LogentryUpdate) SetNillableAction(s *string) *LogentryUpdate {
|
|
|
|
if s != nil {
|
|
|
|
lu.SetAction(*s)
|
|
|
|
}
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
2022-04-08 21:26:25 +02:00
|
|
|
// SetData sets the "data" field.
|
|
|
|
func (lu *LogentryUpdate) SetData(s string) *LogentryUpdate {
|
|
|
|
lu.mutation.SetData(s)
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNillableData sets the "data" field if the given value is not nil.
|
|
|
|
func (lu *LogentryUpdate) SetNillableData(s *string) *LogentryUpdate {
|
|
|
|
if s != nil {
|
|
|
|
lu.SetData(*s)
|
|
|
|
}
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearData clears the value of the "data" field.
|
|
|
|
func (lu *LogentryUpdate) ClearData() *LogentryUpdate {
|
|
|
|
lu.mutation.ClearData()
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAccountID sets the "account_id" field.
|
|
|
|
func (lu *LogentryUpdate) SetAccountID(i int64) *LogentryUpdate {
|
|
|
|
lu.mutation.SetAccountID(i)
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNillableAccountID sets the "account_id" field if the given value is not nil.
|
|
|
|
func (lu *LogentryUpdate) SetNillableAccountID(i *int64) *LogentryUpdate {
|
|
|
|
if i != nil {
|
|
|
|
lu.SetAccountID(*i)
|
|
|
|
}
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearAccountID clears the value of the "account_id" field.
|
|
|
|
func (lu *LogentryUpdate) ClearAccountID() *LogentryUpdate {
|
|
|
|
lu.mutation.ClearAccountID()
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetDomainID sets the "domain_id" field.
|
|
|
|
func (lu *LogentryUpdate) SetDomainID(i int64) *LogentryUpdate {
|
|
|
|
lu.mutation.SetDomainID(i)
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNillableDomainID sets the "domain_id" field if the given value is not nil.
|
|
|
|
func (lu *LogentryUpdate) SetNillableDomainID(i *int64) *LogentryUpdate {
|
|
|
|
if i != nil {
|
|
|
|
lu.SetDomainID(*i)
|
|
|
|
}
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearDomainID clears the value of the "domain_id" field.
|
|
|
|
func (lu *LogentryUpdate) ClearDomainID() *LogentryUpdate {
|
|
|
|
lu.mutation.ClearDomainID()
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAccount sets the "account" edge to the Account entity.
|
|
|
|
func (lu *LogentryUpdate) SetAccount(a *Account) *LogentryUpdate {
|
|
|
|
return lu.SetAccountID(a.ID)
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetDomain sets the "domain" edge to the Domain entity.
|
|
|
|
func (lu *LogentryUpdate) SetDomain(d *Domain) *LogentryUpdate {
|
|
|
|
return lu.SetDomainID(d.ID)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mutation returns the LogentryMutation object of the builder.
|
|
|
|
func (lu *LogentryUpdate) Mutation() *LogentryMutation {
|
|
|
|
return lu.mutation
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearAccount clears the "account" edge to the Account entity.
|
|
|
|
func (lu *LogentryUpdate) ClearAccount() *LogentryUpdate {
|
|
|
|
lu.mutation.ClearAccount()
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearDomain clears the "domain" edge to the Domain entity.
|
|
|
|
func (lu *LogentryUpdate) ClearDomain() *LogentryUpdate {
|
|
|
|
lu.mutation.ClearDomain()
|
|
|
|
return lu
|
|
|
|
}
|
|
|
|
|
|
|
|
// Save executes the query and returns the number of nodes affected by the update operation.
|
|
|
|
func (lu *LogentryUpdate) Save(ctx context.Context) (int, error) {
|
2025-02-06 09:31:49 +01:00
|
|
|
return withHooks(ctx, lu.sqlSave, lu.mutation, lu.hooks)
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
|
|
func (lu *LogentryUpdate) SaveX(ctx context.Context) int {
|
|
|
|
affected, err := lu.Save(ctx)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return affected
|
|
|
|
}
|
|
|
|
|
|
|
|
// Exec executes the query.
|
|
|
|
func (lu *LogentryUpdate) Exec(ctx context.Context) error {
|
|
|
|
_, err := lu.Save(ctx)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
|
|
func (lu *LogentryUpdate) ExecX(ctx context.Context) {
|
|
|
|
if err := lu.Exec(ctx); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (lu *LogentryUpdate) sqlSave(ctx context.Context) (n int, err error) {
|
2025-02-06 09:31:49 +01:00
|
|
|
_spec := sqlgraph.NewUpdateSpec(logentry.Table, logentry.Columns, sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64))
|
2022-04-08 21:26:25 +02:00
|
|
|
if ps := lu.mutation.predicates; len(ps) > 0 {
|
|
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
|
|
for i := range ps {
|
|
|
|
ps[i](selector)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if value, ok := lu.mutation.Action(); ok {
|
2025-02-06 09:31:49 +01:00
|
|
|
_spec.SetField(logentry.FieldAction, field.TypeString, value)
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
if value, ok := lu.mutation.Data(); ok {
|
2025-02-06 09:31:49 +01:00
|
|
|
_spec.SetField(logentry.FieldData, field.TypeString, value)
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
if lu.mutation.DataCleared() {
|
2025-02-06 09:31:49 +01:00
|
|
|
_spec.ClearField(logentry.FieldData, field.TypeString)
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
if lu.mutation.AccountCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: logentry.AccountTable,
|
|
|
|
Columns: []string{logentry.AccountColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2025-02-06 09:31:49 +01:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
2022-04-08 21:26:25 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := lu.mutation.AccountIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: logentry.AccountTable,
|
|
|
|
Columns: []string{logentry.AccountColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2025-02-06 09:31:49 +01:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
2022-04-08 21:26:25 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if lu.mutation.DomainCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: logentry.DomainTable,
|
|
|
|
Columns: []string{logentry.DomainColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2025-02-06 09:31:49 +01:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
2022-04-08 21:26:25 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := lu.mutation.DomainIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: logentry.DomainTable,
|
|
|
|
Columns: []string{logentry.DomainColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2025-02-06 09:31:49 +01:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
2022-04-08 21:26:25 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if n, err = sqlgraph.UpdateNodes(ctx, lu.driver, _spec); err != nil {
|
|
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
|
|
err = &NotFoundError{logentry.Label}
|
|
|
|
} else if sqlgraph.IsConstraintError(err) {
|
2025-02-06 09:31:49 +01:00
|
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
return 0, err
|
|
|
|
}
|
2025-02-06 09:31:49 +01:00
|
|
|
lu.mutation.done = true
|
2022-04-08 21:26:25 +02:00
|
|
|
return n, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// LogentryUpdateOne is the builder for updating a single Logentry entity.
|
|
|
|
type LogentryUpdateOne struct {
|
|
|
|
config
|
|
|
|
fields []string
|
|
|
|
hooks []Hook
|
|
|
|
mutation *LogentryMutation
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAction sets the "action" field.
|
|
|
|
func (luo *LogentryUpdateOne) SetAction(s string) *LogentryUpdateOne {
|
|
|
|
luo.mutation.SetAction(s)
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
2025-02-06 09:31:49 +01:00
|
|
|
// SetNillableAction sets the "action" field if the given value is not nil.
|
|
|
|
func (luo *LogentryUpdateOne) SetNillableAction(s *string) *LogentryUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
luo.SetAction(*s)
|
|
|
|
}
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
2022-04-08 21:26:25 +02:00
|
|
|
// SetData sets the "data" field.
|
|
|
|
func (luo *LogentryUpdateOne) SetData(s string) *LogentryUpdateOne {
|
|
|
|
luo.mutation.SetData(s)
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNillableData sets the "data" field if the given value is not nil.
|
|
|
|
func (luo *LogentryUpdateOne) SetNillableData(s *string) *LogentryUpdateOne {
|
|
|
|
if s != nil {
|
|
|
|
luo.SetData(*s)
|
|
|
|
}
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearData clears the value of the "data" field.
|
|
|
|
func (luo *LogentryUpdateOne) ClearData() *LogentryUpdateOne {
|
|
|
|
luo.mutation.ClearData()
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAccountID sets the "account_id" field.
|
|
|
|
func (luo *LogentryUpdateOne) SetAccountID(i int64) *LogentryUpdateOne {
|
|
|
|
luo.mutation.SetAccountID(i)
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNillableAccountID sets the "account_id" field if the given value is not nil.
|
|
|
|
func (luo *LogentryUpdateOne) SetNillableAccountID(i *int64) *LogentryUpdateOne {
|
|
|
|
if i != nil {
|
|
|
|
luo.SetAccountID(*i)
|
|
|
|
}
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearAccountID clears the value of the "account_id" field.
|
|
|
|
func (luo *LogentryUpdateOne) ClearAccountID() *LogentryUpdateOne {
|
|
|
|
luo.mutation.ClearAccountID()
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetDomainID sets the "domain_id" field.
|
|
|
|
func (luo *LogentryUpdateOne) SetDomainID(i int64) *LogentryUpdateOne {
|
|
|
|
luo.mutation.SetDomainID(i)
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetNillableDomainID sets the "domain_id" field if the given value is not nil.
|
|
|
|
func (luo *LogentryUpdateOne) SetNillableDomainID(i *int64) *LogentryUpdateOne {
|
|
|
|
if i != nil {
|
|
|
|
luo.SetDomainID(*i)
|
|
|
|
}
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearDomainID clears the value of the "domain_id" field.
|
|
|
|
func (luo *LogentryUpdateOne) ClearDomainID() *LogentryUpdateOne {
|
|
|
|
luo.mutation.ClearDomainID()
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetAccount sets the "account" edge to the Account entity.
|
|
|
|
func (luo *LogentryUpdateOne) SetAccount(a *Account) *LogentryUpdateOne {
|
|
|
|
return luo.SetAccountID(a.ID)
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetDomain sets the "domain" edge to the Domain entity.
|
|
|
|
func (luo *LogentryUpdateOne) SetDomain(d *Domain) *LogentryUpdateOne {
|
|
|
|
return luo.SetDomainID(d.ID)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mutation returns the LogentryMutation object of the builder.
|
|
|
|
func (luo *LogentryUpdateOne) Mutation() *LogentryMutation {
|
|
|
|
return luo.mutation
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearAccount clears the "account" edge to the Account entity.
|
|
|
|
func (luo *LogentryUpdateOne) ClearAccount() *LogentryUpdateOne {
|
|
|
|
luo.mutation.ClearAccount()
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearDomain clears the "domain" edge to the Domain entity.
|
|
|
|
func (luo *LogentryUpdateOne) ClearDomain() *LogentryUpdateOne {
|
|
|
|
luo.mutation.ClearDomain()
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
2025-02-06 09:31:49 +01:00
|
|
|
// Where appends a list predicates to the LogentryUpdate builder.
|
|
|
|
func (luo *LogentryUpdateOne) Where(ps ...predicate.Logentry) *LogentryUpdateOne {
|
|
|
|
luo.mutation.Where(ps...)
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
2022-04-08 21:26:25 +02:00
|
|
|
// Select allows selecting one or more fields (columns) of the returned entity.
|
|
|
|
// The default is selecting all fields defined in the entity schema.
|
|
|
|
func (luo *LogentryUpdateOne) Select(field string, fields ...string) *LogentryUpdateOne {
|
|
|
|
luo.fields = append([]string{field}, fields...)
|
|
|
|
return luo
|
|
|
|
}
|
|
|
|
|
|
|
|
// Save executes the query and returns the updated Logentry entity.
|
|
|
|
func (luo *LogentryUpdateOne) Save(ctx context.Context) (*Logentry, error) {
|
2025-02-06 09:31:49 +01:00
|
|
|
return withHooks(ctx, luo.sqlSave, luo.mutation, luo.hooks)
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// SaveX is like Save, but panics if an error occurs.
|
|
|
|
func (luo *LogentryUpdateOne) SaveX(ctx context.Context) *Logentry {
|
|
|
|
node, err := luo.Save(ctx)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return node
|
|
|
|
}
|
|
|
|
|
|
|
|
// Exec executes the query on the entity.
|
|
|
|
func (luo *LogentryUpdateOne) Exec(ctx context.Context) error {
|
|
|
|
_, err := luo.Save(ctx)
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecX is like Exec, but panics if an error occurs.
|
|
|
|
func (luo *LogentryUpdateOne) ExecX(ctx context.Context) {
|
|
|
|
if err := luo.Exec(ctx); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (luo *LogentryUpdateOne) sqlSave(ctx context.Context) (_node *Logentry, err error) {
|
2025-02-06 09:31:49 +01:00
|
|
|
_spec := sqlgraph.NewUpdateSpec(logentry.Table, logentry.Columns, sqlgraph.NewFieldSpec(logentry.FieldID, field.TypeInt64))
|
2022-04-08 21:26:25 +02:00
|
|
|
id, ok := luo.mutation.ID()
|
|
|
|
if !ok {
|
|
|
|
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "Logentry.id" for update`)}
|
|
|
|
}
|
|
|
|
_spec.Node.ID.Value = id
|
|
|
|
if fields := luo.fields; len(fields) > 0 {
|
|
|
|
_spec.Node.Columns = make([]string, 0, len(fields))
|
|
|
|
_spec.Node.Columns = append(_spec.Node.Columns, logentry.FieldID)
|
|
|
|
for _, f := range fields {
|
|
|
|
if !logentry.ValidColumn(f) {
|
|
|
|
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
|
|
|
|
}
|
|
|
|
if f != logentry.FieldID {
|
|
|
|
_spec.Node.Columns = append(_spec.Node.Columns, f)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ps := luo.mutation.predicates; len(ps) > 0 {
|
|
|
|
_spec.Predicate = func(selector *sql.Selector) {
|
|
|
|
for i := range ps {
|
|
|
|
ps[i](selector)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if value, ok := luo.mutation.Action(); ok {
|
2025-02-06 09:31:49 +01:00
|
|
|
_spec.SetField(logentry.FieldAction, field.TypeString, value)
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
if value, ok := luo.mutation.Data(); ok {
|
2025-02-06 09:31:49 +01:00
|
|
|
_spec.SetField(logentry.FieldData, field.TypeString, value)
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
if luo.mutation.DataCleared() {
|
2025-02-06 09:31:49 +01:00
|
|
|
_spec.ClearField(logentry.FieldData, field.TypeString)
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
if luo.mutation.AccountCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: logentry.AccountTable,
|
|
|
|
Columns: []string{logentry.AccountColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2025-02-06 09:31:49 +01:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
2022-04-08 21:26:25 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := luo.mutation.AccountIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: logentry.AccountTable,
|
|
|
|
Columns: []string{logentry.AccountColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2025-02-06 09:31:49 +01:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(account.FieldID, field.TypeInt64),
|
2022-04-08 21:26:25 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
if luo.mutation.DomainCleared() {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: logentry.DomainTable,
|
|
|
|
Columns: []string{logentry.DomainColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2025-02-06 09:31:49 +01:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
2022-04-08 21:26:25 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
_spec.Edges.Clear = append(_spec.Edges.Clear, edge)
|
|
|
|
}
|
|
|
|
if nodes := luo.mutation.DomainIDs(); len(nodes) > 0 {
|
|
|
|
edge := &sqlgraph.EdgeSpec{
|
|
|
|
Rel: sqlgraph.M2O,
|
|
|
|
Inverse: true,
|
|
|
|
Table: logentry.DomainTable,
|
|
|
|
Columns: []string{logentry.DomainColumn},
|
|
|
|
Bidi: false,
|
|
|
|
Target: &sqlgraph.EdgeTarget{
|
2025-02-06 09:31:49 +01:00
|
|
|
IDSpec: sqlgraph.NewFieldSpec(domain.FieldID, field.TypeInt64),
|
2022-04-08 21:26:25 +02:00
|
|
|
},
|
|
|
|
}
|
|
|
|
for _, k := range nodes {
|
|
|
|
edge.Target.Nodes = append(edge.Target.Nodes, k)
|
|
|
|
}
|
|
|
|
_spec.Edges.Add = append(_spec.Edges.Add, edge)
|
|
|
|
}
|
|
|
|
_node = &Logentry{config: luo.config}
|
|
|
|
_spec.Assign = _node.assignValues
|
|
|
|
_spec.ScanValues = _node.scanValues
|
|
|
|
if err = sqlgraph.UpdateNode(ctx, luo.driver, _spec); err != nil {
|
|
|
|
if _, ok := err.(*sqlgraph.NotFoundError); ok {
|
|
|
|
err = &NotFoundError{logentry.Label}
|
|
|
|
} else if sqlgraph.IsConstraintError(err) {
|
2025-02-06 09:31:49 +01:00
|
|
|
err = &ConstraintError{msg: err.Error(), wrap: err}
|
2022-04-08 21:26:25 +02:00
|
|
|
}
|
|
|
|
return nil, err
|
|
|
|
}
|
2025-02-06 09:31:49 +01:00
|
|
|
luo.mutation.done = true
|
2022-04-08 21:26:25 +02:00
|
|
|
return _node, nil
|
|
|
|
}
|