MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / check

Method check

ent/task_create.go:216–238  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

214
215// check runs all checks and user-defined validators on the builder.
216func (tc *TaskCreate) check() error {
217 if _, ok := tc.mutation.CreatedAt(); !ok {
218 return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Task.created_at"`)}
219 }
220 if _, ok := tc.mutation.UpdatedAt(); !ok {
221 return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Task.updated_at"`)}
222 }
223 if _, ok := tc.mutation.GetType(); !ok {
224 return &ValidationError{Name: "type", err: errors.New(`ent: missing required field "Task.type"`)}
225 }
226 if _, ok := tc.mutation.Status(); !ok {
227 return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Task.status"`)}
228 }
229 if v, ok := tc.mutation.Status(); ok {
230 if err := task.StatusValidator(v); err != nil {
231 return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Task.status": %w`, err)}
232 }
233 }
234 if _, ok := tc.mutation.PublicState(); !ok {
235 return &ValidationError{Name: "public_state", err: errors.New(`ent: missing required field "Task.public_state"`)}
236 }
237 return nil
238}
239
240func (tc *TaskCreate) sqlSave(ctx context.Context) (*Task, error) {
241 if err := tc.check(); err != nil {

Callers 2

sqlSaveMethod · 0.95
SaveMethod · 0.45

Calls 7

StatusValidatorFunction · 0.92
PublicStateMethod · 0.80
CreatedAtMethod · 0.65
NewMethod · 0.65
UpdatedAtMethod · 0.65
StatusMethod · 0.65
GetTypeMethod · 0.45

Tested by

no test coverage detected