MCPcopy
hub / github.com/crowdsecurity/crowdsec / defaults

Method defaults

pkg/database/ent/alert_create.go:469–502  ·  view source on GitHub ↗

defaults sets the default values of the builder before save.

()

Source from the content-addressed store, hash-verified

467
468// defaults sets the default values of the builder before save.
469func (_c *AlertCreate) defaults() {
470 if _, ok := _c.mutation.CreatedAt(); !ok {
471 v := alert.DefaultCreatedAt()
472 _c.mutation.SetCreatedAt(v)
473 }
474 if _, ok := _c.mutation.UpdatedAt(); !ok {
475 v := alert.DefaultUpdatedAt()
476 _c.mutation.SetUpdatedAt(v)
477 }
478 if _, ok := _c.mutation.BucketId(); !ok {
479 v := alert.DefaultBucketId
480 _c.mutation.SetBucketId(v)
481 }
482 if _, ok := _c.mutation.Message(); !ok {
483 v := alert.DefaultMessage
484 _c.mutation.SetMessage(v)
485 }
486 if _, ok := _c.mutation.EventsCount(); !ok {
487 v := alert.DefaultEventsCount
488 _c.mutation.SetEventsCount(v)
489 }
490 if _, ok := _c.mutation.StartedAt(); !ok {
491 v := alert.DefaultStartedAt()
492 _c.mutation.SetStartedAt(v)
493 }
494 if _, ok := _c.mutation.StoppedAt(); !ok {
495 v := alert.DefaultStoppedAt()
496 _c.mutation.SetStoppedAt(v)
497 }
498 if _, ok := _c.mutation.Simulated(); !ok {
499 v := alert.DefaultSimulated
500 _c.mutation.SetSimulated(v)
501 }
502}
503
504// check runs all checks and user-defined validators on the builder.
505func (_c *AlertCreate) check() error {

Callers 2

SaveMethod · 0.95
SaveMethod · 0.45

Calls 15

BucketIdMethod · 0.80
MessageMethod · 0.80
EventsCountMethod · 0.80
StartedAtMethod · 0.80
StoppedAtMethod · 0.80
CreatedAtMethod · 0.45
SetCreatedAtMethod · 0.45
UpdatedAtMethod · 0.45
SetUpdatedAtMethod · 0.45
SetBucketIdMethod · 0.45
SetMessageMethod · 0.45
SetEventsCountMethod · 0.45

Tested by

no test coverage detected