| 
									
										
										
										
											2019-08-29 01:32:25 +03:00
										 |  |  | // Copyright © 2018 Inanc Gumus | 
					
						
							|  |  |  | // Learn Go Programming Course | 
					
						
							|  |  |  | // License: https://creativecommons.org/licenses/by-nc-sa/4.0/ | 
					
						
							|  |  |  | // | 
					
						
							| 
									
										
										
										
											2019-10-30 19:34:44 +03:00
										 |  |  | // For more tutorials  : https://learngoprogramming.com | 
					
						
							|  |  |  | // In-person training  : https://www.linkedin.com/in/inancgumus/ | 
					
						
							|  |  |  | // Follow me on twitter: https://twitter.com/inancgumus | 
					
						
							| 
									
										
										
										
											2019-08-29 01:32:25 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | package main | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"github.com/inancgumus/learngo/logparser/v5/pipe" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type passThrough struct { | 
					
						
							|  |  |  | 	pipe.Iterator | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (t *passThrough) Consume(results pipe.Iterator) error { | 
					
						
							|  |  |  | 	t.Iterator = results | 
					
						
							|  |  |  | 	return nil | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (t *passThrough) Each(yield func(pipe.Record) error) error { | 
					
						
							| 
									
										
										
										
											2019-08-29 16:08:46 +03:00
										 |  |  | 	pass := func(r pipe.Record) error { | 
					
						
							| 
									
										
										
										
											2019-08-29 01:32:25 +03:00
										 |  |  | 		// fmt.Println(r.Fields()) | 
					
						
							|  |  |  | 		// fmt.Println(r.Int("visits")) | 
					
						
							|  |  |  | 		return yield(r) | 
					
						
							| 
									
										
										
										
											2019-08-29 16:08:46 +03:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2019-08-29 01:32:25 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-29 16:08:46 +03:00
										 |  |  | 	return t.Iterator.Each(pass) | 
					
						
							| 
									
										
										
										
											2019-08-29 01:32:25 +03:00
										 |  |  | } |