gen

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AssetsCurrencyCodesFile = "currency_codes.xml"
	AssetsCurrencyNamesFile = "currency_names.json"
	CurrencyGenFileName     = "currency"
	SymbolGenFileName       = "symbol"
	CountryGenFileName      = "country"
	NameGenFileName         = "name"
	FuncGenFileName         = "func"
)
View Source
const SuffixGenFileName = "_gen.go"

Variables

View Source
var ErrHashingContentEqual = errors.New("hash of the generated file is equivalent to the previous version")

Functions

func Funcs

func Funcs() template.FuncMap

func Generate

func Generate(pathTo string, hasherFunc func() hash.Hash) error

func ReadAssets

func ReadAssets(path string) func(AssetsMapFunc) error

func Template

func Template() *template.Template

Types

type AssetsMapFunc

type AssetsMapFunc func(b []byte, filename string) error

type Ccy

type Ccy struct {
	Number       int
	MinRateUnits int
	Name         string
	Symbol       string
	Sign         string
}

type CurrencyCodes

type CurrencyCodes struct {
	CcyTbl struct {
		CcyEntries []struct {
			CtryNm     string `xml:"CtryNm"`
			CcyNm      string `xml:"CcyNm"`
			Ccy        string `xml:"Ccy"`
			CcyNbr     int    `xml:"CcyNbr"`
			CcyMnrUnts string `xml:"CcyMnrUnts"`
		} `xml:"CcyNtry"`
	} `xml:"CcyTbl"`
}

type CurrencyNames

type CurrencyNames struct {
	Main struct {
		EnVersion struct {
			Identity struct {
				Version struct {
					ClDRVersion string `json:"_cldrVersion"`
				} `json:"version"`
				Language  string `json:"language"`
				Territory string `json:"territory"`
			} `json:"identity"`
			Numbers struct {
				Currencies map[string]struct {
					DisplayName string `json:"displayName"`
					Symbol      string `json:"symbol"`
					Sign        string `json:"symbol-alt-narrow"`
				} `json:"currencies"`
			} `json:"numbers"`
		} `json:"en-001"`
	} `json:"main"`
}

Jump to

Keyboard shortcuts

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