本文整理汇总了Golang中parser.SelectQuery.GetTableAliases方法的典型用法代码示例。如果您正苦于以下问题:Golang SelectQuery.GetTableAliases方法的具体用法?Golang SelectQuery.GetTableAliases怎么用?Golang SelectQuery.GetTableAliases使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parser.SelectQuery
的用法示例。
在下文中一共展示了SelectQuery.GetTableAliases方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: sendBatch
// Return the number of dropped ticks from filtering. if the series
// had more than one alias, returns the min of all dropped ticks
func (self *LevelDbDatastore) sendBatch(query *parser.SelectQuery, series *protocol.Series, yield func(series *protocol.Series) error) (int, error) {
dropped := int(math.MaxInt32)
for _, alias := range query.GetTableAliases(*series.Name) {
_alias := alias
newSeries := &protocol.Series{Name: &_alias, Points: series.Points, Fields: series.Fields}
lengthBeforeFiltering := len(newSeries.Points)
var filteredResult *protocol.Series
var err error
if query.GetFromClause().Type == parser.FromClauseInnerJoin {
filteredResult = newSeries
} else {
filteredResult, err = Filter(query, newSeries)
if err != nil {
return 0, err
}
}
_dropped := lengthBeforeFiltering - len(filteredResult.Points)
if _dropped < dropped {
dropped = _dropped
}
if err := yield(filteredResult); err != nil {
return 0, err
}
}
return dropped, nil
}