本文整理汇总了Golang中github.com/couchbase/query/expression.Formalizer.SetIdentifiers方法的典型用法代码示例。如果您正苦于以下问题:Golang Formalizer.SetIdentifiers方法的具体用法?Golang Formalizer.SetIdentifiers怎么用?Golang Formalizer.SetIdentifiers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/couchbase/query/expression.Formalizer
的用法示例。
在下文中一共展示了Formalizer.SetIdentifiers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: FormalizeSubquery
/*
This method qualifies identifiers for all the constituent clauses,
namely the subresult, order, limit and offset within a subquery.
For the subresult of the subquery, call Formalize, for the order
by clause call MapExpressions, for limit and offset call Accept.
*/
func (this *Select) FormalizeSubquery(parent *expression.Formalizer) error {
f, err := this.subresult.Formalize(parent)
if err != nil {
return err
}
this.correlated = this.subresult.IsCorrelated()
if this.order != nil {
err = this.order.MapExpressions(f)
if err != nil {
return err
}
if !this.correlated {
// Determine if this is a correlated subquery
immediate := f.Allowed.GetValue().Fields()
for ident, _ := range f.Identifiers {
if _, ok := immediate[ident]; !ok {
this.correlated = true
break
}
}
}
}
if this.limit == nil && this.offset == nil {
return err
}
if !this.correlated {
prevIdentifiers := parent.Identifiers
defer parent.SetIdentifiers(prevIdentifiers)
parent.SetIdentifiers(make(map[string]bool))
}
if this.limit != nil {
_, err = this.limit.Accept(parent)
if err != nil {
return err
}
}
if this.offset != nil {
_, err = this.offset.Accept(parent)
if err != nil {
return err
}
}
if !this.correlated {
this.correlated = len(parent.Identifiers) > 0
}
return err
}