mockData

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

README

mockData

mockData provides deterministic mock reference datasets for testing — countries, currencies, rate ladders, titles, genders, and biological sexes.

Types

Type Description
Country Country info: IBANLength, Currency, ISOCode, ISOCode3
Currency Currency info: Code, SpotDays, Name, Character, DPS, QuoteDPS, Type, MajorUnit, MinorUnit, and more
BiologicalSex Biological sex entry: Name, Description
Gender Gender entry: Name, Description
Title Title string value
Rung Rate ladder rung: Code, Name, Alternative, Index

Constants

Constant Description
Fiat Fiat currency type
Crypto Cryptocurrency type
Metals Precious metals type
Testing Testing/mock currency type

Variables

Variable Description
Countries Map of country data keyed by ISO code
Currencies Map of currency data keyed by currency code
BiologicalSexes Map of biological sex entries
Genders Map of gender entries
Titles Map of title entries
Ladder Map of rate ladder rungs
LadderSize Number of rungs in the rate ladder

Functions

Countries
Function Description
GetCountryInfo(code string) (Country, error) Lookup by 2 or 3-letter ISO code
Currencies
Function Description
GetCurrency(code string) (Currency, error) Lookup by currency code
(*Currency).Age() int Returns years since the currency's introduction
Biology
Function Description
GetBiologyList() []string List all biology keys
GetBiologyInfo(string) BiologicalSex Lookup a biology entry
IsValidBiology(string) bool Validate a biology key
Genders
Function Description
GetGenderList() []string List all gender keys
IsValidGender(string) bool Validate a gender key
Titles
Function Description
GetList() []string List all title keys
IsValidTitle(string) bool Validate a title key
Rate Ladder
Function Description
GetRateLadderList() []string List all tenor codes
IsValidPeriod(string) bool Validate a tenor code
GetRateLadderByIndex(int) Rung Get a ladder rung by index
LadderToString(map[string]Rung) string Serialize the ladder to a string
GetTenorInfo(string) (Rung, error) Lookup tenor rung info

Example

import "github.com/mt1976/frantic-core/mockData"

func main() {
    gbp, _ := mockData.GetCurrency("GBP")
    fmt.Println(gbp.Name, gbp.Character) // "Pound Sterling" "£"

    uk, _ := mockData.GetCountryInfo("GB")
    fmt.Println(uk.Currency) // "GBP"
}

Documentation

Overview

Package mockData provides deterministic mock datasets for tests and examples.

Index

Constants

View Source
const (
	Fiat    = "Fiat"
	Crypto  = "Crypto"
	Metals  = "Psuedo"
	Testing = "Testing"
)

Variables

View Source
var BiologicalSexes map[string]BiologicalSex
View Source
var Countries map[string]Country
View Source
var Currencies map[string]Currency
View Source
var Genders map[string]Gender
View Source
var Ladder map[string]Rung
View Source
var LadderSize int
View Source
var Titles map[string]Title

Functions

func GetBiologyList

func GetBiologyList() []string

func GetGenderList

func GetGenderList() []string

func GetList

func GetList() []string

func GetRateLadderList

func GetRateLadderList() []string

func IsValidBiology

func IsValidBiology(biology string) bool

func IsValidGender

func IsValidGender(in string) bool

func IsValidPeriod

func IsValidPeriod(in string) bool

func IsValidTitle

func IsValidTitle(in string) bool

func LadderToString

func LadderToString(R map[string]Rung) string

Types

type BiologicalSex

type BiologicalSex struct {
	Name        string
	Description string
}

BiologicalSex represents information of an indivual biology.

func GetBiologyInfo

func GetBiologyInfo(biology string) BiologicalSex

type Country

type Country struct {
	IBANLength int    // The expected length of the IBAN for the country.
	Currency   string // The currency code for the country.
	ISOCode    string // The ISO country code
	ISOCode3   string // The ISO country code
}

Country represents information about the IBAN format for a specific country.

func GetCountryInfo

func GetCountryInfo(countryCode string) (Country, error)

type Currency

type Currency struct {
	Code               string // The ISO currency code
	SpotDays           int    // The number of spot days for the currency
	Name               string // The name of the currency
	Character          string // The character of the currency
	DPS                int    // The number of decimal places for the currency
	QuoteDPS           int    // The number of decimal places for the currency when quoting
	Type               string // The type of currency
	MajorUnit          string // The major unit of the currency
	MinorUnit          string // The minor unit of the currency
	MinorCharacter     string // The minor character of the currency
	ISONumericCode     string // The ISO numeric code of the currency
	KnownAs            string // The known as name of the currency
	YearOfIntroduction int    // The year the currency was introduced
}

Currency represents information about the IBAN format for a specific country.

func GetCurrency

func GetCurrency(code string) (Currency, error)

func (*Currency) Age

func (C *Currency) Age() int

type Gender

type Gender struct {
	Name        string
	Description string
}

type Indexer

type Indexer struct {
	Index int
}

type Rung

type Rung struct {
	Code        string
	Name        string
	Alternative string
	Index       int
}

func GetRateLadderByIndex

func GetRateLadderByIndex(index int) Rung

func GetTenorInfo

func GetTenorInfo(tenor string) (Rung, error)

type Title

type Title struct {
	Title string // The title
}

Title represents information of an indivual title.

Jump to

Keyboard shortcuts

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