refactor: logparser v5 to pkgs
This commit is contained in:
21
logparser/v5/pipe/groupers.go
Normal file
21
logparser/v5/pipe/groupers.go
Normal file
@ -0,0 +1,21 @@
|
||||
// For more tutorials: https://blog.learngoprogramming.com
|
||||
//
|
||||
// Copyright © 2018 Inanc Gumus
|
||||
// Learn Go Programming Course
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
//
|
||||
|
||||
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 {
|
||||
return r.Domain
|
||||
}
|
||||
|
||||
// Page groups records by page.
|
||||
func Page(r Record) string {
|
||||
return r.Domain + r.Page
|
||||
}
|
Reference in New Issue
Block a user