本文整理匯總了Golang中parser.SelectQuery.GetReferencedColumns方法的典型用法代碼示例。如果您正苦於以下問題:Golang SelectQuery.GetReferencedColumns方法的具體用法?Golang SelectQuery.GetReferencedColumns怎麽用?Golang SelectQuery.GetReferencedColumns使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類parser.SelectQuery
的用法示例。
在下文中一共展示了SelectQuery.GetReferencedColumns方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExecuteQuery
func (self *LevelDbDatastore) ExecuteQuery(user common.User, database string,
query *parser.SelectQuery, yield func(*protocol.Series) error,
ringFilter func(database, series *string, time *int64) bool) error {
seriesAndColumns := query.GetReferencedColumns()
hasAccess := true
for series, columns := range seriesAndColumns {
if regex, ok := series.GetCompiledRegex(); ok {
seriesNames := self.getSeriesForDbAndRegex(database, regex)
for _, name := range seriesNames {
if !user.HasReadAccess(name) {
hasAccess = false
continue
}
err := self.executeQueryForSeries(database, name, columns, query, yield, ringFilter)
if err != nil {
return err
}
}
} else {
if !user.HasReadAccess(series.Name) {
hasAccess = false
continue
}
err := self.executeQueryForSeries(database, series.Name, columns, query, yield, ringFilter)
if err != nil {
return err
}
}
}
if !hasAccess {
return fmt.Errorf("You don't have permission to access one or more time series")
}
return nil
}