Documentation ¶
Index ¶
- Variables
- type Average
- func (agg *Average) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Average) Document() docs.Documentation
- func (agg *Average) GetValue(ctx context.Context, tx storage.StateTransaction) (octosql.Value, error)
- func (agg *Average) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Average) String() string
- type Count
- func (agg *Count) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Count) Document() docs.Documentation
- func (agg *Count) GetValue(ctx context.Context, tx storage.StateTransaction) (octosql.Value, error)
- func (agg *Count) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Count) String() string
- type Distinct
- func (agg *Distinct) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Distinct) Document() docs.Documentation
- func (agg *Distinct) GetValue(ctx context.Context, tx storage.StateTransaction) (octosql.Value, error)
- func (agg *Distinct) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Distinct) String() string
- type First
- func (agg *First) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *First) Document() docs.Documentation
- func (agg *First) GetValue(ctx context.Context, tx storage.StateTransaction) (octosql.Value, error)
- func (agg *First) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *First) String() string
- type Key
- func (agg *Key) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Key) Document() docs.Documentation
- func (agg *Key) GetValue(ctx context.Context, tx storage.StateTransaction) (octosql.Value, error)
- func (agg *Key) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Key) String() string
- type Last
- func (agg *Last) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Last) Document() docs.Documentation
- func (agg *Last) GetValue(ctx context.Context, tx storage.StateTransaction) (octosql.Value, error)
- func (agg *Last) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Last) String() string
- type Max
- func (agg *Max) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Max) Document() docs.Documentation
- func (agg *Max) GetValue(ctx context.Context, tx storage.StateTransaction) (octosql.Value, error)
- func (agg *Max) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Max) String() string
- type Min
- func (agg *Min) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Min) Document() docs.Documentation
- func (agg *Min) GetValue(ctx context.Context, tx storage.StateTransaction) (octosql.Value, error)
- func (agg *Min) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Min) String() string
- type Sum
- func (agg *Sum) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Sum) Document() docs.Documentation
- func (agg *Sum) GetValue(ctx context.Context, tx storage.StateTransaction) (octosql.Value, error)
- func (agg *Sum) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
- func (agg *Sum) String() string
Constants ¶
This section is empty.
Variables ¶
var AggregateTable = map[string]execution.AggregatePrototype{ "count": func() execution.Aggregate { return NewCountAggregate() }, "sum": func() execution.Aggregate { return NewSumAggregate() }, "avg": func() execution.Aggregate { return NewAverageAggregate() }, "min": func() execution.Aggregate { return NewMinAggregate() }, "max": func() execution.Aggregate { return NewMaxAggregate() }, "sum_distinct": func() execution.Aggregate { return NewDistinctAggregate(NewSumAggregate()) }, "count_distinct": func() execution.Aggregate { return NewDistinctAggregate(NewCountAggregate()) }, "avg_distinct": func() execution.Aggregate { return NewDistinctAggregate(NewAverageAggregate()) }, "first": func() execution.Aggregate { return NewFirstAggregate() }, "last": func() execution.Aggregate { return NewLastAggregate() }, "key": func() execution.Aggregate { return NewKeyAggregate() }, }
Functions ¶
This section is empty.
Types ¶
type Average ¶
type Average struct {
// contains filtered or unexported fields
}
func NewAverageAggregate ¶ added in v0.3.0
func NewAverageAggregate() *Average
func (*Average) Document ¶
func (agg *Average) Document() docs.Documentation
func (*Average) RetractValue ¶ added in v0.3.0
type Count ¶
type Count struct { }
func NewCountAggregate ¶ added in v0.3.0
func NewCountAggregate() *Count
func (*Count) Document ¶
func (agg *Count) Document() docs.Documentation
func (*Count) RetractValue ¶ added in v0.3.0
type Distinct ¶
type Distinct struct {
// contains filtered or unexported fields
}
func NewDistinctAggregate ¶ added in v0.3.0
func (*Distinct) Document ¶
func (agg *Distinct) Document() docs.Documentation
func (*Distinct) RetractValue ¶ added in v0.3.0
type First ¶
type First struct { }
func NewFirstAggregate ¶ added in v0.3.0
func NewFirstAggregate() *First
func (*First) AddValue ¶ added in v0.3.0
func (agg *First) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
First storage contains Deque for actual order of elements added and Map for storing counts of every element. Once the element is added, we PushBack it into the Deque (because it is the last one to pick as 'first' in order). Above that, we increment its count in Map.
func (*First) Document ¶
func (agg *First) Document() docs.Documentation
func (*First) GetValue ¶ added in v0.3.0
Now the only think we need to do is PopFront ('front' because together with PushBack it creates a queue structure) first element which has positive count value (which means it wasn't fully retracted). If the front element doesn't have positive count, we need to 'forget' about its existence (as is described above RetractValue method), so we just Pop it.
func (*First) RetractValue ¶ added in v0.3.0
func (agg *First) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
Now, once the element is retracted we don't know its current position in Deque, so the only thing we can do is decrement its count value in Map (if it reaches 0, we will Pop it from deque during GetValue and don't bother)
type Key ¶ added in v0.3.0
type Key struct { }
func NewKeyAggregate ¶ added in v0.3.0
func NewKeyAggregate() *Key
func (*Key) Document ¶ added in v0.3.0
func (agg *Key) Document() docs.Documentation
func (*Key) RetractValue ¶ added in v0.3.0
type Last ¶
type Last struct { }
func NewLastAggregate ¶ added in v0.3.0
func NewLastAggregate() *Last
func (*Last) AddValue ¶ added in v0.3.0
func (agg *Last) AddValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
Last storage contains Deque for actual order of elements added and Map for storing counts of every element. Once the element is added, we PushFront it into the Deque (because it is the first one to pick as 'last' in order). Above that, we increment its count in Map.
func (*Last) Document ¶
func (agg *Last) Document() docs.Documentation
func (*Last) GetValue ¶ added in v0.3.0
Now the only think we need to do is PopFront ('front' because together with PushFront it creates a stack structure) first element which has positive count value (which means it wasn't fully retracted). If the front element doesn't have positive count, we need to 'forget' about its existence (as is described above RetractValue method), so we just Pop it.
func (*Last) RetractValue ¶ added in v0.3.0
func (agg *Last) RetractValue(ctx context.Context, tx storage.StateTransaction, value octosql.Value) error
Now, once the element is retracted we don't know its current position in Deque, so the only thing we can do is decrement its count value in Map (if it reaches 0, we will Pop it from deque during GetValue and don't bother)
type Max ¶
type Max struct { }
func NewMaxAggregate ¶ added in v0.3.0
func NewMaxAggregate() *Max
func (*Max) Document ¶
func (agg *Max) Document() docs.Documentation
func (*Max) RetractValue ¶ added in v0.3.0
type Min ¶
type Min struct { }
func NewMinAggregate ¶ added in v0.3.0
func NewMinAggregate() *Min
func (*Min) Document ¶
func (agg *Min) Document() docs.Documentation