Ejemplo n.º 1
1
/*
This method maps all the constituent clauses, namely the from,
let, where, group by and projection(select) within a Subselect
statement.
*/
func (this *Subselect) MapExpressions(mapper expression.Mapper) (err error) {
	if this.from != nil {
		err = this.from.MapExpressions(mapper)
		if err != nil {
			return
		}
	}

	if this.let != nil {
		err = this.let.MapExpressions(mapper)
		if err != nil {
			return
		}
	}

	if this.where != nil {
		this.where, err = mapper.Map(this.where)
		if err != nil {
			return
		}
	}

	if this.group != nil {
		err = this.group.MapExpressions(mapper)
		if err != nil {
			return
		}
	}

	return this.projection.MapExpressions(mapper)
}
Ejemplo n.º 2
0
/*
Apply mapper to where condition expressions.
*/
func (this *MergeDelete) MapExpressions(mapper expression.Mapper) (err error) {
	if this.where != nil {
		this.where, err = mapper.Map(this.where)
	}

	return
}
Ejemplo n.º 3
0
/*
Applies mapper to all the expressions in the merge statement.
*/
func (this *Merge) MapExpressions(mapper expression.Mapper) (err error) {
	err = this.source.MapExpressions(mapper)
	if err != nil {
		return
	}

	this.key, err = mapper.Map(this.key)
	if err != nil {
		return
	}

	err = this.actions.MapExpressions(mapper)
	if err != nil {
		return
	}

	if this.limit != nil {
		this.limit, err = mapper.Map(this.limit)
		if err != nil {
			return
		}
	}

	if this.returning != nil {
		err = this.returning.MapExpressions(mapper)
	}

	return
}
Ejemplo n.º 4
0
/*
Applies mapper to all the expressions in the upsert statement.
*/
func (this *Upsert) MapExpressions(mapper expression.Mapper) (err error) {
	if this.key != nil {
		this.key, err = mapper.Map(this.key)
		if err != nil {
			return
		}
	}

	if this.value != nil {
		this.value, err = mapper.Map(this.value)
		if err != nil {
			return
		}
	}

	if this.values != nil {
		err = this.values.MapExpressions(mapper)
		if err != nil {
			return
		}
	}

	if this.query != nil {
		err = this.query.MapExpressions(mapper)
		if err != nil {
			return
		}
	}

	if this.returning != nil {
		err = this.returning.MapExpressions(mapper)
	}

	return
}
Ejemplo n.º 5
0
/*
Map the input expression of the result expr.
*/
func (this *ResultTerm) MapExpression(mapper expression.Mapper) (err error) {
	if this.expr != nil {
		this.expr, err = mapper.Map(this.expr)
	}

	return
}
Ejemplo n.º 6
0
/*
Applies mapper to the key and value expressions.
*/
func (this *Pair) MapExpressions(mapper expression.Mapper) (err error) {
	this.Key, err = mapper.Map(this.Key)
	if err != nil {
		return
	}

	this.Value, err = mapper.Map(this.Value)
	return
}
Ejemplo n.º 7
0
/*
Maps the source array of the unnest if the parent object(left)
is mapped successfully.
*/
func (this *Unnest) MapExpressions(mapper expression.Mapper) (err error) {
	err = this.left.MapExpressions(mapper)
	if err != nil {
		return
	}

	this.expr, err = mapper.Map(this.expr)
	return
}
Ejemplo n.º 8
0
/*
Map Expressions for all sort terms in the receiver.
*/
func (this SortTerms) MapExpressions(mapper expression.Mapper) (err error) {
	for _, term := range this {
		term.expr, err = mapper.Map(term.expr)
		if err != nil {
			return
		}
	}

	return
}
Ejemplo n.º 9
0
/*
Applies mapper to the path expressions and update for in
the unset Term.
*/
func (this *UnsetTerm) MapExpressions(mapper expression.Mapper) (err error) {
	path, err := mapper.Map(this.path)
	if err != nil {
		return err
	}

	this.path = path.(expression.Path)

	if this.updateFor != nil {
		err = this.updateFor.MapExpressions(mapper)
	}

	return
}
Ejemplo n.º 10
0
/*
Apply mapper to value and where expressions.
*/
func (this *MergeInsert) MapExpressions(mapper expression.Mapper) (err error) {
	if this.value != nil {
		this.value, err = mapper.Map(this.value)
		if err != nil {
			return
		}
	}

	if this.where != nil {
		this.where, err = mapper.Map(this.where)
	}

	return
}
Ejemplo n.º 11
0
/*
It is a utility function that takes in as input parameter
a mapper and maps the involved expressions to an expression.
If there is an error during the mapping, an error is returned.
*/
func (this *AggregateBase) MapChildren(mapper expression.Mapper) error {
	children := this.Children()

	for i, c := range children {
		expr, err := mapper.Map(c)
		if err != nil {
			return err
		}

		children[i] = expr
	}

	return nil
}
Ejemplo n.º 12
0
/*
Apply mapper to expressions in the when clause and bindings.
*/
func (this *UpdateFor) MapExpressions(mapper expression.Mapper) (err error) {
	err = this.bindings.MapExpressions(mapper)
	if err != nil {
		return
	}

	if this.when != nil {
		this.when, err = mapper.Map(this.when)
		if err != nil {
			return
		}
	}

	return
}
Ejemplo n.º 13
0
/*
This method maps all the constituent terms, namely projection and keys
in the from clause.
*/
func (this *KeyspaceTerm) MapExpressions(mapper expression.Mapper) (err error) {
	if this.projection != nil {
		expr, err := mapper.Map(this.projection)
		if err != nil {
			return err
		}

		this.projection = expr.(expression.Path)
	}

	if this.keys != nil {
		this.keys, err = mapper.Map(this.keys)
		if err != nil {
			return err
		}
	}

	return
}
Ejemplo n.º 14
0
/*
Applies mapper to the set, unset and where expressions.
*/
func (this *MergeUpdate) MapExpressions(mapper expression.Mapper) (err error) {
	if this.set != nil {
		err = this.set.MapExpressions(mapper)
		if err != nil {
			return
		}
	}

	if this.unset != nil {
		err = this.unset.MapExpressions(mapper)
		if err != nil {
			return
		}
	}

	if this.where != nil {
		this.where, err = mapper.Map(this.where)
	}

	return
}
Ejemplo n.º 15
0
/*
This method maps all the constituent clauses, namely the
by, letting and having within a group by clause.
*/
func (this *Group) MapExpressions(mapper expression.Mapper) (err error) {
	if this.by != nil {
		err = this.by.MapExpressions(mapper)
		if err != nil {
			return
		}
	}

	if this.letting != nil {
		err = this.letting.MapExpressions(mapper)
		if err != nil {
			return
		}
	}

	if this.having != nil {
		this.having, err = mapper.Map(this.having)
	}

	return
}
Ejemplo n.º 16
0
/*
Applies mapper to all the expressions in the delete statement.
*/
func (this *Delete) MapExpressions(mapper expression.Mapper) (err error) {
	if this.keys != nil {
		this.keys, err = mapper.Map(this.keys)
		if err != nil {
			return err
		}
	}

	if this.where != nil {
		this.where, err = mapper.Map(this.where)
		if err != nil {
			return err
		}
	}

	if this.limit != nil {
		this.limit, err = mapper.Map(this.limit)
		if err != nil {
			return err
		}
	}

	if this.returning != nil {
		err = this.returning.MapExpressions(mapper)
	}

	return
}
Ejemplo n.º 17
0
/*
This method maps all the constituent clauses, namely the expression,
partition and where clause within a create index statement.
*/
func (this *CreateIndex) MapExpressions(mapper expression.Mapper) (err error) {
	err = this.exprs.MapExpressions(mapper)
	if err != nil {
		return
	}

	if this.partition != nil {
		this.partition, err = mapper.Map(this.partition)
		if err != nil {
			return
		}
	}

	if this.where != nil {
		this.where, err = mapper.Map(this.where)
		if err != nil {
			return
		}
	}

	return
}
Ejemplo n.º 18
0
/*
This method maps all the constituent clauses, namely the subresult,
order, limit and offset within a Select statement.
*/
func (this *Select) MapExpressions(mapper expression.Mapper) (err error) {
	err = this.subresult.MapExpressions(mapper)
	if err != nil {
		return
	}

	if this.order != nil {
		err = this.order.MapExpressions(mapper)
	}

	if this.limit != nil {
		this.limit, err = mapper.Map(this.limit)
		if err != nil {
			return
		}
	}

	if this.offset != nil {
		this.offset, err = mapper.Map(this.offset)
	}

	return
}