Data tables

Star information, stem and branch information, ordering constants and all the key constants.

The input tables of the charting algorithm, plus the language-independent key constants.


StarsInfo

Purpose Get the star information table.

Signature

func StarsInfo() (map[string]StarInfo, error)

Return value Star key → StarInfo. Only twenty stars have an entry: the fourteen major stars plus Wenchang, Wenqu, Huoxing, Lingxing, Qingyang and Tuoluo.

FieldTypeDescription
Brightness[]stringBrightness keys across the twelve palaces, index 0 being the Yin palace; an empty string where the palace has no brightness
FiveElementsstringFive element; an empty string when the table leaves it blank
YinYangstringPolarity; an empty string when the table leaves it blank

Example

info, _ := iztro.StarsInfo()

fmt.Println(len(info))
fmt.Printf("%+v\n", info[iztro.StarZiweiMaj])
fmt.Printf("%q\n", info[iztro.StarTaiyangMaj].FiveElements)

Output

20
{Brightness:[wang wang de wang miao miao wang wang de wang ping miao] FiveElements:土 YinYang:阴}
""

Edge cases and pitfalls

Five elements and polarity have gaps

Some stars have no five element or polarity in the table: both are empty for Taiyang and Qisha, polarity is empty for Tanlang, Tianxiang, Tianliang and Pojun, and both are empty for the six minor stars.

Note also that FiveElements and YinYang are never internationalized — they are always the Chinese characters (, and so on) in every output language.


FlowStarCounterparts

Purpose The full table mapping flowing stars to their natal minor-star counterparts (50 entries).

Signature

func FlowStarCounterparts() (map[string]string, error)

Return value Keys are flowing-star key constant values (StarLiuchang and friends), values natal minor-star keys (StarWenchangMin and friends). Flowing stars have no knowledge-pack entries of their own — their readings are looked up via the natal counterpart, and this table is the official mapping.

Example

m, _ := iztro.FlowStarCounterparts()

fmt.Println(m["liuchang"])

Output

wenchangMin

HeavenlyStems

Purpose Get the heavenly stem information table.

Zi Wei meaning The mutagen table of the stems is the root of the whole mutagen system: the birth-year stem determines the natal mutagens, a palace stem determines what that palace flies, and a scope stem determines that layer's mutagens.

Signature

func HeavenlyStems() (map[string]HeavenlyStemInfo, error)

Return value Stem key → HeavenlyStemInfo:

FieldTypeDescription
YinYangstringPolarity
FiveElementsstringFive element
CrashstringClashing stem key; an empty string for wu and ji, which clash with nothing
Mutagen[]stringThe four mutagen star keys, in the order lu, quan, ke, ji

Example

stems, _ := iztro.HeavenlyStems()

fmt.Printf("%+v\n", stems[iztro.StemJia])
fmt.Printf("wu clashes with: %q\n", stems[iztro.StemWu].Crash)

Output

{YinYang:阳 FiveElements:木 Crash:gengHeavenly Mutagen:[lianzhenMaj pojunMaj wuquMaj taiyangMaj]}
wu clashes with: ""

EarthlyBranches

Purpose Get the earthly branch information table.

Signature

func EarthlyBranches() (map[string]EarthlyBranchInfo, error)

Return value Branch key → EarthlyBranchInfo:

FieldTypeDescription
YinYangstringPolarity, which sets the direction of the decadal scope and the Changsheng gods
FiveElementsstringFive element
CrashstringClashing branch key
SoulstringSoul star key (looked up by the Soul palace branch)
BodystringBody star key (looked up by the birth-year branch)
InsidestringCorresponding internal organ
OutsidestringCorresponding body part
HealthTipstringHealth note

Inside, Outside and HealthTip exist only in Chinese and take no part in internationalization.

Example

branches, _ := iztro.EarthlyBranches()
fmt.Printf("%+v\n", branches[iztro.BranchZi])

Output

{YinYang:阳 FiveElements:水 Crash:wuEarthly Soul:tanlangMaj Body:huoxingMin Inside:胆 Outside:下体 HealthTip:生殖系统、膀胱、尿道之疾病,听觉障碍}

GetConstants

Purpose Get the ordering constants and derivation rule tables.

Signature

func GetConstants() (Constants, error)

Return value Constants:

FieldTypeDescription
Languages[]stringSupported language codes
HeavenlyStems[]stringStem order
EarthlyBranches[]stringBranch order
Zodiac[]stringChinese zodiac keys, in branch order
Signs[]stringZodiac sign keys, in ecliptic order
Palaces[]stringThe twelve palace names running counterclockwise from the Soul palace: Soul, Parents, Spirit, Property, Career, Friends, Surface, Health, Wealth, Children, Spouse, Siblings
Gendermap[string]stringThe polarity of each gender
ChineseTime[]stringHour keys, from the early Zi hour to the late Zi hour
TimeRange[]stringThe clock range of each hour
TigerRulemap[string]stringFive Tigers rule: year stem to first-month stem
RatRulemap[string]stringFive Rats rule: day stem to Zi-hour stem
Mutagen[]stringMutagen order
FiveElementsClassmap[string]intFive elements class key → its number (water 2nd is 2 … fire 6th is 6)

