github.com/voedger/voedger@v0.0.0-20240520144910-273e84102129/pkg/processors/query/operator-send-to-bus-impl.go (about) 1 /* 2 * Copyright (c) 2021-present unTill Pro, Ltd. 3 */ 4 5 package queryprocessor 6 7 import ( 8 "context" 9 "time" 10 11 "github.com/voedger/voedger/pkg/pipeline" 12 ) 13 14 type SendToBusOperator struct { 15 pipeline.AsyncNOOP 16 rs IResultSenderClosable 17 initialized bool 18 metrics IMetrics 19 } 20 21 func (o *SendToBusOperator) DoAsync(_ context.Context, work pipeline.IWorkpiece) (outWork pipeline.IWorkpiece, err error) { 22 begin := time.Now() 23 defer func() { 24 o.metrics.Increase(execSendSeconds, time.Since(begin).Seconds()) 25 }() 26 if !o.initialized { 27 //TODO what to set into sectionType, path? 28 o.rs.StartArraySection("", nil) 29 o.initialized = true 30 } 31 return work, o.rs.SendElement("", work.(rowsWorkpiece).OutputRow().Values()) 32 } 33 34 func (o *SendToBusOperator) OnError(_ context.Context, err error) { 35 o.rs.Close(err) 36 }