dagg

package
v0.0.6-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package dagg provides a simple interface for aggregating data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agg

type Agg[T any] struct {
	// contains filtered or unexported fields
}

Agg is an aggregation struct with methods to perform aggregations.

func (*Agg[T]) Add

func (o *Agg[T]) Add(value T) error

Add adds a value to be processed and aggregated.

func (*Agg[T]) Each

func (o *Agg[T]) Each(fn func(Row) error) error

Each passes the produced aggregation row by calling fn

func (*Agg[T]) GroupBy

func (o *Agg[T]) GroupBy(fn GroupFn[T])

GroupBy sets the group function for the aggregation.

func (*Agg[T]) Reduce

func (o *Agg[T]) Reduce(name string, reduceFunc func(any, T) any, finalFunc func(any) any)

Reduce adds a reduce function for the aggregation.

func (*Agg[T]) Result

func (o *Agg[T]) Result() ([]Row, error)

type Field

type Field = drow.Field

Field is a drow.Field

type GroupFn

type GroupFn[T any] func(T) (any, error)

GroupFn type of function that will produce they key for the data to be grouped.

type OptFn

type OptFn[T any] func(*Agg[T])

OptFn type of the option function for aggBuilder

type Row

type Row = drow.Row

Row is a drow.Row

Jump to

Keyboard shortcuts

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