Example

c, _ := iztro.GetConstants()

fmt.Println(c.Languages)
fmt.Println(c.Zodiac[:3], c.ChineseTime[12], c.TimeRange[2])
fmt.Println(c.Gender)
fmt.Println("first-month stem of a jia year:", c.TigerRule[iztro.StemJia])
fmt.Println(c.Palaces)
fmt.Println(c.FiveElementsClass[iztro.ClassWood3rd], iztro.FiveElementsClassNumber(iztro.ClassFire6th))

Output

[en-US ja-JP ko-KR zh-CN zh-TW vi-VN]
[rat ox tiger] lateRatHour 03:00~05:00
map[female:阴 male:阳]
first-month stem of a jia year: bingHeavenly
[soulPalace parentsPalace spiritPalace propertyPalace careerPalace friendsPalace surfacePalace healthPalace wealthPalace childrenPalace spousePalace siblingsPalace]
3 6

Edge cases and pitfalls

Palaces is a counterclockwise ordering, not a position on a chart

Palaces gives the ordering of the palace names, not what cell i is called on a particular chart. For that use GetPalaceNames(soulIndex).

The class number can be looked up directly

FiveElementsClassNumber(key) does not need Constants first; an unknown key gives 0.

The order of Languages is the merge order of iztro's vocabularies (starting from en-US), not the declaration order of the constants. KeyOf scans the languages in that same order.


Key constants

The key constants in the package have the language-independent keys as their values and compare directly against the *Key fields on the data objects.

PrefixCountExamples
Palace*12 + 2PalaceSoul, PalaceWealth, PalaceBody, PalaceOriginal
Star*162StarZiweiMaj, StarLucunMin, StarYunlu
Stem*10StemJia, StemGeng
Branch*12BranchZi, BranchWu
Mutagen*4MutagenLu, MutagenJi
Brightness*7BrightnessMiao, BrightnessWang
Class*5ClassWater2nd, ClassWood3rd, ClassMetal4th, ClassEarth5th, ClassFire6th
Scope*6ScopeOrigin, ScopeDecadal
StarType*8StarTypeMajor, StarTypeTough
Gender*2GenderMale, GenderFemale (type Gender)
Language*6LanguageZhCN, LanguageZhTW, LanguageEnUS, LanguageJaJP, LanguageKoKR, LanguageViVN (type Language)
*LeapMonth*3NotLeapMonth, LeapMonthKeep, LeapMonthFixed (type LeapMonth, how ByLunar treats the leap month)

Gender, Language and LeapMonth are named string types: as entry-point parameters the compiler rejects any other string passed by mistake, while literals ("male", "zh-CN") still work; Astrolabe.GenderKey and Astrolabe.Language are of these types too. The remaining constants are untyped string constants that compare directly with the *Key fields.

The configuration values add six more groups:

PrefixValues
YearDivide*YearDivideNormal / YearDivideExact
HoroscopeDivide*HoroscopeDivideNormal / HoroscopeDivideExact
AgeDivide*AgeDivideNormal / AgeDivideBirthday
DayDivide*DayDivideForward / DayDivideCurrent
Algorithm*AlgorithmDefault / AlgorithmZhongzhou
Astro*AstroHeaven / AstroEarth / AstroHuman

The five elements class constants are prefixed Class, not FiveElements

Write iztro.ClassWood3rd, not iztro.FiveElementsWood3rd — the latter does not exist and will not compile. For the class number use iztro.FiveElementsClassNumber(key).

Example

soul := chart.Palace(iztro.PalaceSoul)

fmt.Println(soul.MajorStars[0].Key == iztro.StarZiweiMaj)
fmt.Println(iztro.StarZiweiMaj, iztro.MutagenLu, iztro.PalaceWealth)
fmt.Println(iztro.ClassWood3rd, iztro.GenderFemale, iztro.LanguageEnUS)

// the gender and language parameters of the charting entries take these two groups too
en, err := iztro.BySolar("2000-8-16", 2, iztro.GenderFemale, true, iztro.LanguageEnUS, nil)
if err != nil {
    log.Fatal(err)
}
fmt.Println(en.Palace(iztro.PalaceSoul).MajorStars[0].Name)

Output

true
ziweiMaj sihuaLu wealthPalace
wood3rd female en-US
emperor

Constants are equivalent to strings

They are all untyped string constants, so chart.Palace("soulPalace") and chart.Palace(iztro.PalaceSoul) are exactly equivalent. The constants earn their keep through IDE completion and spell checking, not through type enforcement.

On this page