qif

package
v0.0.0-...-ef54b48 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package qif contains functions to parse transaction data presented in the QIF format.

Index

Constants

This section is empty.

Variables

View Source
var ErrEOF = errors.New("QIF end of file")

ErrEOF is a condition used to signal that the parser reached the end of a QIF file.

Functions

func ParseDate

func ParseDate(d string) (time.Time, error)

ParseDate parses date strings in the QIF format used by Microsoft Money 2000, which is dd/mm'yyyy or dd/mm/yyyy for pre-2000 dates.

Types

type ErrNotSupported

type ErrNotSupported struct {
	Desc string
}

ErrNotSupported is returned if a QIF field type is encountered that this parser doesn't support.

func (*ErrNotSupported) Error

func (e *ErrNotSupported) Error() string

type QIF

type QIF struct {
	// contains filtered or unexported fields
}

QIF contains the scan state for a set of records in QIF format.

func New

func New(qifData io.Reader, dec *encoding.Decoder) *QIF

New returns a QIF scanner for QIF data to be read from the given io.Reader.

func (*QIF) Next

func (q *QIF) Next() (*Record, error)

Next is an iterator function that returns the next Record scanned from the QIF file.

type Record

type Record struct {
	Type     string
	Date     string
	Amount   string
	Number   string
	Cleared  string
	Payee    string
	Label    string
	Memo     string
	Splits   []*Split
	Transfer bool
}

Record groups the QIF attributes for a single transaction read in QIF format.

func (*Record) String

func (r *Record) String() string

String conforms with Stringer for Records.

type RecordSet

type RecordSet struct {
	Opening *Record
	Records []*Record
}

RecordSet is a group of QIF Records, with the opening Record separated.

func NewRecordSet

func NewRecordSet(r io.Reader, dec *encoding.Decoder) (*RecordSet, error)

NewRecordSet returns a RecordSet for QIF records read from the given io.Reader. Character set conversion from input to UTF-8 is performed by dec.

func (*RecordSet) AccountName

func (rs *RecordSet) AccountName() string

AccountName returns the name of the account described by the opening record of the RecordSet.

type Split

type Split struct {
	Category string
	Memo     string
	Amount   string
	Percent  string // exists in QIF spec but not supported yet.
}

Split represents a single sub-transaction in a QIF Record that has >1 split.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL