n43

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: MIT Imports: 7 Imported by: 0

README

Repo metadata

GitHub tag License

Call-to-Action buttons

ko-fi

Documentation

The N43 library parser is really simple, just load the lines from the N43 file into a new parser and parse it. After that, you'll have a nice structure with all the needed data accessible.

package main

import (
    "os"
    "log"
    "string"

    "github.com/Xumeiquer/n43"
)

func main() {
    data, err := os.ReadFile(fin)
    if err != nil {
        log.Fatal(err.Error())
    }

    dataLines := strings.Split(string(data), "\n")
    parser := n43.NewParser(dataLines, ops)
    res, err := parser.Parse()
    if err != nil {
        log.Fatal(err.Error())
    }

    printOutput(*res)
}

License

Released under MIT by @Xumeiquer.

Documentation

Index

Constants

View Source
const (
	HEADER_LINE              LineType = 11
	MOVEMENT_LINE            LineType = 22
	MOVEMENT_EXTRA_INFO_LINE LineType = 23
	FOOTER_LINE              LineType = 33
	END_OF_FILE_LINE         LineType = 88

	SPANISH_DATE TimeFormat = "DMY"
	ENGLISH_DATE TimeFormat = "YMD"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Header    *Header
	Movements []*Movement
	Footer    *Footer
}
type Footer struct {
	BankCode      string
	BranchCode    string
	AccountNumber string
	DebitEntries  int
	DebitAmount   float64
	CreditEntries int
	CreditAmount  float64
	FinalBalance  float64
	Currency      string
}
type Header struct {
	BankCode            string
	BranchCode          string
	AccountNumber       string
	StartDate           time.Time
	EndDate             time.Time
	InitialBalance      float64
	Currency            string
	InformationModeCode string
	AccountName         string
}

type LineType

type LineType int

type Movement

type Movement struct {
	BranchCode       string
	TransactionDate  time.Time
	ValueDate        time.Time
	Amount           float64
	Balance          float64
	Description      string
	ExtraInformation []string
}

type Norma43

type Norma43 struct {
	Accounts        []*Account
	ReportedEntries int
}

type Parser

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

func NewParser

func NewParser(lines []string, parserOptions *ParserOptions) *Parser

func NewParserReader

func NewParserReader(r io.Reader, parserOptions *ParserOptions) *Parser

func (*Parser) Parse

func (p *Parser) Parse() (*Norma43, error)

type ParserOptions

type ParserOptions struct {
	Trim           bool
	TimeFormat     TimeFormat
	FilterPositive bool
	FilterNegative bool
	FilterLineIn   string

	FilterLineOut string
	// contains filtered or unexported fields
}

type TimeFormat

type TimeFormat string

func (*TimeFormat) Set

func (tf *TimeFormat) Set(val string) error

func (*TimeFormat) String

func (tf *TimeFormat) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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