test gorup

This commit is contained in:
Bel LaPointe
2023-10-25 08:17:58 -06:00
parent 0838abf831
commit 40cec44c0b
2 changed files with 34 additions and 0 deletions

21
ledger/group.go Normal file
View File

@@ -0,0 +1,21 @@
package ledger
import "regexp"
type Group func(Delta) Delta
func GroupDate(pattern string) Group {
p := regexp.MustCompile(pattern)
return func(d Delta) Delta {
d.Date = p.FindString(d.Date)
return d
}
}
func GroupName(pattern string) Group {
p := regexp.MustCompile(pattern)
return func(d Delta) Delta {
d.Name = p.FindString(d.Name)
return d
}
}