MCPcopy
hub / github.com/crowdsecurity/crowdsec / prepareQuery

Method prepareQuery

pkg/database/ent/meta_query.go:343–367  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

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

Callers 5

QueryOwnerMethod · 0.95
AllMethod · 0.95
CountMethod · 0.95
ScanMethod · 0.45
ScanMethod · 0.45

Calls 1

ValidColumnFunction · 0.92

Tested by

no test coverage detected