You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
538 B
38 lines
538 B
3 years ago
|
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]
|
||
|
}
|