本文整理匯總了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
}