Documentation
¶
Index ¶
- func ToSlice[T comparable](s Set[T]) ([]T, error)
- type AnySeries
- func (s *AnySeries) Append(v any) error
- func (s *AnySeries) AppendNull()
- func (s *AnySeries) At(i int) (any, error)
- func (s *AnySeries) DType() reflect.Type
- func (s *AnySeries) IsNull(i int) bool
- func (s *AnySeries) Len() int
- func (s *AnySeries) MaskCopy() []bool
- func (s *AnySeries) NullCount() int
- func (s *AnySeries) Set(i int, v any) error
- func (s *AnySeries) SetNull(i int) error
- func (s *AnySeries) Slice(start, end int) (Series, error)
- func (s *AnySeries) ValuesCopy() []any
- type BoolSeries
- func (s *BoolSeries) Append(v any) error
- func (s *BoolSeries) AppendNull()
- func (s *BoolSeries) At(i int) (any, error)
- func (s *BoolSeries) DType() reflect.Type
- func (s *BoolSeries) IsNull(i int) bool
- func (s *BoolSeries) Len() int
- func (s *BoolSeries) MaskCopy() []bool
- func (s *BoolSeries) NullCount() int
- func (s *BoolSeries) Set(i int, v any) error
- func (s *BoolSeries) SetNull(i int) error
- func (s *BoolSeries) Slice(start, end int) (Series, error)
- func (s *BoolSeries) ValuesCopy() []any
- type FilterFunc
- type Float64Series
- func (s *Float64Series) Append(v any) error
- func (s *Float64Series) AppendNull()
- func (s *Float64Series) At(i int) (any, error)
- func (s *Float64Series) DType() reflect.Type
- func (s *Float64Series) Float64Value(i int) (float64, error)
- func (s *Float64Series) Float64Values() []float64
- func (s *Float64Series) IsNull(i int) bool
- func (s *Float64Series) Len() int
- func (s *Float64Series) MaskCopy() []bool
- func (s *Float64Series) NullCount() int
- func (s *Float64Series) Set(i int, v any) error
- func (s *Float64Series) SetNull(i int) error
- func (s *Float64Series) Slice(start, end int) (Series, error)
- func (s *Float64Series) ValuesCopy() []any
- type Int64Series
- func (s *Int64Series) Append(v any) error
- func (s *Int64Series) AppendNull()
- func (s *Int64Series) At(i int) (any, error)
- func (s *Int64Series) DType() reflect.Type
- func (s *Int64Series) Int64Value(i int) (int64, error)
- func (s *Int64Series) Int64Values() []int64
- func (s *Int64Series) IsNull(i int) bool
- func (s *Int64Series) Len() int
- func (s *Int64Series) MaskCopy() []bool
- func (s *Int64Series) NullCount() int
- func (s *Int64Series) Set(i int, v any) error
- func (s *Int64Series) SetNull(i int) error
- func (s *Int64Series) Slice(start, end int) (Series, error)
- func (s *Int64Series) ValuesCopy() []any
- type Series
- type Set
- func (s Set[T]) Add(v T) error
- func (s Set[T]) AddMulti(val ...T) error
- func (s Set[T]) Compare(s2 Set[T]) (bool, any)
- func (s Set[T]) Difference(s2 Set[T]) (Set[T], error)
- func (s Set[T]) Filter(P FilterFunc[T]) (Set[T], error)
- func (s Set[T]) Has(v T) bool
- func (s Set[T]) Intersect(s2 Set[T]) (Set[T], error)
- func (s Set[T]) Union(s2 Set[T]) (Set[T], error)
- type StringSeries
- func (s *StringSeries) Append(v any) error
- func (s *StringSeries) AppendNull()
- func (s *StringSeries) At(i int) (any, error)
- func (s *StringSeries) DType() reflect.Type
- func (s *StringSeries) IsNull(i int) bool
- func (s *StringSeries) Len() int
- func (s *StringSeries) MaskCopy() []bool
- func (s *StringSeries) NullCount() int
- func (s *StringSeries) Set(i int, v any) error
- func (s *StringSeries) SetNull(i int) error
- func (s *StringSeries) Slice(start, end int) (Series, error)
- func (s *StringSeries) StringValue(i int) (string, error)
- func (s *StringSeries) StringValues() []string
- func (s *StringSeries) ValuesCopy() []any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToSlice ¶
func ToSlice[T comparable](s Set[T]) ([]T, error)
Slice converts a Set of type T into a slice of type []T. It iterates over the elements of the set and appends them to a slice. The resulting slice contains all the elements from the set in an arbitrary order.
Parameters:
s: A Set[T] from which to create the slice.
Returns:
A slice of type []T containing all elements from the input set.
Types ¶
type AnySeries ¶
type AnySeries struct {
// contains filtered or unexported fields
}
AnySeries is a generic series for any values with null support.
func NewAnySeries ¶
NewAnySeries creates a new empty AnySeries with optional capacity.
func NewAnySeriesFromData ¶
NewAnySeriesFromData creates an AnySeries from values and mask.
func (*AnySeries) AppendNull ¶
func (s *AnySeries) AppendNull()
func (*AnySeries) ValuesCopy ¶
type BoolSeries ¶
type BoolSeries struct {
// contains filtered or unexported fields
}
BoolSeries is a high-performance series for bool values with null support.
func NewBoolSeries ¶
func NewBoolSeries(capacity int) *BoolSeries
NewBoolSeries creates a new empty BoolSeries with optional capacity.
func NewBoolSeriesFromData ¶
func NewBoolSeriesFromData(data []bool, mask []bool) (*BoolSeries, error)
NewBoolSeriesFromData creates a BoolSeries from values and mask.
func (*BoolSeries) Append ¶
func (s *BoolSeries) Append(v any) error
func (*BoolSeries) AppendNull ¶
func (s *BoolSeries) AppendNull()
func (*BoolSeries) DType ¶
func (s *BoolSeries) DType() reflect.Type
func (*BoolSeries) IsNull ¶
func (s *BoolSeries) IsNull(i int) bool
func (*BoolSeries) Len ¶
func (s *BoolSeries) Len() int
func (*BoolSeries) MaskCopy ¶
func (s *BoolSeries) MaskCopy() []bool
func (*BoolSeries) NullCount ¶
func (s *BoolSeries) NullCount() int
func (*BoolSeries) SetNull ¶
func (s *BoolSeries) SetNull(i int) error
func (*BoolSeries) ValuesCopy ¶
func (s *BoolSeries) ValuesCopy() []any
type FilterFunc ¶
FilterFunc defines a function type that returns true if a value should be included in filtered results.
type Float64Series ¶
type Float64Series struct {
// contains filtered or unexported fields
}
Float64Series is a high-performance series for float64 values with null support.
func NewFloat64Series ¶
func NewFloat64Series(capacity int) *Float64Series
NewFloat64Series creates a new empty Float64Series with optional capacity.
func NewFloat64SeriesFromData ¶
func NewFloat64SeriesFromData(data []float64, mask []bool) (*Float64Series, error)
NewFloat64SeriesFromData creates a Float64Series from values and mask. If mask is nil, all values are treated as non-null.
func (*Float64Series) Append ¶
func (s *Float64Series) Append(v any) error
func (*Float64Series) AppendNull ¶
func (s *Float64Series) AppendNull()
func (*Float64Series) DType ¶
func (s *Float64Series) DType() reflect.Type
func (*Float64Series) Float64Value ¶
func (s *Float64Series) Float64Value(i int) (float64, error)
Float64Value returns the raw float64 value at index i (ignores null mask).
func (*Float64Series) Float64Values ¶
func (s *Float64Series) Float64Values() []float64
Float64Values returns a copy of the raw float64 data slice.
func (*Float64Series) IsNull ¶
func (s *Float64Series) IsNull(i int) bool
func (*Float64Series) Len ¶
func (s *Float64Series) Len() int
func (*Float64Series) MaskCopy ¶
func (s *Float64Series) MaskCopy() []bool
func (*Float64Series) NullCount ¶
func (s *Float64Series) NullCount() int
func (*Float64Series) SetNull ¶
func (s *Float64Series) SetNull(i int) error
func (*Float64Series) ValuesCopy ¶
func (s *Float64Series) ValuesCopy() []any
type Int64Series ¶
type Int64Series struct {
// contains filtered or unexported fields
}
Int64Series is a high-performance series for int64 values with null support.
func NewInt64Series ¶
func NewInt64Series(capacity int) *Int64Series
NewInt64Series creates a new empty Int64Series with optional capacity.
func NewInt64SeriesFromData ¶
func NewInt64SeriesFromData(data []int64, mask []bool) (*Int64Series, error)
NewInt64SeriesFromData creates an Int64Series from values and mask.
func (*Int64Series) Append ¶
func (s *Int64Series) Append(v any) error
func (*Int64Series) AppendNull ¶
func (s *Int64Series) AppendNull()
func (*Int64Series) DType ¶
func (s *Int64Series) DType() reflect.Type
func (*Int64Series) Int64Value ¶
func (s *Int64Series) Int64Value(i int) (int64, error)
Int64Value returns the raw int64 value at index i (ignores null mask).
func (*Int64Series) Int64Values ¶
func (s *Int64Series) Int64Values() []int64
Int64Values returns a copy of the raw int64 data slice.
func (*Int64Series) IsNull ¶
func (s *Int64Series) IsNull(i int) bool
func (*Int64Series) Len ¶
func (s *Int64Series) Len() int
func (*Int64Series) MaskCopy ¶
func (s *Int64Series) MaskCopy() []bool
func (*Int64Series) NullCount ¶
func (s *Int64Series) NullCount() int
func (*Int64Series) SetNull ¶
func (s *Int64Series) SetNull(i int) error
func (*Int64Series) ValuesCopy ¶
func (s *Int64Series) ValuesCopy() []any
type Series ¶
type Series interface {
// Len returns the number of elements in the series.
Len() int
// DType returns the reflect.Type of the elements in the series.
DType() reflect.Type
// At returns the value at index i. Returns nil if the value is null.
At(i int) (any, error)
// IsNull returns true if the value at index i is null.
IsNull(i int) bool
// NullCount returns the number of null values in the series.
NullCount() int
// Set sets the value at index i. Use nil to set a null value.
Set(i int, v any) error
// SetNull sets the value at index i to null.
SetNull(i int) error
// Append adds a value to the end of the series. Use nil to append a null value.
Append(v any) error
// AppendNull appends a null value to the series.
AppendNull()
// ValuesCopy returns a shallow copy of the underlying data as []any.
// Null values are represented as nil.
ValuesCopy() []any
// MaskCopy returns a copy of the null mask.
MaskCopy() []bool
// Slice returns a new Series containing elements from start (inclusive) to end (exclusive).
Slice(start, end int) (Series, error)
}
Series is the interface for all typed series implementations. Each implementation stores data in a strongly-typed slice with a boolean mask for null values.
func NewSeriesOfType ¶
NewSeriesOfType creates a new Series based on the provided reflect.Type.
func NewSeriesOfTypeWithSize ¶
NewSeriesOfTypeWithSize creates a new Series with the specified size (length).
type Set ¶
type Set[T comparable] map[T]struct{}
Set is an alias for a map representing an unordered collection of unique elements of type T. Type T must be comparable.
func NewSet ¶
func NewSet[T comparable](initialSize ...int) (Set[T], error)
NewSet creates and initializes a new empty Set. If an initial size is provided, the set will be pre-allocated with that size. The initial size must be a non-negative integer.
func ToSet ¶
func ToSet[T comparable](slice []T) (Set[T], error)
ToSet converts a slice of type []T into a Set of type Set[T]. It iterates over the elements of the slice and adds them to a Set. The resulting Set contains all the elements from the input slice in an arbitrary order.
Parameters:
slice: A slice of type []T from which to create the Set.
Returns:
A Set of type Set[T] containing all elements from the input slice.
func (Set[T]) AddMulti ¶
AddMulti inserts multiple values into the set only if they do not already exist. It iterates over the provided values and attempts to add each one to the set. If any value already exists in the set, the function returns an error. If all values are successfully added, the function returns nil.
func (Set[T]) Compare ¶
Compare checks if two sets are equal by comparing their lengths and ensuring all elements in the first set exist in the second set. It first checks if the lengths of the two sets are equal. If not, it returns false and nil. Then, it iterates over the elements of the first set and checks if each element exists in the second set. If an element does not exist in the second set, it returns false and the non-existent element. If all elements in the first set exist in the second set, it returns true and nil.
Parameters:
s2: The input Set[T] to compare with the current set.
Returns:
A boolean indicating if the sets are equal. An any value representing the first element that does not exist in the second set if the sets are not equal, or nil if they are equal.
func (Set[T]) Difference ¶
Difference creates a new Set containing elements that exist in the current set but not in the input set. It iterates over the elements of the current set and checks if they do not exist in the input set. If an element does not exist in the input set, it is added to the resulting set. The resulting Set contains all the elements that are unique to the current set in an arbitrary order.
Parameters:
s2: The input Set[T] to find the difference with the current set.
Returns:
A Set of type Set[T] containing all elements that are unique to the current set. An error if the operation fails.
func (Set[T]) Filter ¶
func (s Set[T]) Filter(P FilterFunc[T]) (Set[T], error)
Filter applies a filter function to each element of the set and returns a new set containing only the elements that pass the filter. The filter function P is applied to each element of the set. If the function returns true for an element, it is included in the resulting set. If the function returns false, the element is not included. The function returns a new Set containing the filtered elements and an error if the operation fails.
func (Set[T]) Intersect ¶
Intersect creates a new Set containing elements that exist in both the current set and the input set. It iterates over the elements of the current set and checks if they exist in the input set. If an element exists in both sets, it is added to the resulting set. The resulting Set contains all the elements that are common to both input sets in an arbitrary order.
Parameters:
s2: The input Set[T] to intersect with the current set.
Returns:
A Set of type Set[T] containing all elements that are common to both input sets. An error if the operation fails.
func (Set[T]) Union ¶
Union creates a new Set containing all elements from both the current set and the input set. It iterates over the elements of both sets and adds them to a new Set, ensuring no duplicates. The resulting Set contains all unique elements from both input sets in an arbitrary order.
Parameters:
s2: The input Set[T] to union with the current set.
Returns:
A Set of type Set[T] containing all unique elements from both input sets. An error if the operation fails.
type StringSeries ¶
type StringSeries struct {
// contains filtered or unexported fields
}
StringSeries is a high-performance series for string values with null support.
func NewStringSeries ¶
func NewStringSeries(capacity int) *StringSeries
NewStringSeries creates a new empty StringSeries with optional capacity.
func NewStringSeriesFromData ¶
func NewStringSeriesFromData(data []string, mask []bool) (*StringSeries, error)
NewStringSeriesFromData creates a StringSeries from values and mask.
func (*StringSeries) Append ¶
func (s *StringSeries) Append(v any) error
func (*StringSeries) AppendNull ¶
func (s *StringSeries) AppendNull()
func (*StringSeries) DType ¶
func (s *StringSeries) DType() reflect.Type
func (*StringSeries) IsNull ¶
func (s *StringSeries) IsNull(i int) bool
func (*StringSeries) Len ¶
func (s *StringSeries) Len() int
func (*StringSeries) MaskCopy ¶
func (s *StringSeries) MaskCopy() []bool
func (*StringSeries) NullCount ¶
func (s *StringSeries) NullCount() int
func (*StringSeries) SetNull ¶
func (s *StringSeries) SetNull(i int) error
func (*StringSeries) StringValue ¶
func (s *StringSeries) StringValue(i int) (string, error)
StringValue returns the raw string value at index i (ignores null mask).
func (*StringSeries) StringValues ¶
func (s *StringSeries) StringValues() []string
StringValues returns a copy of the raw string data slice.
func (*StringSeries) ValuesCopy ¶
func (s *StringSeries) ValuesCopy() []any