.src.ledger.Delta.transaction = filename/idx
All checks were successful
cicd / ci (push) Successful in 1m27s
All checks were successful
cicd / ci (push) Successful in 1m27s
This commit is contained in:
@@ -16,6 +16,7 @@ type transaction struct {
|
||||
description string
|
||||
payee string
|
||||
recipients []transactionRecipient
|
||||
name string
|
||||
}
|
||||
|
||||
func (t transaction) empty() bool {
|
||||
@@ -59,7 +60,8 @@ func (files Files) _transactions(file string) ([]transaction, error) {
|
||||
|
||||
result := make([]transaction, 0)
|
||||
for {
|
||||
one, err := readTransaction(r)
|
||||
name := fmt.Sprintf("%s/%d", file, len(result))
|
||||
one, err := readTransaction(name, r)
|
||||
if !one.empty() {
|
||||
result = append(result, one)
|
||||
}
|
||||
@@ -72,8 +74,8 @@ func (files Files) _transactions(file string) ([]transaction, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func readTransaction(r *bufio.Reader) (transaction, error) {
|
||||
result, err := _readTransaction(r)
|
||||
func readTransaction(name string, r *bufio.Reader) (transaction, error) {
|
||||
result, err := _readTransaction(name, r)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
@@ -89,7 +91,7 @@ func readTransaction(r *bufio.Reader) (transaction, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func _readTransaction(r *bufio.Reader) (transaction, error) {
|
||||
func _readTransaction(name string, r *bufio.Reader) (transaction, error) {
|
||||
readTransactionLeadingWhitespace(r)
|
||||
|
||||
firstLine, err := readTransactionLine(r)
|
||||
@@ -107,6 +109,7 @@ func _readTransaction(r *bufio.Reader) (transaction, error) {
|
||||
result := transaction{
|
||||
date: string(dateDescriptionMatches[0][1]),
|
||||
description: string(dateDescriptionMatches[0][2]),
|
||||
name: name,
|
||||
}
|
||||
|
||||
for {
|
||||
|
||||
Reference in New Issue
Block a user