Files
learngo/logparser/oop/groupers.go

16 lines
375 B
Go
Raw Normal View History

2019-08-28 20:23:38 +03:00
package main
type groupFunc func(record) string
// domainGrouper groups by domain.
// but it keeps the other fields.
// for example: it returns pages as well, but you shouldn't use them.
// exercise: write a function that erases the unnecessary data.
func domainGrouper(r record) string {
return r.domain
}
func pageGrouper(r record) string {
return r.domain + r.page
}