github.com/weedge/lib@v0.0.0-20230424045628-a36dcc1d90e4/asyncbuffer/async.go (about)

     1  package asyncbuffer
     2  
     3  import (
     4  	"github.com/weedge/lib/log"
     5  )
     6  
     7  func SendOneCh(bufferName, chName string, data IBuffer) (err error) {
     8  	err, sd := GetInstance(bufferName)
     9  	if err != nil {
    10  		log.Errorf("buffer.GetInstance: %s fail~!", bufferName)
    11  		return
    12  	}
    13  
    14  	err = sd.AddBufferItem(&InputBufferItem{
    15  		ChName: chName,
    16  		Data:   data,
    17  	})
    18  	if err != nil {
    19  		log.Errorf("sd.AddBufferItem: %s fail~!", bufferName)
    20  		return
    21  	}
    22  
    23  	log.Debugf("GetInstance: %s instance.ISendObj: %v change", bufferName, sd.ISendObj)
    24  
    25  	return
    26  }