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

Method prepareQuery

ent/entity_query.go:415–439  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

413}
414
415func (eq *EntityQuery) prepareQuery(ctx context.Context) error {
416 for _, inter := range eq.inters {
417 if inter == nil {
418 return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
419 }
420 if trv, ok := inter.(Traverser); ok {
421 if err := trv.Traverse(ctx, eq); err != nil {
422 return err
423 }
424 }
425 }
426 for _, f := range eq.ctx.Fields {
427 if !entity.ValidColumn(f) {
428 return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
429 }
430 }
431 if eq.path != nil {
432 prev, err := eq.path(ctx)
433 if err != nil {
434 return err
435 }
436 eq.sql = prev
437 }
438 return nil
439}
440
441func (eq *EntityQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Entity, error) {
442 var (

Callers 8

QueryFileMethod · 0.95
QueryUserMethod · 0.95
QueryStoragePolicyMethod · 0.95
AllMethod · 0.95
CountMethod · 0.95
loadFileMethod · 0.45
ScanMethod · 0.45
ScanMethod · 0.45

Calls 2

ValidColumnFunction · 0.92
TraverseMethod · 0.45

Tested by

no test coverage detected