check runs all checks and user-defined validators on the builder.
()
| 214 | |
| 215 | // check runs all checks and user-defined validators on the builder. |
| 216 | func (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 | |
| 240 | func (tc *TaskCreate) sqlSave(ctx context.Context) (*Task, error) { |
| 241 | if err := tc.check(); err != nil { |
no test coverage detected