MCPcopy Index your code
hub / github.com/cloudreve/cloudreve / prepareQuery

Method prepareQuery

ent/storagepolicy_query.go:451–475  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

449}
450
451func (spq *StoragePolicyQuery) prepareQuery(ctx context.Context) error {
452 for _, inter := range spq.inters {
453 if inter == nil {
454 return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
455 }
456 if trv, ok := inter.(Traverser); ok {
457 if err := trv.Traverse(ctx, spq); err != nil {
458 return err
459 }
460 }
461 }
462 for _, f := range spq.ctx.Fields {
463 if !storagepolicy.ValidColumn(f) {
464 return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
465 }
466 }
467 if spq.path != nil {
468 prev, err := spq.path(ctx)
469 if err != nil {
470 return err
471 }
472 spq.sql = prev
473 }
474 return nil
475}
476
477func (spq *StoragePolicyQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*StoragePolicy, error) {
478 var (

Callers 8

QueryGroupsMethod · 0.95
QueryFilesMethod · 0.95
QueryEntitiesMethod · 0.95
QueryNodeMethod · 0.95
AllMethod · 0.95
CountMethod · 0.95
ScanMethod · 0.45
ScanMethod · 0.45

Calls 2

ValidColumnFunction · 0.92
TraverseMethod · 0.45

Tested by

no test coverage detected