Documentation
¶
Index ¶
- Constants
- func DebugSortMapByTime[T Event](data map[string]T, order int) ([]string, int)
- func LogInint(file *os.File) zerolog.Logger
- type Event
- type EventLine
- func (p *EventLine[T]) AlphabeticalOrdered() *EventLine[T]
- func (p *EventLine[T]) Close()
- func (p *EventLine[T]) Refresh(alrmCount int, eventCount int, dataString []string, position int, ...)
- func (p *EventLine[T]) Send(data Events[T])
- func (p *EventLine[T]) Start(cancel func(), ctx context.Context)
- func (p *EventLine[T]) Stop()
- func (p *EventLine[T]) TimedOrdered(order int) *EventLine[T]
- func (p *EventLine[T]) WithLogFile(fileName string) *EventLine[T]
- type Events
Constants ¶
const ( Aphabetical = iota Time )
const ( Desc = iota Asc )
Variables ¶
This section is empty.
Functions ¶
func DebugSortMapByTime ¶
DebugSortMapByTime sorts the provided map of events by timestamp in ascending or descending order, based on the order parameter. It returns a slice of formatted event presentations and the index of the last updated event, if applicable.
Types ¶
type Event ¶
Event represents an interface for an event with methods for presentation and timestamp retrieval. GetEventPresentation provides a formatted string representation of the event. GetTimeStamp retrieves the timestamp associated with the event.
type EventLine ¶
type EventLine[T Event] struct { // contains filtered or unexported fields }
EventLine represents a processing pipeline for rendering events with various styles and configurations.
func NewPresenter ¶
NewPresenter initializes and returns a new instance of EventLine with a title and configured tcell screen for display.
func (*EventLine[T]) AlphabeticalOrdered ¶
AlphabeticalOrdered sets the sorting style of the EventLine to alphabetical order and returns the updated instance.
func (*EventLine[T]) Close ¶
func (p *EventLine[T]) Close()
Close releases resources associated with the screen and log file, ensuring proper cleanup and termination.
func (*EventLine[T]) Refresh ¶
func (p *EventLine[T]) Refresh(alrmCount int, eventCount int, dataString []string, position int, userPosition int, lastUpdateIndex int)
Refresh clears the screen, updates the title, and renders event data at specified positions with highlighting.
func (*EventLine[T]) Send ¶
Send publishes the given event data through the EventLine's internal channel for further processing and display.
func (*EventLine[T]) Start ¶
Start initializes the EventLine's main loop, handling data processing, screen updates, and context cancellation.
func (*EventLine[T]) Stop ¶
func (p *EventLine[T]) Stop()
Stop terminates the EventLine instance by performing cleanup operations and releasing associated resources.
func (*EventLine[T]) TimedOrdered ¶
TimedOrdered configures the EventLine to sort events based on their timestamp and the specified order.
func (*EventLine[T]) WithLogFile ¶
WithLogFile associates a log file with the EventLine instance for logging operations and initializes the logger.
type Events ¶
Events represents a collection of event data supporting generics for flexible use with various event types. GlobalEvents tracks the total number of events. LastUpdate holds the identifier of the most recent update. EventsMap maps string keys to events of type T, providing efficient access to event data.
func DeepCopy ¶
DeepCopy creates a deep copy of the provided Events[T] instance, ensuring all contained data is duplicated.
func NewEventHandler ¶
NewEventHandler initializes and returns a new Events instance with the provided global event count, event map, and last update ID.
func (Events[T]) GetEventsListSize ¶
GetEventsListSize returns the number of events currently stored in the EventsMap.
func (Events[T]) GetEventsMap ¶
GetEventsMap returns a shallow copy of the EventsMap, ensuring the original map remains unaffected by modifications.
func (Events[T]) GetGlobalEventsNumber ¶
GetGlobalEventsNumber returns the total number of global events stored in the Events collection.
func (Events[T]) GetLastUpdateID ¶
GetLastUpdateID retrieves the identifier of the most recent update from the Events collection.