package main import ( "time" "github.com/aclindsa/ofxgo" ) var transactionTemplate = ` {{ range . }} {{ .Date.Format "2006-01-02" }} {{ .VendorName }} {{ .Asset }} ${{ .TrnAmt }} {{ .Vendor }} {{ end }} ` type transaction struct { Date time.Time TrnAmt ofxgo.Amount Asset string Vendor string VendorName string } type byDate []transaction func (b byDate) Len() int { return len(b) } func (b byDate) Less(i, j int) bool { return b[i].Date.Before(b[j].Date) } func (b byDate) Swap(i, j int) { b[i], b[j] = b[j], b[i] }