func (this *InterpretedExecutor) processItem(q network.Query, item *dparval.Value) bool { projection := item.GetAttachment("projection") switch projection := projection.(type) { case *dparval.Value: result := projection.Value() q.Response().SendResult(result) } return true }
func setAggregateValue(item *dparval.Value, key string, val *dparval.Value) { aggregates := item.GetAttachment("aggregates") aggregatesMap, ok := aggregates.(map[string]interface{}) if !ok { // create a new aggregates map aggregatesMap = map[string]interface{}{} item.SetAttachment("aggregates", aggregatesMap) } aggregatesMap[key] = val }
func (this *FunctionCallNowMillis) Evaluate(item *dparval.Value) (*dparval.Value, error) { // first retrieve the query object q := item.GetAttachment("query") query, ok := q.(network.Query) if !ok { return dparval.NewValue(nil), nil } return dparval.NewValue(timeToMillis(query.StartTime())), nil }
func (this *EliminateDuplicates) processItem(item *dparval.Value) bool { projection, _ := item.GetAttachment("projection").(*dparval.Value) if projection != nil { hashval := fmt.Sprintf("%s", projection.Value()) found := this.uniqueBuffer[hashval] if found == nil { this.uniqueBuffer[hashval] = item } } return true }
// lookup the current value of the aggregate stored // at the specified key func aggregateValue(item *dparval.Value, key string) (*dparval.Value, error) { aggregates := item.GetAttachment("aggregates") aggregatesMap, ok := aggregates.(map[string]interface{}) if ok { value := aggregatesMap[key] valuedparval, ok := value.(*dparval.Value) if ok { return valuedparval, nil } } return nil, fmt.Errorf("Unable to find aggregate %s", key) }
func (this *Order) processItem(item *dparval.Value) bool { if this.explicitAliases != nil { projection := item.GetAttachment("projection") projectionValue, ok := projection.(*dparval.Value) if ok { for _, explicitAlias := range this.explicitAliases { // put the explicit alias values from the projection into the item aliasedProjectedValue, err := projectionValue.Path(explicitAlias) if err == nil { item.SetPath(explicitAlias, aliasedProjectedValue) } } } } this.buffer = append(this.buffer, item) return true }