| 
									
										
										
										
											2019-08-28 23:46:42 +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-28 23:46:42 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | package pipe | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // DomainGrouper groups the records by domain. | 
					
						
							|  |  |  | // It keeps the other fields intact. | 
					
						
							|  |  |  | // For example: It returns the page field as well. | 
					
						
							|  |  |  | // Exercise: Write a solution that removes the unnecessary data. | 
					
						
							|  |  |  | func DomainGrouper(r Record) string { | 
					
						
							| 
									
										
										
										
											2019-08-29 01:32:25 +03:00
										 |  |  | 	return r.domain | 
					
						
							| 
									
										
										
										
											2019-08-28 23:46:42 +03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Page groups records by page. | 
					
						
							|  |  |  | func Page(r Record) string { | 
					
						
							| 
									
										
										
										
											2019-08-29 01:32:25 +03:00
										 |  |  | 	return r.domain + r.page | 
					
						
							| 
									
										
										
										
											2019-08-28 23:46:42 +03:00
										 |  |  | } |