1
0
mirror of https://github.com/aclindsa/ofxgo.git synced 2025-07-01 19:58:37 -04:00

Make optional struct fields pointers

This allows encoding/xml to properly comparison against nil to see if
they should be marshalled if the 'xml' tag contains ",omitempty" and for
users to test against nil to see if a field was present in the parsed
OFX.

This commit also fixes up cmd/ofx to use the new pointers.
This commit is contained in:
2017-03-29 05:31:01 -04:00
parent 119c01f99b
commit 1d8ba5c19a
11 changed files with 130 additions and 150 deletions

View File

@ -5,7 +5,6 @@ import (
"fmt"
"github.com/aclindsa/ofxgo"
"os"
"time"
)
var bankTransactionsCommand = Command{
@ -39,8 +38,6 @@ func bankTransactions() {
AcctId: ofxgo.String(acctId),
AcctType: ofxgo.String(acctType),
},
DtStart: ofxgo.Date(time.Now().AddDate(-1, 0, 0)),
DtEnd: ofxgo.Date(time.Now()),
Include: true,
}
query.Banking = append(query.Banking, &statementRequest)
@ -82,7 +79,7 @@ func printTransaction(defCurrency ofxgo.String, tran *ofxgo.Transaction) {
var name string
if len(tran.Name) > 0 {
name = string(tran.Name)
} else {
} else if tran.Payee != nil {
name = string(tran.Payee.Name)
}