MCPcopy Index your code
hub / github.com/cloudreve/cloudreve / defaults

Method defaults

ent/task_create.go:193–213  ·  view source on GitHub ↗

defaults sets the default values of the builder before save.

()

Source from the content-addressed store, hash-verified

191
192// defaults sets the default values of the builder before save.
193func (tc *TaskCreate) defaults() error {
194 if _, ok := tc.mutation.CreatedAt(); !ok {
195 if task.DefaultCreatedAt == nil {
196 return fmt.Errorf("ent: uninitialized task.DefaultCreatedAt (forgotten import ent/runtime?)")
197 }
198 v := task.DefaultCreatedAt()
199 tc.mutation.SetCreatedAt(v)
200 }
201 if _, ok := tc.mutation.UpdatedAt(); !ok {
202 if task.DefaultUpdatedAt == nil {
203 return fmt.Errorf("ent: uninitialized task.DefaultUpdatedAt (forgotten import ent/runtime?)")
204 }
205 v := task.DefaultUpdatedAt()
206 tc.mutation.SetUpdatedAt(v)
207 }
208 if _, ok := tc.mutation.Status(); !ok {
209 v := task.DefaultStatus
210 tc.mutation.SetStatus(v)
211 }
212 return nil
213}
214
215// check runs all checks and user-defined validators on the builder.
216func (tc *TaskCreate) check() error {

Callers 2

SaveMethod · 0.95
SaveMethod · 0.45

Calls 6

CreatedAtMethod · 0.65
UpdatedAtMethod · 0.65
StatusMethod · 0.65
SetStatusMethod · 0.65
SetCreatedAtMethod · 0.45
SetUpdatedAtMethod · 0.45

Tested by

no test coverage detected