Documentation
¶
Index ¶
- type CommonDataRow
- type CommonDataRowIterator
- type CommonDataTable
- type CommonTransactionDataRow
- type CommonTransactionDataRowIterator
- type CommonTransactionDataRowParser
- type CommonTransactionDataTable
- func (t *CommonTransactionDataTable) HasColumn(column TransactionDataTableColumn) bool
- func (t *CommonTransactionDataTable) HasOriginalColumn(columnName string) bool
- func (t *CommonTransactionDataTable) TransactionRowCount() int
- func (t *CommonTransactionDataTable) TransactionRowIterator() TransactionDataRowIterator
- type DataTableTransactionDataExporter
- type DataTableTransactionDataImporter
- type ImportedCommonDataRow
- type ImportedCommonDataRowIterator
- type ImportedCommonDataTable
- type ImportedDataRow
- type ImportedDataRowIterator
- type ImportedDataTable
- type ImportedTransactionDataRow
- type ImportedTransactionDataRowIterator
- type ImportedTransactionDataTable
- type TransactionDataRow
- type TransactionDataRowIterator
- type TransactionDataRowParser
- type TransactionDataTable
- type TransactionDataTableBuilder
- type TransactionDataTableColumn
- type WritableTransactionDataRow
- type WritableTransactionDataRowIterator
- type WritableTransactionDataTable
- func (t *WritableTransactionDataTable) Add(data map[TransactionDataTableColumn]string)
- func (t *WritableTransactionDataTable) Get(index int) (*WritableTransactionDataRow, error)
- func (t *WritableTransactionDataTable) HasColumn(column TransactionDataTableColumn) bool
- func (t *WritableTransactionDataTable) TransactionRowCount() int
- func (t *WritableTransactionDataTable) TransactionRowIterator() TransactionDataRowIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonDataRow ¶
type CommonDataRow interface {
// ColumnCount returns the total count of column in this data row
ColumnCount() int
// HasData returns whether the common data row has specified column data
HasData(columnName string) bool
// GetData returns the data in the specified column name
GetData(columnName string) string
}
CommonDataRow defines the structure of common data row
type CommonDataRowIterator ¶
type CommonDataRowIterator interface {
// HasNext returns whether the iterator does not reach the end
HasNext() bool
// CurrentRowId returns current row id
CurrentRowId() string
// Next returns the next common data row
Next() CommonDataRow
}
CommonDataRowIterator defines the structure of common data row iterator
type CommonDataTable ¶
type CommonDataTable interface {
// HeaderColumnCount returns the total count of column in header row
HeaderColumnCount() int
// HasColumn returns whether the common data table has specified column name
HasColumn(columnName string) bool
// DataRowCount returns the total count of common data row
DataRowCount() int
// DataRowIterator returns the iterator of common data row
DataRowIterator() CommonDataRowIterator
}
CommonDataTable defines the structure of common data table
type CommonTransactionDataRow ¶
type CommonTransactionDataRow struct {
// contains filtered or unexported fields
}
CommonTransactionDataRow defines the structure of common transaction data row
func (*CommonTransactionDataRow) GetData ¶
func (r *CommonTransactionDataRow) GetData(column TransactionDataTableColumn) string
GetData returns the data in the specified column type
func (*CommonTransactionDataRow) IsValid ¶
func (r *CommonTransactionDataRow) IsValid() bool
IsValid returns whether this row is valid data for importing
type CommonTransactionDataRowIterator ¶
type CommonTransactionDataRowIterator struct {
// contains filtered or unexported fields
}
CommonTransactionDataRowIterator defines the structure of common transaction data row iterator
func (*CommonTransactionDataRowIterator) HasNext ¶
func (t *CommonTransactionDataRowIterator) HasNext() bool
HasNext returns whether the iterator does not reach the end
func (*CommonTransactionDataRowIterator) Next ¶
func (t *CommonTransactionDataRowIterator) Next(ctx core.Context, user *models.User) (daraRow TransactionDataRow, err error)
Next returns the next transaction data row
type CommonTransactionDataRowParser ¶
type CommonTransactionDataRowParser interface {
// Parse returns the converted transaction data row
Parse(ctx core.Context, user *models.User, dataTable *CommonTransactionDataTable, dataRow CommonDataRow, rowId string) (rowData map[TransactionDataTableColumn]string, rowDataValid bool, err error)
}
CommonTransactionDataRowParser defines the structure of common transaction data row parser
type CommonTransactionDataTable ¶
type CommonTransactionDataTable struct {
// contains filtered or unexported fields
}
CommonTransactionDataTable defines the structure of common transaction data table
func CreateNewCommonTransactionDataTable ¶
func CreateNewCommonTransactionDataTable(dataTable CommonDataTable, supportedDataColumns map[TransactionDataTableColumn]bool, rowParser CommonTransactionDataRowParser) *CommonTransactionDataTable
CreateNewCommonTransactionDataTable returns transaction data table from Common data table
func (*CommonTransactionDataTable) HasColumn ¶
func (t *CommonTransactionDataTable) HasColumn(column TransactionDataTableColumn) bool
HasColumn returns whether the data table has specified column
func (*CommonTransactionDataTable) HasOriginalColumn ¶
func (t *CommonTransactionDataTable) HasOriginalColumn(columnName string) bool
HasOriginalColumn returns whether the original data table has specified column name
func (*CommonTransactionDataTable) TransactionRowCount ¶
func (t *CommonTransactionDataTable) TransactionRowCount() int
TransactionRowCount returns the total count of transaction data row
func (*CommonTransactionDataTable) TransactionRowIterator ¶
func (t *CommonTransactionDataTable) TransactionRowIterator() TransactionDataRowIterator
TransactionRowIterator returns the iterator of transaction data row
type DataTableTransactionDataExporter ¶
type DataTableTransactionDataExporter struct {
// contains filtered or unexported fields
}
DataTableTransactionDataExporter defines the structure of plain text data table exporter for transaction data
func CreateNewExporter ¶
func CreateNewExporter(transactionTypeMapping map[models.TransactionType]string, geoLocationSeparator string, transactionTagSeparator string) *DataTableTransactionDataExporter
CreateNewExporter returns a new data table transaction data exporter according to the specified arguments
func (*DataTableTransactionDataExporter) BuildExportedContent ¶
func (c *DataTableTransactionDataExporter) BuildExportedContent(ctx core.Context, dataTableBuilder TransactionDataTableBuilder, uid int64, transactions []*models.Transaction, accountMap map[int64]*models.Account, categoryMap map[int64]*models.TransactionCategory, tagMap map[int64]*models.TransactionTag, allTagIndexes map[int64][]int64) error
BuildExportedContent writes the exported transaction data to the data table builder
type DataTableTransactionDataImporter ¶
type DataTableTransactionDataImporter struct {
// contains filtered or unexported fields
}
DataTableTransactionDataImporter defines the structure of plain text data table importer for transaction data
func CreateNewImporter ¶
func CreateNewImporter(transactionTypeMapping map[models.TransactionType]string, geoLocationSeparator string, transactionTagSeparator string) *DataTableTransactionDataImporter
CreateNewImporter returns a new data table transaction data importer according to the specified arguments
func CreateNewSimpleImporter ¶
func CreateNewSimpleImporter(transactionTypeMapping map[models.TransactionType]string) *DataTableTransactionDataImporter
CreateNewSimpleImporter returns a new data table transaction data importer according to the specified arguments
func (*DataTableTransactionDataImporter) ParseImportedData ¶
func (c *DataTableTransactionDataImporter) ParseImportedData(ctx core.Context, user *models.User, dataTable TransactionDataTable, defaultTimezoneOffset int16, accountMap map[string]*models.Account, expenseCategoryMap map[string]*models.TransactionCategory, incomeCategoryMap map[string]*models.TransactionCategory, transferCategoryMap map[string]*models.TransactionCategory, tagMap map[string]*models.TransactionTag) (models.ImportedTransactionSlice, []*models.Account, []*models.TransactionCategory, []*models.TransactionCategory, []*models.TransactionCategory, []*models.TransactionTag, error)
ParseImportedData returns the imported transaction data
type ImportedCommonDataRow ¶
type ImportedCommonDataRow struct {
// contains filtered or unexported fields
}
ImportedCommonDataRow defines the structure of imported common data row
func (*ImportedCommonDataRow) ColumnCount ¶
func (r *ImportedCommonDataRow) ColumnCount() int
ColumnCount returns the total count of column in this data row
func (*ImportedCommonDataRow) GetData ¶
func (r *ImportedCommonDataRow) GetData(columnName string) string
GetData returns the data in the specified column name
func (*ImportedCommonDataRow) HasData ¶
func (r *ImportedCommonDataRow) HasData(columnName string) bool
HasData returns whether the common data row has specified column data
type ImportedCommonDataRowIterator ¶
type ImportedCommonDataRowIterator struct {
// contains filtered or unexported fields
}
ImportedCommonDataRowIterator defines the structure of imported common data row iterator
func (*ImportedCommonDataRowIterator) CurrentRowId ¶
func (t *ImportedCommonDataRowIterator) CurrentRowId() string
CurrentRowId returns current row id
func (*ImportedCommonDataRowIterator) HasNext ¶
func (t *ImportedCommonDataRowIterator) HasNext() bool
HasNext returns whether the iterator does not reach the end
func (*ImportedCommonDataRowIterator) Next ¶
func (t *ImportedCommonDataRowIterator) Next() CommonDataRow
Next returns the next common data row
type ImportedCommonDataTable ¶
type ImportedCommonDataTable struct {
// contains filtered or unexported fields
}
ImportedCommonDataTable defines the structure of imported common data table
func CreateNewImportedCommonDataTable ¶
func CreateNewImportedCommonDataTable(dataTable ImportedDataTable) *ImportedCommonDataTable
CreateNewImportedCommonDataTable returns common data table from imported data table
func (*ImportedCommonDataTable) DataRowCount ¶
func (t *ImportedCommonDataTable) DataRowCount() int
DataRowCount returns the total count of common data row
func (*ImportedCommonDataTable) DataRowIterator ¶
func (t *ImportedCommonDataTable) DataRowIterator() CommonDataRowIterator
DataRowIterator returns the iterator of common data row
func (*ImportedCommonDataTable) HasColumn ¶
func (t *ImportedCommonDataTable) HasColumn(columnName string) bool
HasColumn returns whether the data table has specified column name
func (*ImportedCommonDataTable) HeaderColumnCount ¶
func (t *ImportedCommonDataTable) HeaderColumnCount() int
HeaderColumnCount returns the total count of column in header row
type ImportedDataRow ¶
type ImportedDataRow interface {
// ColumnCount returns the total count of column in this data row
ColumnCount() int
// GetData returns the data in the specified column index
GetData(columnIndex int) string
}
ImportedDataRow defines the structure of imported data row
type ImportedDataRowIterator ¶
type ImportedDataRowIterator interface {
// HasNext returns whether the iterator does not reach the end
HasNext() bool
// CurrentRowId returns current row id
CurrentRowId() string
// Next returns the next imported data row
Next() ImportedDataRow
}
ImportedDataRowIterator defines the structure of imported data row iterator
type ImportedDataTable ¶
type ImportedDataTable interface {
// DataRowCount returns the total count of data row
DataRowCount() int
// HeaderColumnNames returns the header column name list
HeaderColumnNames() []string
// DataRowIterator returns the iterator of data row
DataRowIterator() ImportedDataRowIterator
}
ImportedDataTable defines the structure of imported data table
type ImportedTransactionDataRow ¶
type ImportedTransactionDataRow struct {
// contains filtered or unexported fields
}
ImportedTransactionDataRow defines the structure of imported transaction data row
func (*ImportedTransactionDataRow) GetData ¶
func (r *ImportedTransactionDataRow) GetData(column TransactionDataTableColumn) string
GetData returns the data in the specified column type
func (*ImportedTransactionDataRow) IsValid ¶
func (r *ImportedTransactionDataRow) IsValid() bool
IsValid returns whether this row is valid data for importing
type ImportedTransactionDataRowIterator ¶
type ImportedTransactionDataRowIterator struct {
// contains filtered or unexported fields
}
ImportedTransactionDataRowIterator defines the structure of imported transaction data row iterator
func (*ImportedTransactionDataRowIterator) HasNext ¶
func (t *ImportedTransactionDataRowIterator) HasNext() bool
HasNext returns whether the iterator does not reach the end
func (*ImportedTransactionDataRowIterator) Next ¶
func (t *ImportedTransactionDataRowIterator) Next(ctx core.Context, user *models.User) (daraRow TransactionDataRow, err error)
Next returns the next transaction data row
type ImportedTransactionDataTable ¶
type ImportedTransactionDataTable struct {
// contains filtered or unexported fields
}
ImportedTransactionDataTable defines the structure of imported transaction data table
func CreateNewImportedTransactionDataTable ¶
func CreateNewImportedTransactionDataTable(dataTable ImportedDataTable, dataColumnMapping map[TransactionDataTableColumn]string) *ImportedTransactionDataTable
CreateNewImportedTransactionDataTable returns transaction data table from imported data table
func CreateNewImportedTransactionDataTableWithRowParser ¶
func CreateNewImportedTransactionDataTableWithRowParser(dataTable ImportedDataTable, dataColumnMapping map[TransactionDataTableColumn]string, rowParser TransactionDataRowParser) *ImportedTransactionDataTable
CreateNewImportedTransactionDataTableWithRowParser returns transaction data table from imported data table
func (*ImportedTransactionDataTable) HasColumn ¶
func (t *ImportedTransactionDataTable) HasColumn(column TransactionDataTableColumn) bool
HasColumn returns whether the data table has specified column
func (*ImportedTransactionDataTable) TransactionRowCount ¶
func (t *ImportedTransactionDataTable) TransactionRowCount() int
TransactionRowCount returns the total count of transaction data row
func (*ImportedTransactionDataTable) TransactionRowIterator ¶
func (t *ImportedTransactionDataTable) TransactionRowIterator() TransactionDataRowIterator
TransactionRowIterator returns the iterator of transaction data row
type TransactionDataRow ¶
type TransactionDataRow interface {
// IsValid returns whether this row is valid data for importing
IsValid() bool
// GetData returns the data in the specified column type
GetData(column TransactionDataTableColumn) string
}
TransactionDataRow defines the structure of transaction data row
type TransactionDataRowIterator ¶
type TransactionDataRowIterator interface {
// HasNext returns whether the iterator does not reach the end
HasNext() bool
// Next returns the next transaction data row
Next(ctx core.Context, user *models.User) (daraRow TransactionDataRow, err error)
}
TransactionDataRowIterator defines the structure of transaction data row iterator
type TransactionDataRowParser ¶
type TransactionDataRowParser interface {
// GetAddedColumns returns the added columns after converting the data row
GetAddedColumns() []TransactionDataTableColumn
// Parse returns the converted transaction data row
Parse(data map[TransactionDataTableColumn]string) (rowData map[TransactionDataTableColumn]string, rowDataValid bool, err error)
}
TransactionDataRowParser defines the structure of transaction data row parser
type TransactionDataTable ¶
type TransactionDataTable interface {
// HasColumn returns whether the transaction data table has specified column
HasColumn(column TransactionDataTableColumn) bool
// TransactionRowCount returns the total count of transaction data row
TransactionRowCount() int
// TransactionRowIterator returns the iterator of transaction data row
TransactionRowIterator() TransactionDataRowIterator
}
TransactionDataTable defines the structure of transaction data table
type TransactionDataTableBuilder ¶
type TransactionDataTableBuilder interface {
// AppendTransaction appends the specified transaction to data builder
AppendTransaction(data map[TransactionDataTableColumn]string)
// ReplaceDelimiters returns the text after removing the delimiters
ReplaceDelimiters(text string) string
}
TransactionDataTableBuilder defines the structure of data table builder
type TransactionDataTableColumn ¶
type TransactionDataTableColumn byte
TransactionDataTableColumn represents the data column type of data table
const ( TRANSACTION_DATA_TABLE_TRANSACTION_TIME TransactionDataTableColumn = 1 TRANSACTION_DATA_TABLE_TRANSACTION_TIMEZONE TransactionDataTableColumn = 2 TRANSACTION_DATA_TABLE_TRANSACTION_TYPE TransactionDataTableColumn = 3 TRANSACTION_DATA_TABLE_CATEGORY TransactionDataTableColumn = 4 TRANSACTION_DATA_TABLE_SUB_CATEGORY TransactionDataTableColumn = 5 TRANSACTION_DATA_TABLE_ACCOUNT_NAME TransactionDataTableColumn = 6 TRANSACTION_DATA_TABLE_ACCOUNT_CURRENCY TransactionDataTableColumn = 7 TRANSACTION_DATA_TABLE_AMOUNT TransactionDataTableColumn = 8 TRANSACTION_DATA_TABLE_RELATED_ACCOUNT_NAME TransactionDataTableColumn = 9 TRANSACTION_DATA_TABLE_RELATED_ACCOUNT_CURRENCY TransactionDataTableColumn = 10 TRANSACTION_DATA_TABLE_RELATED_AMOUNT TransactionDataTableColumn = 11 TRANSACTION_DATA_TABLE_GEOGRAPHIC_LOCATION TransactionDataTableColumn = 12 TRANSACTION_DATA_TABLE_TAGS TransactionDataTableColumn = 13 TRANSACTION_DATA_TABLE_DESCRIPTION TransactionDataTableColumn = 14 )
Transaction data table columns
type WritableTransactionDataRow ¶
type WritableTransactionDataRow struct {
// contains filtered or unexported fields
}
WritableTransactionDataRow defines the structure of transaction data row of writable data table
func (*WritableTransactionDataRow) ColumnCount ¶
func (r *WritableTransactionDataRow) ColumnCount() int
ColumnCount returns the total count of column in this data row
func (*WritableTransactionDataRow) GetData ¶
func (r *WritableTransactionDataRow) GetData(column TransactionDataTableColumn) string
GetData returns the data in the specified column type
func (*WritableTransactionDataRow) IsValid ¶
func (r *WritableTransactionDataRow) IsValid() bool
IsValid returns whether this row is valid data for importing
type WritableTransactionDataRowIterator ¶
type WritableTransactionDataRowIterator struct {
// contains filtered or unexported fields
}
WritableTransactionDataRowIterator defines the structure of transaction data row iterator of writable data table
func (*WritableTransactionDataRowIterator) HasNext ¶
func (t *WritableTransactionDataRowIterator) HasNext() bool
HasNext returns whether the iterator does not reach the end
func (*WritableTransactionDataRowIterator) Next ¶
func (t *WritableTransactionDataRowIterator) Next(ctx core.Context, user *models.User) (daraRow TransactionDataRow, err error)
Next returns the next transaction data row
type WritableTransactionDataTable ¶
type WritableTransactionDataTable struct {
// contains filtered or unexported fields
}
WritableTransactionDataTable defines the structure of writable transaction data table
func CreateNewWritableTransactionDataTable ¶
func CreateNewWritableTransactionDataTable(columns []TransactionDataTableColumn) *WritableTransactionDataTable
CreateNewWritableTransactionDataTable returns a new writable transaction data table according to the specified columns
func CreateNewWritableTransactionDataTableWithRowParser ¶
func CreateNewWritableTransactionDataTableWithRowParser(columns []TransactionDataTableColumn, rowParser TransactionDataRowParser) *WritableTransactionDataTable
CreateNewWritableTransactionDataTableWithRowParser returns a new writable transaction data table according to the specified columns
func (*WritableTransactionDataTable) Add ¶
func (t *WritableTransactionDataTable) Add(data map[TransactionDataTableColumn]string)
Add appends a new record to data table
func (*WritableTransactionDataTable) Get ¶
func (t *WritableTransactionDataTable) Get(index int) (*WritableTransactionDataRow, error)
Get returns the record in the specified index
func (*WritableTransactionDataTable) HasColumn ¶
func (t *WritableTransactionDataTable) HasColumn(column TransactionDataTableColumn) bool
HasColumn returns whether the data table has specified column
func (*WritableTransactionDataTable) TransactionRowCount ¶
func (t *WritableTransactionDataTable) TransactionRowCount() int
TransactionRowCount returns the total count of transaction data row
func (*WritableTransactionDataTable) TransactionRowIterator ¶
func (t *WritableTransactionDataTable) TransactionRowIterator() TransactionDataRowIterator
TransactionRowIterator returns the iterator of transaction data row