MCPcopy Create free account
hub / github.com/crowdsecurity/crowdsec / sqlAll

Method sqlAll

pkg/database/ent/bouncer_query.go:333–356  ·  view source on GitHub ↗
(ctx context.Context, hooks ...queryHook)

Source from the content-addressed store, hash-verified

331}
332
333func (_q *BouncerQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Bouncer, error) {
334 var (
335 nodes = []*Bouncer{}
336 _spec = _q.querySpec()
337 )
338 _spec.ScanValues = func(columns []string) ([]any, error) {
339 return (*Bouncer).scanValues(nil, columns)
340 }
341 _spec.Assign = func(columns []string, values []any) error {
342 node := &Bouncer{config: _q.config}
343 nodes = append(nodes, node)
344 return node.assignValues(columns, values)
345 }
346 for i := range hooks {
347 hooks[i](ctx, _spec)
348 }
349 if err := sqlgraph.QueryNodes(ctx, _q.driver, _spec); err != nil {
350 return nil, err
351 }
352 if len(nodes) == 0 {
353 return nodes, nil
354 }
355 return nodes, nil
356}
357
358func (_q *BouncerQuery) sqlCount(ctx context.Context) (int, error) {
359 _spec := _q.querySpec()

Callers

nothing calls this directly

Calls 3

querySpecMethod · 0.95
assignValuesMethod · 0.95
scanValuesMethod · 0.45

Tested by

no test coverage detected