MCPcopy Create free account
hub / github.com/efectn/go-orm-benchmarks / prepareQuery

Method prepareQuery

bench/ent/model_query.go:306–330  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

304}
305
306func (mq *ModelQuery) prepareQuery(ctx context.Context) error {
307 for _, inter := range mq.inters {
308 if inter == nil {
309 return fmt.Errorf("ent: uninitialized interceptor (forgotten import ent/runtime?)")
310 }
311 if trv, ok := inter.(Traverser); ok {
312 if err := trv.Traverse(ctx, mq); err != nil {
313 return err
314 }
315 }
316 }
317 for _, f := range mq.ctx.Fields {
318 if !model.ValidColumn(f) {
319 return &ValidationError{Name: f, err: fmt.Errorf("ent: invalid field %q for query", f)}
320 }
321 }
322 if mq.path != nil {
323 prev, err := mq.path(ctx)
324 if err != nil {
325 return err
326 }
327 mq.sql = prev
328 }
329 return nil
330}
331
332func (mq *ModelQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Model, error) {
333 var (

Callers 4

AllMethod · 0.95
CountMethod · 0.95
ScanMethod · 0.80
ScanMethod · 0.80

Calls 1

ValidColumnFunction · 0.92

Tested by

no test coverage detected