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

Method check

pkg/database/ent/allowlistitem_create.go:219–230  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

217
218// check runs all checks and user-defined validators on the builder.
219func (_c *AllowListItemCreate) check() error {
220 if _, ok := _c.mutation.CreatedAt(); !ok {
221 return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "AllowListItem.created_at"`)}
222 }
223 if _, ok := _c.mutation.UpdatedAt(); !ok {
224 return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "AllowListItem.updated_at"`)}
225 }
226 if _, ok := _c.mutation.Value(); !ok {
227 return &ValidationError{Name: "value", err: errors.New(`ent: missing required field "AllowListItem.value"`)}
228 }
229 return nil
230}
231
232func (_c *AllowListItemCreate) sqlSave(ctx context.Context) (*AllowListItem, error) {
233 if err := _c.check(); err != nil {

Callers 2

sqlSaveMethod · 0.95
SaveMethod · 0.45

Calls 3

CreatedAtMethod · 0.45
UpdatedAtMethod · 0.45
ValueMethod · 0.45

Tested by

no test coverage detected