Example #1
0
func (this *Order) afterItems(context *Context) {
	defer this.releaseValues()
	defer func() {
		this.context = nil
		this.terms = nil
	}()

	this.context = context
	this.terms = make([]string, len(this.plan.Terms()))
	for i, term := range this.plan.Terms() {
		this.terms[i] = term.Expression().String()
	}

	timer := time.Now()
	sort.Sort(this)
	context.AddPhaseTime("sort", time.Since(timer))

	context.SetSortCount(uint64(this.Len()))

	for _, av := range this.values {
		if !this.sendItem(av) {
			return
		}
	}
}
Example #2
0
func (this *Order) afterItems(context *Context) {
	defer this.releaseValues()
	defer func() {
		this.context = nil
		this.terms = nil
	}()

	this.setupTerms(context)
	timer := time.Now()
	sort.Sort(this)
	context.AddPhaseTime("sort", time.Since(timer))

	context.SetSortCount(uint64(this.Len()))

	for _, av := range this.values {
		if !this.sendItem(av) {
			return
		}
	}
}