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

Method check

pkg/database/ent/decision_create.go:279–305  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

277
278// check runs all checks and user-defined validators on the builder.
279func (_c *DecisionCreate) check() error {
280 if _, ok := _c.mutation.CreatedAt(); !ok {
281 return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Decision.created_at"`)}
282 }
283 if _, ok := _c.mutation.UpdatedAt(); !ok {
284 return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Decision.updated_at"`)}
285 }
286 if _, ok := _c.mutation.Scenario(); !ok {
287 return &ValidationError{Name: "scenario", err: errors.New(`ent: missing required field "Decision.scenario"`)}
288 }
289 if _, ok := _c.mutation.GetType(); !ok {
290 return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "Decision.type"`)}
291 }
292 if _, ok := _c.mutation.Scope(); !ok {
293 return &ValidationError{Name: "scope", err: errors.New(`ent: missing required field "Decision.scope"`)}
294 }
295 if _, ok := _c.mutation.Value(); !ok {
296 return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "Decision.value"`)}
297 }
298 if _, ok := _c.mutation.Origin(); !ok {
299 return &ValidationError{Name: "origin", err: errors.New(`ent: missing required field "Decision.origin"`)}
300 }
301 if _, ok := _c.mutation.Simulated(); !ok {
302 return &ValidationError{Name: "simulated", err: errors.New(`ent: missing required field "Decision.simulated"`)}
303 }
304 return nil
305}
306
307func (_c *DecisionCreate) sqlSave(ctx context.Context) (*Decision, error) {
308 if err := _c.check(); err != nil {

Callers 2

sqlSaveMethod · 0.95
SaveMethod · 0.45

Calls 8

ScopeMethod · 0.80
OriginMethod · 0.80
CreatedAtMethod · 0.45
UpdatedAtMethod · 0.45
ScenarioMethod · 0.45
GetTypeMethod · 0.45
ValueMethod · 0.45
SimulatedMethod · 0.45

Tested by

no test coverage detected