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

Method prepareQuery

ent/share_query.go:379–403  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

377}
378
379func (sq *ShareQuery) prepareQuery(ctx context.Context) error {
380 for _, inter := range sq.inters {
381 if inter == nil {
382 return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
383 }
384 if trv, ok := inter.(Traverser); ok {
385 if err := trv.Traverse(ctx, sq); err != nil {
386 return err
387 }
388 }
389 }
390 for _, f := range sq.ctx.Fields {
391 if !share.ValidColumn(f) {
392 return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
393 }
394 }
395 if sq.path != nil {
396 prev, err := sq.path(ctx)
397 if err != nil {
398 return err
399 }
400 sq.sql = prev
401 }
402 return nil
403}
404
405func (sq *ShareQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Share, error) {
406 var (

Callers 6

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