logq

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AttributeFile  = "_file"
	AttributeLine  = "_line"
	AttributeLevel = "_level"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregationFunc

type AggregationFunc = genq.AggregationFunc[Record]

type Filter

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

func NewFilter

func NewFilter(fn FilterFunc, source Source) Filter

func (Filter) And

func (f Filter) And(operands ...genq.FilterFunc[Record]) Filter

func (Filter) Attr

func (f Filter) Attr(key string, value any) Filter

func (Filter) Group

func (f Filter) Group(fn GroupFunc) Group[string]

func (Filter) Message

func (f Filter) Message(msg string) Filter

func (Filter) Or

func (f Filter) Or(operands ...genq.FilterFunc[Record]) Filter

func (Filter) Records

func (f Filter) Records() Records

func (Filter) Resolve

func (f Filter) Resolve() []Record

func (Filter) Where

func (f Filter) Where(operands ...genq.FilterFunc[Record]) Filter

type FilterFunc

type FilterFunc = genq.FilterFunc[Record]

func And

func And(operands ...FilterFunc) FilterFunc

func Attr

func Attr(key string, value any) FilterFunc

func False

func False() FilterFunc

func Message

func Message(message string) FilterFunc

func Not

func Not(fn FilterFunc) FilterFunc

func Or

func Or(operands ...FilterFunc) FilterFunc

func True

func True() FilterFunc

type Group

type Group[K comparable] struct {
	// contains filtered or unexported fields
}

func NewGroup

func NewGroup[K comparable](fn genq.GroupFunc[K, Record], sources ...Source) Group[K]

func (Group[K]) Aggregate

func (a Group[K]) Aggregate(fn AggregationFunc) map[K]Record

func (Group[K]) AggregateFlat

func (a Group[K]) AggregateFlat(fn AggregationFunc) Records

func (Group[K]) Count

func (a Group[K]) Count() map[K]int

type GroupFunc

type GroupFunc = genq.GroupFunc[string, Record]

func ByAttr

func ByAttr(name string) GroupFunc

func ByMessage

func ByMessage() GroupFunc

type Record

type Record struct {
	Time       time.Time
	Message    string
	Attributes map[string]any
}

type Records

type Records []Record

func (Records) First

func (r Records) First() *Record

func (Records) Group

func (r Records) Group(fn GroupFunc) Group[string]

func (Records) Last

func (r Records) Last() *Record

func (Records) Resolve

func (r Records) Resolve() []Record

func (Records) Where

func (r Records) Where(operands ...FilterFunc) Filter

type Sink

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

Sink is a shared store of records.

func NewSink

func NewSink(parent *Sink, filter FilterFunc) *Sink

func (*Sink) Add

func (s *Sink) Add(r Record)

func (*Sink) Records

func (s *Sink) Records() Records

func (*Sink) Subscribe

func (s *Sink) Subscribe(sub Subscriber) func()

type Source

type Source = genq.Source[Record]

type Subscriber

type Subscriber func(record Record)

Jump to

Keyboard shortcuts

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