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

Method check

ent/node_update.go:265–277  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

263
264// check runs all checks and user-defined validators on the builder.
265func (nu *NodeUpdate) check() error {
266 if v, ok := nu.mutation.Status(); ok {
267 if err := node.StatusValidator(v); err != nil {
268 return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Node.status": %w`, err)}
269 }
270 }
271 if v, ok := nu.mutation.GetType(); ok {
272 if err := node.TypeValidator(v); err != nil {
273 return &ValidationError{Name: "type", err: fmt.Errorf(`ent: validator failed for field "Node.type": %w`, err)}
274 }
275 }
276 return nil
277}
278
279func (nu *NodeUpdate) sqlSave(ctx context.Context) (n int, err error) {
280 if err := nu.check(); err != nil {

Callers 1

sqlSaveMethod · 0.95

Calls 4

StatusValidatorFunction · 0.92
TypeValidatorFunction · 0.92
StatusMethod · 0.65
GetTypeMethod · 0.45

Tested by

no test coverage detected