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

Method check

pkg/database/ent/alert_create.go:505–519  ·  view source on GitHub ↗

check runs all checks and user-defined validators on the builder.

()

Source from the content-addressed store, hash-verified

503
504// check runs all checks and user-defined validators on the builder.
505func (_c *AlertCreate) check() error {
506 if _, ok := _c.mutation.CreatedAt(); !ok {
507 return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Alert.created_at"`)}
508 }
509 if _, ok := _c.mutation.UpdatedAt(); !ok {
510 return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Alert.updated_at"`)}
511 }
512 if _, ok := _c.mutation.Scenario(); !ok {
513 return &ValidationError{Name: "scenario", err: errors.New(`ent: missing required field "Alert.scenario"`)}
514 }
515 if _, ok := _c.mutation.Simulated(); !ok {
516 return &ValidationError{Name: "simulated", err: errors.New(`ent: missing required field "Alert.simulated"`)}
517 }
518 return nil
519}
520
521func (_c *AlertCreate) sqlSave(ctx context.Context) (*Alert, error) {
522 if err := _c.check(); err != nil {

Callers 2

sqlSaveMethod · 0.95
SaveMethod · 0.45

Calls 4

CreatedAtMethod · 0.45
UpdatedAtMethod · 0.45
ScenarioMethod · 0.45
SimulatedMethod · 0.45

Tested by

no test coverage detected