示例#1
0
func (self *conversionIterator) Next(resultRef interface{}) bool {
	if !self.Iterator.Next(self.FromResultPtr) {
		return false
	}
	reflection.SmartCopy(self.conversionFunc(self.FromResultPtr), resultRef)
	return true
}
示例#2
0
func (self *SliceIterator) Next(resultRef interface{}) bool {
	if self.index >= self.slice.Len() {
		return false
	}
	reflection.SmartCopy(self.slice.Index(self.index).Interface(), resultRef)
	self.index++
	return true
}
示例#3
0
func (self *SingletonIterator) Next(resultRef interface{}) bool {
	if self.iterated || self.Singleton == nil {
		return false
	}
	reflection.SmartCopy(self.Singleton, resultRef)
	self.iterated = true
	return true
}
func (self *IndexedSliceIterator) Next(resultRef interface{}) bool {
	if self.err != nil || self.index >= len(self.indices) {
		return false
	}
	if self.indices[self.index] >= self.slice.Len() {
		self.err = errs.Format("Index %d from indices greater or equal than length of slice %d", self.indices[self.index], self.slice.Len())
		return false
	}
	reflection.SmartCopy(self.slice.Index(self.indices[self.index]), resultRef)
	self.index++
	return false
}