当前位置: 首页>>代码示例>>Golang>>正文


Golang Value.GetAttachment方法代码示例

本文整理汇总了Golang中github.com/couchbaselabs/dparval.Value.GetAttachment方法的典型用法代码示例。如果您正苦于以下问题:Golang Value.GetAttachment方法的具体用法?Golang Value.GetAttachment怎么用?Golang Value.GetAttachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/couchbaselabs/dparval.Value的用法示例。


在下文中一共展示了Value.GetAttachment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: processItem

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
}
开发者ID:latinojoel,项目名称:tuqtng,代码行数:9,代码来源:interpreted.go

示例2: setAggregateValue

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
}
开发者ID:latinojoel,项目名称:tuqtng,代码行数:10,代码来源:function_aggregate_utils.go

示例3: Evaluate

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
}
开发者ID:phonkee,项目名称:tuqtng,代码行数:11,代码来源:function_date.go

示例4: processItem

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
}
开发者ID:latinojoel,项目名称:tuqtng,代码行数:11,代码来源:eliminate_duplicates.go

示例5: aggregateValue

// 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)
}
开发者ID:latinojoel,项目名称:tuqtng,代码行数:14,代码来源:function_aggregate_utils.go

示例6: processItem

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
}
开发者ID:latinojoel,项目名称:tuqtng,代码行数:17,代码来源:order.go


注:本文中的github.com/couchbaselabs/dparval.Value.GetAttachment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。