MCPcopy Create free account
hub / github.com/Comfy-Org/registry-backend / check

Method check

ent/nodeversion_create.go:280–317  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

278
279// check runs all checks and user-defined validators on the builder.
280func (nvc *NodeVersionCreate) check() error {
281 if _, ok := nvc.mutation.CreateTime(); !ok {
282 return &ValidationError{Name: "create_time", err: errors.New(`ent: missing required field "NodeVersion.create_time"`)}
283 }
284 if _, ok := nvc.mutation.UpdateTime(); !ok {
285 return &ValidationError{Name: "update_time", err: errors.New(`ent: missing required field "NodeVersion.update_time"`)}
286 }
287 if _, ok := nvc.mutation.NodeID(); !ok {
288 return &ValidationError{Name: "node_id", err: errors.New(`ent: missing required field "NodeVersion.node_id"`)}
289 }
290 if _, ok := nvc.mutation.Version(); !ok {
291 return &ValidationError{Name: "version", err: errors.New(`ent: missing required field "NodeVersion.version"`)}
292 }
293 if _, ok := nvc.mutation.PipDependencies(); !ok {
294 return &ValidationError{Name: "pip_dependencies", err: errors.New(`ent: missing required field "NodeVersion.pip_dependencies"`)}
295 }
296 if _, ok := nvc.mutation.Deprecated(); !ok {
297 return &ValidationError{Name: "deprecated", err: errors.New(`ent: missing required field "NodeVersion.deprecated"`)}
298 }
299 if _, ok := nvc.mutation.Status(); !ok {
300 return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "NodeVersion.status"`)}
301 }
302 if v, ok := nvc.mutation.Status(); ok {
303 if err := nodeversion.StatusValidator(v); err != nil {
304 return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "NodeVersion.status": %w`, err)}
305 }
306 }
307 if _, ok := nvc.mutation.StatusReason(); !ok {
308 return &ValidationError{Name: "status_reason", err: errors.New(`ent: missing required field "NodeVersion.status_reason"`)}
309 }
310 if _, ok := nvc.mutation.ComfyNodeExtractStatus(); !ok {
311 return &ValidationError{Name: "comfy_node_extract_status", err: errors.New(`ent: missing required field "NodeVersion.comfy_node_extract_status"`)}
312 }
313 if len(nvc.mutation.NodeIDs()) == 0 {
314 return &ValidationError{Name: "node", err: errors.New(`ent: missing required edge "NodeVersion.node"`)}
315 }
316 return nil
317}
318
319func (nvc *NodeVersionCreate) sqlSave(ctx context.Context) (*NodeVersion, error) {
320 if err := nvc.check(); err != nil {

Callers 2

sqlSaveMethod · 0.95
SaveMethod · 0.45

Calls 11

StatusValidatorFunction · 0.92
VersionMethod · 0.80
PipDependenciesMethod · 0.80
StatusReasonMethod · 0.80
CreateTimeMethod · 0.45
UpdateTimeMethod · 0.45
NodeIDMethod · 0.45
DeprecatedMethod · 0.45
StatusMethod · 0.45
NodeIDsMethod · 0.45

Tested by

no test coverage detected