本文整理汇总了Golang中github.com/couchbase/query/expression.Formalizer.Map方法的典型用法代码示例。如果您正苦于以下问题:Golang Formalizer.Map方法的具体用法?Golang Formalizer.Map怎么用?Golang Formalizer.Map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/couchbase/query/expression.Formalizer
的用法示例。
在下文中一共展示了Formalizer.Map方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Formalize
/*
This method qualifies identifiers for all the constituent clauses,
namely the by, letting and having expressions by mapping them.
*/
func (this *Group) Formalize(f *expression.Formalizer) (*expression.Formalizer, error) {
var err error
if this.by != nil {
for i, b := range this.by {
this.by[i], err = f.Map(b)
if err != nil {
return nil, err
}
}
}
if this.letting != nil {
_, err = f.PushBindings(this.letting)
if err != nil {
return nil, err
}
}
if this.having != nil {
this.having, err = f.Map(this.having)
if err != nil {
return nil, err
}
}
return f, nil
}
示例2: sargableIndexes
func sargableIndexes(indexes []datastore.Index, pred expression.Expression,
primaryKey expression.Expressions, dnf *DNF, formalizer *expression.Formalizer) (
map[datastore.Index]*indexEntry, error) {
var err error
var keys expression.Expressions
sargables := make(map[datastore.Index]*indexEntry, len(indexes))
for _, index := range indexes {
if index.IsPrimary() {
keys = primaryKey
} else {
keys = index.RangeKey()
keys = keys.Copy()
for i, key := range keys {
key = key.Copy()
key, err = formalizer.Map(key)
if err != nil {
return nil, err
}
key, err = dnf.Map(key)
if err != nil {
return nil, err
}
keys[i] = key
}
}
cond := index.Condition()
if cond != nil {
cond = cond.Copy()
cond, err = formalizer.Map(cond)
if err != nil {
return nil, err
}
cond, err = dnf.Map(cond)
if err != nil {
return nil, err
}
if !SubsetOf(pred, cond) {
continue
}
}
n := SargableFor(pred, keys)
if n > 0 {
sargables[index] = &indexEntry{keys, keys[0:n], cond, nil}
}
}
return sargables, nil
}
示例3: Formalize
/*
Fully qualify identifiers for the update-for clause and the path
expression in the unset clause.
*/
func (this *UnsetTerm) Formalize(f *expression.Formalizer) (err error) {
if this.updateFor != nil {
sv, err := f.PushBindings(this.updateFor.bindings)
if err != nil {
return err
}
defer f.PopBindings(sv)
}
path, err := f.Map(this.path)
if err != nil {
return err
}
this.path = path.(expression.Path)
return
}
示例4: Formalize
/*
Qualify all identifiers for the parent expression. Checks is
a nest alias exists and if it is a duplicate alias.
*/
func (this *IndexNest) Formalize(parent *expression.Formalizer) (f *expression.Formalizer, err error) {
f, err = this.left.Formalize(parent)
if err != nil {
return
}
_, ok := f.Allowed.Field(this.keyFor)
if !ok {
err = errors.NewUnknownForError("NEST", this.keyFor, "plan.nest.unknown_for")
return nil, err
}
alias := this.Alias()
if alias == "" {
err = errors.NewNoTermNameError("NEST", "plan.nest.requires_name_or_alias")
return nil, err
}
_, ok = f.Allowed.Field(alias)
if ok {
err = errors.NewDuplicateAliasError("NEST", alias, "plan.nest.duplicate_alias")
return nil, err
}
f.Allowed.SetField(alias, alias)
f.Keyspace = ""
var p *expression.Formalizer
if parent != nil {
p = parent.Copy()
} else {
p = expression.NewFormalizer()
}
p.Allowed.SetField(alias, alias)
this.right.keys, err = p.Map(this.right.keys)
return
}