util

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const CNB_DAY_URL string = "https://www.cnb.cz/cs/financni-trhy/devizovy-trh/kurzy-devizoveho-trhu/kurzy-devizoveho-trhu/denni_kurz.txt?date="
View Source
const CZECH_PUBLIC_HOLIDAY_URL string = "https://svatky.vanio.cz/api/"
View Source
const DATE_FORMAT_FOR_CNB_DAY string = "02.01.2006" // DD.MM.YYYY

https://www.cnb.cz/cs/casto-kladene-dotazy/Kurzy-devizoveho-trhu-na-www-strankach-CNB/

View Source
const DATE_FORMAT_FOR_PUBLIC_HOLIDAY string = "2006-01-02" // YYYY-MM-DD

https://github.com/vaniocz/svatky-vanio-cz

View Source
const MFCR_CZK_EXCHANGE_RATE_IN_YEARS string = `` /* 3363-byte string literal not displayed */

https://www.kodap.cz/cs/pro-vas/prehledy/jednotny-kurz/jednotne-kurzy-men-stanovene-ministerstvem-financi-prehled.html formatted into same format as CNB files https://www.cnb.cz/cs/casto-kladene-dotazy/Kurzy-devizoveho-trhu-na-www-strankach-CNB/

Variables

This section is empty.

Functions

func EqWithTolerance added in v0.1.0

func EqWithTolerance(a, b, tolerance float64) bool

func GetColumnLetter

func GetColumnLetter(colIndex int) string

func GetCzkExchangeRateInDay

func GetCzkExchangeRateInDay(date time.Time, currency Currency) (float64, error)

func GetCzkExchangeRateInYear

func GetCzkExchangeRateInYear(date time.Time, currency Currency) (float64, error)

func GetDateThreeYearsBefore

func GetDateThreeYearsBefore(date time.Time) time.Time

func GetExcelCoords

func GetExcelCoords(rowIndex, colIndex int) string

input params are 0-based

func GetIntPointer added in v0.2.0

func GetIntPointer(value int) *int

func GetYearFromString

func GetYearFromString(yearString string) (int, error)

func IsRowEmpty

func IsRowEmpty(row []string, nameColIndex int) bool

func LeqWithTolerance added in v0.1.0

func LeqWithTolerance(a, b, tolerance float64) bool

func ValidateTableHeader

func ValidateTableHeader(row []string, legend map[string]int) (err error)

Types

type Currency

type Currency struct {
	Name   string
	Symbol string
}
var (
	EUR                 *Currency   = &Currency{Name: "EUR", Symbol: "€"}
	USD                 *Currency   = &Currency{Name: "USD", Symbol: "$"}
	CZK                 *Currency   = &Currency{Name: "CZK", Symbol: "Kč"}
	SupportedCurrencies []*Currency = []*Currency{EUR, USD, CZK}
)

func GetCurrencyByName

func GetCurrencyByName(name string) (*Currency, error)

func (Currency) String

func (c Currency) String() string

type ExcelWriter

type ExcelWriter struct {
	File *excelize.File
	// contains filtered or unexported fields
}

func NewExcelWriter

func NewExcelWriter() *ExcelWriter

func (ExcelWriter) WriteAccountingCell

func (w ExcelWriter) WriteAccountingCell(sheet string, row, col int, value float64, currency *Currency) (coords string)

func (ExcelWriter) WriteAccountingEqCell

func (w ExcelWriter) WriteAccountingEqCell(sheet string, row, col int, equation string, currency *Currency) (coords string)

func (ExcelWriter) WriteCell

func (w ExcelWriter) WriteCell(sheet string, row, col int, value interface{}) (coords string)

func (ExcelWriter) WriteDateCell

func (w ExcelWriter) WriteDateCell(sheet string, row, col int, date time.Time) (coords string)

func (ExcelWriter) WriteFloatNumberCell

func (w ExcelWriter) WriteFloatNumberCell(sheet string, row, col int, value float64) (coords string)

type ExchangeRate

type ExchangeRate struct {
	FromCurrency  *Currency
	ToCurrency    *Currency
	RateInYearMap map[string]float64
}

Jump to

Keyboard shortcuts

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