csv

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2023 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package csv provides the implementations of fit listener's interfaces that can listen to the events emitted by the decoder. The received events then will be converted and written as csv as they arrive.

This package can be helpful for debuging the library to ensure that the data is being decoded correctly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conv

type Conv struct {
	// contains filtered or unexported fields
}

Conv is an implementation for listeners that receive message events and convert them into CSV records.

func NewConverter

func NewConverter(w io.Writer) *Conv

NewConverter is a shorthand for NewConvWithOptions(w, defaultHeaderSize, defaultChannelBufferSize).

func NewConverterWithOptions

func NewConverterWithOptions(w io.Writer, headerSize, channelBufferSize int) *Conv

NewConverterWithOptions creates a new csv converter *Conv with customizable header and buffer sizes. The header size is estimated since we write it as events arrive, and precision isn't required. The channel buffer size is used to pool incoming events, as we can't predict the event rate or processing speed, ensuring the broadcaster is not blocked.

The caller must call CloseAndWait() after the broadcasting of events is complete to ensure all buffered events are processed.

func (*Conv) Err

func (c *Conv) Err() error

Err returns any error that occur during processing events.

func (*Conv) OnMesg

func (c *Conv) OnMesg(mesg proto.Message)

OnMesgDef receive message from broadcaster

func (*Conv) OnMesgDef

func (c *Conv) OnMesgDef(mesgDef proto.MessageDefinition)

OnMesgDef receive message definition from broadcaster

func (*Conv) Wait

func (c *Conv) Wait()

Wait closes the buffered channel and wait until all event handling is completed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL