MCPcopy Index your code
hub / github.com/crowdsecurity/crowdsec / prepareQuery

Method prepareQuery

pkg/database/ent/machine_query.go:344–368  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

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

Callers 5

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