serie

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Lt = -1
	Eq = 0
	Gt = 1
)

Variables

View Source
var (
	ErrOutOfRange                      = errors.New("out of range")
	ErrCantFlattenSliceWithSet         = errors.New("can't flatten slice with set")
	ErrGrowSizeMustBeStriclyPositive   = errors.New("grow: size must be > 0")
	ErrShrinkSizeMustBeStriclyPositive = errors.New("shrink: size must be > 0")
	ErrShrinkSizeMustBeLesserThanLen   = errors.New("shrink: size must be < len")
	ErrConcatTypeMismatch              = errors.New("concat: type mismatch")
)

Errors in mutate.go

Functions

This section is empty.

Types

type Interfacer

type Interfacer interface {
	Interface() interface{}
}

Interfacer to convert a value of serie to interface{} Used with serie.Get(at) serie.All()

type Iterator added in v0.3.0

type Iterator interface {
	Next() bool
	Current() interface{}
	Reset()
}

Iterator defines an iterator https://docs.microsoft.com/en-us/dotnet/api/system.collections.ienumerator.reset?view=netcore-3.1

type NullBool

type NullBool struct {
	Bool  bool
	Valid bool
}

func (NullBool) Interface

func (b NullBool) Interface() interface{}

type NullFloat32

type NullFloat32 struct {
	Float32 float32
	Valid   bool
}

func (NullFloat32) Interface

func (f NullFloat32) Interface() interface{}

type NullFloat64

type NullFloat64 struct {
	Float64 float64
	Valid   bool
}

func (NullFloat64) Interface

func (f NullFloat64) Interface() interface{}

type NullInt

type NullInt struct {
	Int   int
	Valid bool
}

func (NullInt) Interface

func (i NullInt) Interface() interface{}

type NullInt32

type NullInt32 struct {
	Int32 int32
	Valid bool
}

func (NullInt32) Interface

func (i NullInt32) Interface() interface{}

type NullInt64

type NullInt64 struct {
	Int64 int64
	Valid bool
}

func (NullInt64) Interface

func (i NullInt64) Interface() interface{}

type NullString

type NullString struct {
	String string
	Valid  bool
}

func (NullString) Interface

func (s NullString) Interface() interface{}

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool
}

func (NullTime) Interface

func (t NullTime) Interface() interface{}

type RawValue

type RawValue struct {
	Value interface{}
	Valid bool
}

func (RawValue) Interface

func (r RawValue) Interface() interface{}

func (RawValue) String

func (r RawValue) String() string

type Serie

type Serie interface {
	Type() reflect.Type
	Slice() interface{}     // Underlying slice
	Get(at int) interface{} // T[i]. If T is an interfacer, returns Interfaced value
	All() []interface{}

	// Iterate
	Iterator() Iterator

	// Mutate
	Append(v ...interface{})
	Prepend(v ...interface{}) error
	Insert(at int, v ...interface{}) error
	Set(at int, v interface{}) error
	Delete(at int) error
	Grow(size int) error
	Shrink(size int) error
	Concat(serie ...Serie) error
	Clear()

	// Select
	Head(size int) Serie
	Tail(size int) Serie
	Subset(at, size int) Serie
	Distinct() Serie
	Pick(at ...int) Serie
	Where(predicate func(interface{}) bool) Serie
	NonNils() Serie

	// Copy
	EmptyCopy() Serie
	Copy() Serie

	// Sort
	sort.Interface
	Compare(i, j int) int
	SortAsc()
	SortDesc()

	// Statistics
	Avg(opt ...StatOption) float64
	Count(opt ...StatOption) int64
	CountDistinct(opt ...StatOption) int64
	Cusum(opt ...StatOption) []float64
	Max(opt ...StatOption) float64
	Min(opt ...StatOption) float64
	Median(opt ...StatOption) float64
	Stddev(opt ...StatOption) float64
	Sum(opt ...StatOption) float64
	Variance(opt ...StatOption) float64
}

func AsFloat64 added in v0.3.0

func AsFloat64(s Serie, missing *float64) Serie

AsFloat64 to converts a serie to a serie of float64 Used for some statistics

func Bool

func Bool(v ...interface{}) Serie

func BoolN

func BoolN(v ...interface{}) Serie

func Float32

func Float32(v ...interface{}) Serie

func Float32N

func Float32N(v ...interface{}) Serie

func Float64

func Float64(v ...interface{}) Serie

func Float64N

func Float64N(v ...interface{}) Serie

func Int

func Int(v ...interface{}) Serie

func Int32

func Int32(v ...interface{}) Serie

func Int32N

func Int32N(v ...interface{}) Serie

func Int64

func Int64(v ...interface{}) Serie

func Int64N

func Int64N(v ...interface{}) Serie

func IntN

func IntN(v ...interface{}) Serie

func New

func New(typ interface{}, converter interface{}, comparer interface{}) Serie

func Raw

func Raw(v ...interface{}) Serie

func String

func String(v ...interface{}) Serie

String to create a new string serie

func StringN

func StringN(v ...interface{}) Serie

StringN to create a new serie with null value handling

func Time

func Time(format ...string) Serie

Time to create a time serie

func TimeN

func TimeN(format ...string) Serie

TimeN to create a time serie with nil value

type StatOption added in v0.3.0

type StatOption func(opts *StatOptions)

func Missing added in v0.3.0

func Missing(f float64) StatOption

Missing to treats all missing values (ie no-nils) as a value

type StatOptions added in v0.3.0

type StatOptions struct {
	Missing *float64 // replaces missing values with a value
}

Jump to

Keyboard shortcuts

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