/
telegramchatrecapsoptions_update.go
504 lines (448 loc) · 18.8 KB
/
telegramchatrecapsoptions_update.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
// Code generated by ent, DO NOT EDIT.
package ent
import (
"context"
"errors"
"fmt"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
"github.com/nekomeowww/insights-bot/ent/internal"
"github.com/nekomeowww/insights-bot/ent/predicate"
"github.com/nekomeowww/insights-bot/ent/telegramchatrecapsoptions"
)
// TelegramChatRecapsOptionsUpdate is the builder for updating TelegramChatRecapsOptions entities.
type TelegramChatRecapsOptionsUpdate struct {
config
hooks []Hook
mutation *TelegramChatRecapsOptionsMutation
}
// Where appends a list predicates to the TelegramChatRecapsOptionsUpdate builder.
func (tcrou *TelegramChatRecapsOptionsUpdate) Where(ps ...predicate.TelegramChatRecapsOptions) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.Where(ps...)
return tcrou
}
// SetChatID sets the "chat_id" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetChatID(i int64) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.ResetChatID()
tcrou.mutation.SetChatID(i)
return tcrou
}
// SetNillableChatID sets the "chat_id" field if the given value is not nil.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetNillableChatID(i *int64) *TelegramChatRecapsOptionsUpdate {
if i != nil {
tcrou.SetChatID(*i)
}
return tcrou
}
// AddChatID adds i to the "chat_id" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) AddChatID(i int64) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.AddChatID(i)
return tcrou
}
// SetAutoRecapSendMode sets the "auto_recap_send_mode" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetAutoRecapSendMode(i int) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.ResetAutoRecapSendMode()
tcrou.mutation.SetAutoRecapSendMode(i)
return tcrou
}
// SetNillableAutoRecapSendMode sets the "auto_recap_send_mode" field if the given value is not nil.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetNillableAutoRecapSendMode(i *int) *TelegramChatRecapsOptionsUpdate {
if i != nil {
tcrou.SetAutoRecapSendMode(*i)
}
return tcrou
}
// AddAutoRecapSendMode adds i to the "auto_recap_send_mode" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) AddAutoRecapSendMode(i int) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.AddAutoRecapSendMode(i)
return tcrou
}
// SetManualRecapRatePerSeconds sets the "manual_recap_rate_per_seconds" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetManualRecapRatePerSeconds(i int64) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.ResetManualRecapRatePerSeconds()
tcrou.mutation.SetManualRecapRatePerSeconds(i)
return tcrou
}
// SetNillableManualRecapRatePerSeconds sets the "manual_recap_rate_per_seconds" field if the given value is not nil.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetNillableManualRecapRatePerSeconds(i *int64) *TelegramChatRecapsOptionsUpdate {
if i != nil {
tcrou.SetManualRecapRatePerSeconds(*i)
}
return tcrou
}
// AddManualRecapRatePerSeconds adds i to the "manual_recap_rate_per_seconds" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) AddManualRecapRatePerSeconds(i int64) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.AddManualRecapRatePerSeconds(i)
return tcrou
}
// SetAutoRecapRatesPerDay sets the "auto_recap_rates_per_day" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetAutoRecapRatesPerDay(i int) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.ResetAutoRecapRatesPerDay()
tcrou.mutation.SetAutoRecapRatesPerDay(i)
return tcrou
}
// SetNillableAutoRecapRatesPerDay sets the "auto_recap_rates_per_day" field if the given value is not nil.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetNillableAutoRecapRatesPerDay(i *int) *TelegramChatRecapsOptionsUpdate {
if i != nil {
tcrou.SetAutoRecapRatesPerDay(*i)
}
return tcrou
}
// AddAutoRecapRatesPerDay adds i to the "auto_recap_rates_per_day" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) AddAutoRecapRatesPerDay(i int) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.AddAutoRecapRatesPerDay(i)
return tcrou
}
// SetCreatedAt sets the "created_at" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetCreatedAt(i int64) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.ResetCreatedAt()
tcrou.mutation.SetCreatedAt(i)
return tcrou
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetNillableCreatedAt(i *int64) *TelegramChatRecapsOptionsUpdate {
if i != nil {
tcrou.SetCreatedAt(*i)
}
return tcrou
}
// AddCreatedAt adds i to the "created_at" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) AddCreatedAt(i int64) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.AddCreatedAt(i)
return tcrou
}
// SetUpdatedAt sets the "updated_at" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetUpdatedAt(i int64) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.ResetUpdatedAt()
tcrou.mutation.SetUpdatedAt(i)
return tcrou
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (tcrou *TelegramChatRecapsOptionsUpdate) SetNillableUpdatedAt(i *int64) *TelegramChatRecapsOptionsUpdate {
if i != nil {
tcrou.SetUpdatedAt(*i)
}
return tcrou
}
// AddUpdatedAt adds i to the "updated_at" field.
func (tcrou *TelegramChatRecapsOptionsUpdate) AddUpdatedAt(i int64) *TelegramChatRecapsOptionsUpdate {
tcrou.mutation.AddUpdatedAt(i)
return tcrou
}
// Mutation returns the TelegramChatRecapsOptionsMutation object of the builder.
func (tcrou *TelegramChatRecapsOptionsUpdate) Mutation() *TelegramChatRecapsOptionsMutation {
return tcrou.mutation
}
// Save executes the query and returns the number of nodes affected by the update operation.
func (tcrou *TelegramChatRecapsOptionsUpdate) Save(ctx context.Context) (int, error) {
return withHooks(ctx, tcrou.sqlSave, tcrou.mutation, tcrou.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (tcrou *TelegramChatRecapsOptionsUpdate) SaveX(ctx context.Context) int {
affected, err := tcrou.Save(ctx)
if err != nil {
panic(err)
}
return affected
}
// Exec executes the query.
func (tcrou *TelegramChatRecapsOptionsUpdate) Exec(ctx context.Context) error {
_, err := tcrou.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (tcrou *TelegramChatRecapsOptionsUpdate) ExecX(ctx context.Context) {
if err := tcrou.Exec(ctx); err != nil {
panic(err)
}
}
func (tcrou *TelegramChatRecapsOptionsUpdate) sqlSave(ctx context.Context) (n int, err error) {
_spec := sqlgraph.NewUpdateSpec(telegramchatrecapsoptions.Table, telegramchatrecapsoptions.Columns, sqlgraph.NewFieldSpec(telegramchatrecapsoptions.FieldID, field.TypeUUID))
if ps := tcrou.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := tcrou.mutation.ChatID(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldChatID, field.TypeInt64, value)
}
if value, ok := tcrou.mutation.AddedChatID(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldChatID, field.TypeInt64, value)
}
if value, ok := tcrou.mutation.AutoRecapSendMode(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldAutoRecapSendMode, field.TypeInt, value)
}
if value, ok := tcrou.mutation.AddedAutoRecapSendMode(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldAutoRecapSendMode, field.TypeInt, value)
}
if value, ok := tcrou.mutation.ManualRecapRatePerSeconds(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldManualRecapRatePerSeconds, field.TypeInt64, value)
}
if value, ok := tcrou.mutation.AddedManualRecapRatePerSeconds(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldManualRecapRatePerSeconds, field.TypeInt64, value)
}
if value, ok := tcrou.mutation.AutoRecapRatesPerDay(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldAutoRecapRatesPerDay, field.TypeInt, value)
}
if value, ok := tcrou.mutation.AddedAutoRecapRatesPerDay(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldAutoRecapRatesPerDay, field.TypeInt, value)
}
if value, ok := tcrou.mutation.CreatedAt(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldCreatedAt, field.TypeInt64, value)
}
if value, ok := tcrou.mutation.AddedCreatedAt(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldCreatedAt, field.TypeInt64, value)
}
if value, ok := tcrou.mutation.UpdatedAt(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldUpdatedAt, field.TypeInt64, value)
}
if value, ok := tcrou.mutation.AddedUpdatedAt(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldUpdatedAt, field.TypeInt64, value)
}
_spec.Node.Schema = tcrou.schemaConfig.TelegramChatRecapsOptions
ctx = internal.NewSchemaConfigContext(ctx, tcrou.schemaConfig)
if n, err = sqlgraph.UpdateNodes(ctx, tcrou.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{telegramchatrecapsoptions.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return 0, err
}
tcrou.mutation.done = true
return n, nil
}
// TelegramChatRecapsOptionsUpdateOne is the builder for updating a single TelegramChatRecapsOptions entity.
type TelegramChatRecapsOptionsUpdateOne struct {
config
fields []string
hooks []Hook
mutation *TelegramChatRecapsOptionsMutation
}
// SetChatID sets the "chat_id" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetChatID(i int64) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.ResetChatID()
tcrouo.mutation.SetChatID(i)
return tcrouo
}
// SetNillableChatID sets the "chat_id" field if the given value is not nil.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetNillableChatID(i *int64) *TelegramChatRecapsOptionsUpdateOne {
if i != nil {
tcrouo.SetChatID(*i)
}
return tcrouo
}
// AddChatID adds i to the "chat_id" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) AddChatID(i int64) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.AddChatID(i)
return tcrouo
}
// SetAutoRecapSendMode sets the "auto_recap_send_mode" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetAutoRecapSendMode(i int) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.ResetAutoRecapSendMode()
tcrouo.mutation.SetAutoRecapSendMode(i)
return tcrouo
}
// SetNillableAutoRecapSendMode sets the "auto_recap_send_mode" field if the given value is not nil.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetNillableAutoRecapSendMode(i *int) *TelegramChatRecapsOptionsUpdateOne {
if i != nil {
tcrouo.SetAutoRecapSendMode(*i)
}
return tcrouo
}
// AddAutoRecapSendMode adds i to the "auto_recap_send_mode" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) AddAutoRecapSendMode(i int) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.AddAutoRecapSendMode(i)
return tcrouo
}
// SetManualRecapRatePerSeconds sets the "manual_recap_rate_per_seconds" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetManualRecapRatePerSeconds(i int64) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.ResetManualRecapRatePerSeconds()
tcrouo.mutation.SetManualRecapRatePerSeconds(i)
return tcrouo
}
// SetNillableManualRecapRatePerSeconds sets the "manual_recap_rate_per_seconds" field if the given value is not nil.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetNillableManualRecapRatePerSeconds(i *int64) *TelegramChatRecapsOptionsUpdateOne {
if i != nil {
tcrouo.SetManualRecapRatePerSeconds(*i)
}
return tcrouo
}
// AddManualRecapRatePerSeconds adds i to the "manual_recap_rate_per_seconds" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) AddManualRecapRatePerSeconds(i int64) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.AddManualRecapRatePerSeconds(i)
return tcrouo
}
// SetAutoRecapRatesPerDay sets the "auto_recap_rates_per_day" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetAutoRecapRatesPerDay(i int) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.ResetAutoRecapRatesPerDay()
tcrouo.mutation.SetAutoRecapRatesPerDay(i)
return tcrouo
}
// SetNillableAutoRecapRatesPerDay sets the "auto_recap_rates_per_day" field if the given value is not nil.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetNillableAutoRecapRatesPerDay(i *int) *TelegramChatRecapsOptionsUpdateOne {
if i != nil {
tcrouo.SetAutoRecapRatesPerDay(*i)
}
return tcrouo
}
// AddAutoRecapRatesPerDay adds i to the "auto_recap_rates_per_day" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) AddAutoRecapRatesPerDay(i int) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.AddAutoRecapRatesPerDay(i)
return tcrouo
}
// SetCreatedAt sets the "created_at" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetCreatedAt(i int64) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.ResetCreatedAt()
tcrouo.mutation.SetCreatedAt(i)
return tcrouo
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetNillableCreatedAt(i *int64) *TelegramChatRecapsOptionsUpdateOne {
if i != nil {
tcrouo.SetCreatedAt(*i)
}
return tcrouo
}
// AddCreatedAt adds i to the "created_at" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) AddCreatedAt(i int64) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.AddCreatedAt(i)
return tcrouo
}
// SetUpdatedAt sets the "updated_at" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetUpdatedAt(i int64) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.ResetUpdatedAt()
tcrouo.mutation.SetUpdatedAt(i)
return tcrouo
}
// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SetNillableUpdatedAt(i *int64) *TelegramChatRecapsOptionsUpdateOne {
if i != nil {
tcrouo.SetUpdatedAt(*i)
}
return tcrouo
}
// AddUpdatedAt adds i to the "updated_at" field.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) AddUpdatedAt(i int64) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.AddUpdatedAt(i)
return tcrouo
}
// Mutation returns the TelegramChatRecapsOptionsMutation object of the builder.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) Mutation() *TelegramChatRecapsOptionsMutation {
return tcrouo.mutation
}
// Where appends a list predicates to the TelegramChatRecapsOptionsUpdate builder.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) Where(ps ...predicate.TelegramChatRecapsOptions) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.mutation.Where(ps...)
return tcrouo
}
// Select allows selecting one or more fields (columns) of the returned entity.
// The default is selecting all fields defined in the entity schema.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) Select(field string, fields ...string) *TelegramChatRecapsOptionsUpdateOne {
tcrouo.fields = append([]string{field}, fields...)
return tcrouo
}
// Save executes the query and returns the updated TelegramChatRecapsOptions entity.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) Save(ctx context.Context) (*TelegramChatRecapsOptions, error) {
return withHooks(ctx, tcrouo.sqlSave, tcrouo.mutation, tcrouo.hooks)
}
// SaveX is like Save, but panics if an error occurs.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) SaveX(ctx context.Context) *TelegramChatRecapsOptions {
node, err := tcrouo.Save(ctx)
if err != nil {
panic(err)
}
return node
}
// Exec executes the query on the entity.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) Exec(ctx context.Context) error {
_, err := tcrouo.Save(ctx)
return err
}
// ExecX is like Exec, but panics if an error occurs.
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) ExecX(ctx context.Context) {
if err := tcrouo.Exec(ctx); err != nil {
panic(err)
}
}
func (tcrouo *TelegramChatRecapsOptionsUpdateOne) sqlSave(ctx context.Context) (_node *TelegramChatRecapsOptions, err error) {
_spec := sqlgraph.NewUpdateSpec(telegramchatrecapsoptions.Table, telegramchatrecapsoptions.Columns, sqlgraph.NewFieldSpec(telegramchatrecapsoptions.FieldID, field.TypeUUID))
id, ok := tcrouo.mutation.ID()
if !ok {
return nil, &ValidationError{Name: "id", err: errors.New(`ent: missing "TelegramChatRecapsOptions.id" for update`)}
}
_spec.Node.ID.Value = id
if fields := tcrouo.fields; len(fields) > 0 {
_spec.Node.Columns = make([]string, 0, len(fields))
_spec.Node.Columns = append(_spec.Node.Columns, telegramchatrecapsoptions.FieldID)
for _, f := range fields {
if !telegramchatrecapsoptions.ValidColumn(f) {
return nil, &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
}
if f != telegramchatrecapsoptions.FieldID {
_spec.Node.Columns = append(_spec.Node.Columns, f)
}
}
}
if ps := tcrouo.mutation.predicates; len(ps) > 0 {
_spec.Predicate = func(selector *sql.Selector) {
for i := range ps {
ps[i](selector)
}
}
}
if value, ok := tcrouo.mutation.ChatID(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldChatID, field.TypeInt64, value)
}
if value, ok := tcrouo.mutation.AddedChatID(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldChatID, field.TypeInt64, value)
}
if value, ok := tcrouo.mutation.AutoRecapSendMode(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldAutoRecapSendMode, field.TypeInt, value)
}
if value, ok := tcrouo.mutation.AddedAutoRecapSendMode(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldAutoRecapSendMode, field.TypeInt, value)
}
if value, ok := tcrouo.mutation.ManualRecapRatePerSeconds(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldManualRecapRatePerSeconds, field.TypeInt64, value)
}
if value, ok := tcrouo.mutation.AddedManualRecapRatePerSeconds(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldManualRecapRatePerSeconds, field.TypeInt64, value)
}
if value, ok := tcrouo.mutation.AutoRecapRatesPerDay(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldAutoRecapRatesPerDay, field.TypeInt, value)
}
if value, ok := tcrouo.mutation.AddedAutoRecapRatesPerDay(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldAutoRecapRatesPerDay, field.TypeInt, value)
}
if value, ok := tcrouo.mutation.CreatedAt(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldCreatedAt, field.TypeInt64, value)
}
if value, ok := tcrouo.mutation.AddedCreatedAt(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldCreatedAt, field.TypeInt64, value)
}
if value, ok := tcrouo.mutation.UpdatedAt(); ok {
_spec.SetField(telegramchatrecapsoptions.FieldUpdatedAt, field.TypeInt64, value)
}
if value, ok := tcrouo.mutation.AddedUpdatedAt(); ok {
_spec.AddField(telegramchatrecapsoptions.FieldUpdatedAt, field.TypeInt64, value)
}
_spec.Node.Schema = tcrouo.schemaConfig.TelegramChatRecapsOptions
ctx = internal.NewSchemaConfigContext(ctx, tcrouo.schemaConfig)
_node = &TelegramChatRecapsOptions{config: tcrouo.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
if err = sqlgraph.UpdateNode(ctx, tcrouo.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{telegramchatrecapsoptions.Label}
} else if sqlgraph.IsConstraintError(err) {
err = &ConstraintError{msg: err.Error(), wrap: err}
}
return nil, err
}
tcrouo.mutation.done = true
return _node, nil
}