check runs all checks and user-defined validators on the builder.
()
| 143 | |
| 144 | // check runs all checks and user-defined validators on the builder. |
| 145 | func (_c *EventCreate) check() error { |
| 146 | if _, ok := _c.mutation.CreatedAt(); !ok { |
| 147 | return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Event.created_at"`)} |
| 148 | } |
| 149 | if _, ok := _c.mutation.UpdatedAt(); !ok { |
| 150 | return &ValidationError{Name: "updated_at", err: errors.New(`ent: missing required field "Event.updated_at"`)} |
| 151 | } |
| 152 | if _, ok := _c.mutation.Time(); !ok { |
| 153 | return &ValidationError{Name: "time", err: errors.New(`ent: missing required field "Event.time"`)} |
| 154 | } |
| 155 | if _, ok := _c.mutation.Serialized(); !ok { |
| 156 | return &ValidationError{Name: "serialized", err: errors.New(`ent: missing required field "Event.serialized"`)} |
| 157 | } |
| 158 | if v, ok := _c.mutation.Serialized(); ok { |
| 159 | if err := event.SerializedValidator(v); err != nil { |
| 160 | return &ValidationError{Name: "serialized", err: fmt.Errorf(`ent: validator failed for field "Event.serialized": %w`, err)} |
| 161 | } |
| 162 | } |
| 163 | return nil |
| 164 | } |
| 165 | |
| 166 | func (_c *EventCreate) sqlSave(ctx context.Context) (*Event, error) { |
| 167 | if err := _c.check(); err != nil { |