MCPcopy Create free account
hub / github.com/crowdsecurity/crowdsec / defaults

Method defaults

pkg/database/ent/machine_create.go:274–295  ·  view source on GitHub ↗

defaults sets the default values of the builder before save.

()

Source from the content-addressed store, hash-verified

272
273// defaults sets the default values of the builder before save.
274func (_c *MachineCreate) defaults() {
275 if _, ok := _c.mutation.CreatedAt(); !ok {
276 v := machine.DefaultCreatedAt()
277 _c.mutation.SetCreatedAt(v)
278 }
279 if _, ok := _c.mutation.UpdatedAt(); !ok {
280 v := machine.DefaultUpdatedAt()
281 _c.mutation.SetUpdatedAt(v)
282 }
283 if _, ok := _c.mutation.LastPush(); !ok {
284 v := machine.DefaultLastPush()
285 _c.mutation.SetLastPush(v)
286 }
287 if _, ok := _c.mutation.IsValidated(); !ok {
288 v := machine.DefaultIsValidated
289 _c.mutation.SetIsValidated(v)
290 }
291 if _, ok := _c.mutation.AuthType(); !ok {
292 v := machine.DefaultAuthType
293 _c.mutation.SetAuthType(v)
294 }
295}
296
297// check runs all checks and user-defined validators on the builder.
298func (_c *MachineCreate) check() error {

Callers 2

SaveMethod · 0.95
SaveMethod · 0.45

Calls 10

LastPushMethod · 0.80
IsValidatedMethod · 0.80
CreatedAtMethod · 0.45
SetCreatedAtMethod · 0.45
UpdatedAtMethod · 0.45
SetUpdatedAtMethod · 0.45
SetLastPushMethod · 0.45
SetIsValidatedMethod · 0.45
AuthTypeMethod · 0.45
SetAuthTypeMethod · 0.45

Tested by

no test coverage detected