github.com/TrueBlocks/trueblocks-core/src/apps/chifra@v0.0.0-20241022031540-b362680128f7/internal/slurp/handle_count.go (about) 1 package slurpPkg 2 3 import ( 4 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/output" 5 "github.com/TrueBlocks/trueblocks-core/src/apps/chifra/pkg/types" 6 ) 7 8 func (opts *SlurpOptions) HandleCount(rCtx *output.RenderCtx) error { 9 provider, err := opts.Provider() 10 if err != nil { 11 return err 12 } 13 provider.SetPrintProgress(opts.Globals.ShowProgressNotTesting()) 14 15 fetchData := func(modelChan chan types.Modeler, errorChan chan error) { 16 monitorChan := provider.Count(rCtx.Ctx, opts.Query(), errorChan) 17 for monitor := range monitorChan { 18 modelChan <- &monitor 19 } 20 } 21 22 return output.StreamMany(rCtx, fetchData, opts.Globals.OutputOpts()) 23 } 24 25 // const maxTestingBlock = 17000000