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

Method prepareQuery

ent/task_query.go:342–366  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

340}
341
342func (tq *TaskQuery) prepareQuery(ctx context.Context) error {
343 for _, inter := range tq.inters {
344 if inter == nil {
345 return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
346 }
347 if trv, ok := inter.(Traverser); ok {
348 if err := trv.Traverse(ctx, tq); err != nil {
349 return err
350 }
351 }
352 }
353 for _, f := range tq.ctx.Fields {
354 if !task.ValidColumn(f) {
355 return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
356 }
357 }
358 if tq.path != nil {
359 prev, err := tq.path(ctx)
360 if err != nil {
361 return err
362 }
363 tq.sql = prev
364 }
365 return nil
366}
367
368func (tq *TaskQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Task, error) {
369 var (

Callers 5

QueryUserMethod · 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