# README
chronos
import "github.com/godcong/chronos/v2"
Index
- Constants
- Variables
- func ConstellationChinese(c Constellation) (string, error)
- func ConstellationChineseV2(c Constellation) string
- func DiZhiChinese(dizhi DiZhi) (string, error)
- func DiZhiChineseV2(dizhi DiZhi) string
- func GanZhiChinese(ganzhi GanZhi) (string, error)
- func GanZhiChineseV2(ganzhi GanZhi) string
- func LeapMonth(t time.Time) (int, error)
- func LeapMonthBS(t time.Time) (int, error)
- func NianZhuChineseV2(t time.Time) string
- func SolarTermChinese(st SolarTerm) (string, error)
- func SolarTermChineseV2(st SolarTerm) string
- func TianGanChinese(tiangan TianGan) (string, error)
- func TianGanChineseV2(tiangan TianGan) string
- func YearGanZhiChinese(t time.Time) (string, error)
- func YearSolarTermDate(t time.Time, st SolarTerm) (month time.Month, day int)
- func YearSolarTermDay(t time.Time, st SolarTerm) (day int)
- func YearSolarTermMonth(t time.Time, st SolarTerm) (month time.Month)
- func YueZhuChineseV2(t time.Time) string
- func ZodiacChinese(zodiac Zodiac) (string, error)
- func ZodiacChineseV2(zodiac Zodiac) string
- type Calendar
- func NewSolarCalendar(v ...any) Calendar
- func ParseSolarDate(year, month, day, hour, minute, second int) Calendar
- func ParseSolarNow() Calendar
- func ParseSolarString(s string, format ...string) Calendar
- func ParseSolarTime(t time.Time) Calendar
- func ParseTime(t time.Time, local *time.Location) Calendar
- type CalendarDate
- type ChineseSupport
- type Constellation
- type DiZhi
- type EightCharacter
- type GanZhi
- func NianZhu(t time.Time) GanZhi
- func ParseGanZhi(name string) (GanZhi, error)
- func RiZhu(t time.Time) GanZhi
- func ShiZhu(t time.Time) GanZhi
- func YueZhu(t time.Time) GanZhi
- func (x GanZhi) Chinese() string
- func (x GanZhi) MarshalText() ([]byte, error)
- func (x GanZhi) String() string
- func (x *GanZhi) UnmarshalText(text []byte) error
- type Lunar
- type LunarDate
- type Solar
- type SolarDate
- type SolarTerm
- type SolarTermDetail
- type StemBranch
- type TianGan
- type Zodiac
- func ParseZodiac(name string) (Zodiac, error)
- func YearZodiac(t time.Time) (Zodiac, error)
- func YearZodiacDay(t time.Time) (Zodiac, error)
- func YearZodiacNoFix(year int) Zodiac
- func (x Zodiac) Chinese() string
- func (x Zodiac) MarshalText() ([]byte, error)
- func (x Zodiac) String() string
- func (x *Zodiac) UnmarshalText(text []byte) error
Constants
DefaultDateFormat ...
const (
DefaultDateFormat = "2006/01/02 15:04:05"
LunarDateFormat = "2006/01/02"
)
const (
// LeapMonthSmall returns lunar small month
LeapMonthSmall = 1
// LeapMonthBig returns lunar big month
LeapMonthBig = 2
)
Variables
var (
// ErrYearNotHaveLeapMonth returns an error
ErrYearNotHaveLeapMonth = errors.New("[chronos] year not have leap month")
// ErrWrongTianGanTypes returns an error
ErrWrongTianGanTypes = errors.New("[chronos] wrong tiangan types")
// ErrWrongDiZhiTypes returns an error
ErrWrongDiZhiTypes = errors.New("[chronos] wrong dizhi types")
// ErrWrongGanZhiTypes returns an error
ErrWrongGanZhiTypes = errors.New("[chronos] wrong ganzhi types")
// ErrWrongZodiacTypes returns an error
ErrWrongZodiacTypes = errors.New("[chronos] wrong zodiac types")
// ErrWrongConstellationTypes returns an error
ErrWrongConstellationTypes = errors.New("[chronos] wrong constellation types")
// ErrWrongSolarTermFormat returns an error
ErrWrongSolarTermFormat = errors.New("[chronos] wrong solar term format")
// ErrWrongSolarTermIndex returns an error
ErrWrongSolarTermIndex = errors.New("[chronos] wrong solar term index")
)
var (
// PillarHour is an alias name of ShiZhu
PillarHour = ShiZhu
// PillarDay is an alias name of RiZhu
PillarDay = RiZhu
// PillarMonty is an alias name of YueZhu
PillarMonty = YueZhu
// PillarYear is an alias name of NianZhu
PillarYear = NianZhu
)
func ConstellationChinese
func ConstellationChinese(c Constellation) (string, error)
ConstellationChinese returns a constellation of the chinese @param Constellation @return string @return error
func ConstellationChineseV2
func ConstellationChineseV2(c Constellation) string
ConstellationChineseV2 returns a constellation of the chinese @param Constellation @return string
func DiZhiChinese
func DiZhiChinese(dizhi DiZhi) (string, error)
DiZhiChinese returns the chinese DiZhi string @param DiZhi @return string @return error
func DiZhiChineseV2
func DiZhiChineseV2(dizhi DiZhi) string
DiZhiChineseV2 returns the chinese DiZhi string @param DiZhi @return string
func GanZhiChinese
func GanZhiChinese(ganzhi GanZhi) (string, error)
GanZhiChinese returns the chinese GanZhi string @param GanZhi @return string @return error
func GanZhiChineseV2
func GanZhiChineseV2(ganzhi GanZhi) string
GanZhiChineseV2 returns the chinese GanZhi string @param GanZhi @return string
func LeapMonth
func LeapMonth(t time.Time) (int, error)
LeapMonth returns the leap month if leap month is exists in the year @param time.Time @return int @return error
func LeapMonthBS
func LeapMonthBS(t time.Time) (int, error)
LeapMonthBS returns the leap month of big month or small month @param time.Time @return int @return error
func NianZhuChineseV2
func NianZhuChineseV2(t time.Time) string
NianZhuChineseV2 returns the chinese NianZhu string @param time.Time @return string
func SolarTermChinese
func SolarTermChinese(st SolarTerm) (string, error)
func SolarTermChineseV2
func SolarTermChineseV2(st SolarTerm) string
func TianGanChinese
func TianGanChinese(tiangan TianGan) (string, error)
TianGanChinese returns the chinese TianGan string @param TianGan @return string @return error
func TianGanChineseV2
func TianGanChineseV2(tiangan TianGan) string
TianGanChineseV2 returns the chinese TianGan string @param TianGan @return string
func YearGanZhiChinese
func YearGanZhiChinese(t time.Time) (string, error)
YearGanZhiChinese returns the year of the chinese GanZhi string @param int @return string @return error
func YearSolarTermDate
func YearSolarTermDate(t time.Time, st SolarTerm) (month time.Month, day int)
YearSolarTermDate returns the year month day of the solar term @param time.Time @param SolarTerm @return month @return day
func YearSolarTermDay
func YearSolarTermDay(t time.Time, st SolarTerm) (day int)
YearSolarTermDay returns the year day of the solar term @param time.Time @param SolarTerm @return day
func YearSolarTermMonth
func YearSolarTermMonth(t time.Time, st SolarTerm) (month time.Month)
YearSolarTermMonth returns the year month of the solar term @param time.Time @param SolarTerm @return month
func YueZhuChineseV2
func YueZhuChineseV2(t time.Time) string
YueZhuChineseV2 returns the chinese YueZhuChineseV2 string @param time.Time @return string
func ZodiacChinese
func ZodiacChinese(zodiac Zodiac) (string, error)
ZodiacChinese returns the chinese Zodiac string @param Zodiac @return string @return error
func ZodiacChineseV2
func ZodiacChineseV2(zodiac Zodiac) string
ZodiacChineseV2 returns the chinese Zodiac string @param Zodiac @return string
type Calendar
Calendar returns a calendar
type Calendar interface {
Lunar() Lunar
Solar() Solar
FormatTime() string
Time() time.Time
Date() CalendarDate
}
func NewSolarCalendar
func NewSolarCalendar(v ...any) Calendar
NewSolarCalendar can input three type of time to create the calendar "2006/01/02 03:04" format string time.Time value or nil to create a new time.Now() value
func ParseSolarDate
func ParseSolarDate(year, month, day, hour, minute, second int) Calendar
ParseSolarDate returns Calendar parse from date(year, month, day, hour, minute, second) @param int @param int @param int @param int @param int @param int @return Calendar
func ParseSolarNow
func ParseSolarNow() Calendar
ParseSolarNow returns Calendar parse from solar time now(time.Now()) @return Calendar
func ParseSolarString
func ParseSolarString(s string, format ...string) Calendar
ParseSolarString returns Calendar parse from string(value,format?) @param string @param ...string @return Calendar
func ParseSolarTime
func ParseSolarTime(t time.Time) Calendar
ParseSolarTime returns Calendar parse from solar time @param time.Time @return Calendar
func ParseTime
func ParseTime(t time.Time, local *time.Location) Calendar
ParseTime parse time.Time to Calendar @param time.Time @param *time.Location @return Calendar
type CalendarDate
type CalendarDate struct {
IsToday bool `json:"is_today"`
Solar SolarDate `json:"solar"`
Lunar LunarDate `json:"lunar"`
EightCharacter EightCharacter `json:"eight_character"`
Zodiac Zodiac `json:"zodiac"`
Constellation Constellation `json:"constellation"`
IsSolarTermDay bool `json:"is_solar_day"`
SolarTerm SolarTerm `json:"solar_term"`
}
type ChineseSupport
ChineseSupport implements the interface, if support chinese language output
type ChineseSupport interface {
Chinese() string
}
type Constellation
Constellation ENUM(Capricorn,Aquarius,Pisces,Aries,Taurus,Gemini,Cancer,Leo,Virgo,Libra,Scorpio,Sagittarius,Max)
type Constellation int
const (
// ConstellationCapricorn is a Constellation of type Capricorn.
ConstellationCapricorn Constellation = iota
// ConstellationAquarius is a Constellation of type Aquarius.
ConstellationAquarius
// ConstellationPisces is a Constellation of type Pisces.
ConstellationPisces
// ConstellationAries is a Constellation of type Aries.
ConstellationAries
// ConstellationTaurus is a Constellation of type Taurus.
ConstellationTaurus
// ConstellationGemini is a Constellation of type Gemini.
ConstellationGemini
// ConstellationCancer is a Constellation of type Cancer.
ConstellationCancer
// ConstellationLeo is a Constellation of type Leo.
ConstellationLeo
// ConstellationVirgo is a Constellation of type Virgo.
ConstellationVirgo
// ConstellationLibra is a Constellation of type Libra.
ConstellationLibra
// ConstellationScorpio is a Constellation of type Scorpio.
ConstellationScorpio
// ConstellationSagittarius is a Constellation of type Sagittarius.
ConstellationSagittarius
// ConstellationMax is a Constellation of type Max.
ConstellationMax
)
func GetConstellation
func GetConstellation(t time.Time) Constellation
GetConstellation get the constellation of date @param time.Time @return Constellation
func ParseConstellation
func ParseConstellation(name string) (Constellation, error)
ParseConstellation attempts to convert a string to a Constellation.
func (Constellation) Chinese
func (x Constellation) Chinese() string
func (Constellation) MarshalText
func (x Constellation) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (Constellation) String
func (x Constellation) String() string
String implements the Stringer interface.
func (*Constellation) UnmarshalText
func (x *Constellation) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type DiZhi
DiZhi ENUM(Zi , Chou , Yin , Mao , Chen , Si , Wu , Wei , Shen , You , Xu , Hai , Max)
type DiZhi uint32
const (
// DiZhiZi is a DiZhi of type Zi.
DiZhiZi DiZhi = iota
// DiZhiChou is a DiZhi of type Chou.
DiZhiChou
// DiZhiYin is a DiZhi of type Yin.
DiZhiYin
// DiZhiMao is a DiZhi of type Mao.
DiZhiMao
// DiZhiChen is a DiZhi of type Chen.
DiZhiChen
// DiZhiSi is a DiZhi of type Si.
DiZhiSi
// DiZhiWu is a DiZhi of type Wu.
DiZhiWu
// DiZhiWei is a DiZhi of type Wei.
DiZhiWei
// DiZhiShen is a DiZhi of type Shen.
DiZhiShen
// DiZhiYou is a DiZhi of type You.
DiZhiYou
// DiZhiXu is a DiZhi of type Xu.
DiZhiXu
// DiZhiHai is a DiZhi of type Hai.
DiZhiHai
// DiZhiMax is a DiZhi of type Max.
DiZhiMax
)
func ParseDiZhi
func ParseDiZhi(name string) (DiZhi, error)
ParseDiZhi attempts to convert a string to a DiZhi.
func (DiZhi) Chinese
func (x DiZhi) Chinese() string
func (DiZhi) MarshalText
func (x DiZhi) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (DiZhi) String
func (x DiZhi) String() string
String implements the Stringer interface.
func (*DiZhi) UnmarshalText
func (x *DiZhi) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type EightCharacter
type EightCharacter struct {
NianZhu GanZhi `json:"nian_zhu"`
YueZhu GanZhi `json:"yue_zhu"`
Rizhu GanZhi `json:"ri_zhu"`
ShiZhu GanZhi `json:"shi_zhu"`
}
type GanZhi
GanZhi returns the GanZhi enum ENUM(JiaZi,YiChou,BingYin,DingMao,WuChen,JiSi,GengWu,XinWei,RenShen,GuiYou,JiaXu,YiHai, BingZi,DingChou,WuYin,JiMao,GengChen,XinSi,RenWu,GuiWei,JiaShen,YiYou,BingXu,DingHai, WuZi,JiChou,GengYin,XinMao,RenChen,GuiSi,JiaWu,YiWei,BingShen,DingYou,WuXu,JiHai, GengZi,XinChou,RenYin,GuiMao,JiaChen,YiSi,BingWu,DingWei,WuShen,JiYou,GengXu,XinHai, RenZi,GuiChou,JiaYin,YiMao,BingChen,DingSi,WuWu,JiWei,GengShen,XinYou,RenXu,GuiHai,Max)
type GanZhi uint32
const (
// GanZhiJiaZi is a GanZhi of type JiaZi.
GanZhiJiaZi GanZhi = iota
// GanZhiYiChou is a GanZhi of type YiChou.
GanZhiYiChou
// GanZhiBingYin is a GanZhi of type BingYin.
GanZhiBingYin
// GanZhiDingMao is a GanZhi of type DingMao.
GanZhiDingMao
// GanZhiWuChen is a GanZhi of type WuChen.
GanZhiWuChen
// GanZhiJiSi is a GanZhi of type JiSi.
GanZhiJiSi
// GanZhiGengWu is a GanZhi of type GengWu.
GanZhiGengWu
// GanZhiXinWei is a GanZhi of type XinWei.
GanZhiXinWei
// GanZhiRenShen is a GanZhi of type RenShen.
GanZhiRenShen
// GanZhiGuiYou is a GanZhi of type GuiYou.
GanZhiGuiYou
// GanZhiJiaXu is a GanZhi of type JiaXu.
GanZhiJiaXu
// GanZhiYiHai is a GanZhi of type YiHai.
GanZhiYiHai
// GanZhiBingZi is a GanZhi of type BingZi.
GanZhiBingZi
// GanZhiDingChou is a GanZhi of type DingChou.
GanZhiDingChou
// GanZhiWuYin is a GanZhi of type WuYin.
GanZhiWuYin
// GanZhiJiMao is a GanZhi of type JiMao.
GanZhiJiMao
// GanZhiGengChen is a GanZhi of type GengChen.
GanZhiGengChen
// GanZhiXinSi is a GanZhi of type XinSi.
GanZhiXinSi
// GanZhiRenWu is a GanZhi of type RenWu.
GanZhiRenWu
// GanZhiGuiWei is a GanZhi of type GuiWei.
GanZhiGuiWei
// GanZhiJiaShen is a GanZhi of type JiaShen.
GanZhiJiaShen
// GanZhiYiYou is a GanZhi of type YiYou.
GanZhiYiYou
// GanZhiBingXu is a GanZhi of type BingXu.
GanZhiBingXu
// GanZhiDingHai is a GanZhi of type DingHai.
GanZhiDingHai
// GanZhiWuZi is a GanZhi of type WuZi.
GanZhiWuZi
// GanZhiJiChou is a GanZhi of type JiChou.
GanZhiJiChou
// GanZhiGengYin is a GanZhi of type GengYin.
GanZhiGengYin
// GanZhiXinMao is a GanZhi of type XinMao.
GanZhiXinMao
// GanZhiRenChen is a GanZhi of type RenChen.
GanZhiRenChen
// GanZhiGuiSi is a GanZhi of type GuiSi.
GanZhiGuiSi
// GanZhiJiaWu is a GanZhi of type JiaWu.
GanZhiJiaWu
// GanZhiYiWei is a GanZhi of type YiWei.
GanZhiYiWei
// GanZhiBingShen is a GanZhi of type BingShen.
GanZhiBingShen
// GanZhiDingYou is a GanZhi of type DingYou.
GanZhiDingYou
// GanZhiWuXu is a GanZhi of type WuXu.
GanZhiWuXu
// GanZhiJiHai is a GanZhi of type JiHai.
GanZhiJiHai
// GanZhiGengZi is a GanZhi of type GengZi.
GanZhiGengZi
// GanZhiXinChou is a GanZhi of type XinChou.
GanZhiXinChou
// GanZhiRenYin is a GanZhi of type RenYin.
GanZhiRenYin
// GanZhiGuiMao is a GanZhi of type GuiMao.
GanZhiGuiMao
// GanZhiJiaChen is a GanZhi of type JiaChen.
GanZhiJiaChen
// GanZhiYiSi is a GanZhi of type YiSi.
GanZhiYiSi
// GanZhiBingWu is a GanZhi of type BingWu.
GanZhiBingWu
// GanZhiDingWei is a GanZhi of type DingWei.
GanZhiDingWei
// GanZhiWuShen is a GanZhi of type WuShen.
GanZhiWuShen
// GanZhiJiYou is a GanZhi of type JiYou.
GanZhiJiYou
// GanZhiGengXu is a GanZhi of type GengXu.
GanZhiGengXu
// GanZhiXinHai is a GanZhi of type XinHai.
GanZhiXinHai
// GanZhiRenZi is a GanZhi of type RenZi.
GanZhiRenZi
// GanZhiGuiChou is a GanZhi of type GuiChou.
GanZhiGuiChou
// GanZhiJiaYin is a GanZhi of type JiaYin.
GanZhiJiaYin
// GanZhiYiMao is a GanZhi of type YiMao.
GanZhiYiMao
// GanZhiBingChen is a GanZhi of type BingChen.
GanZhiBingChen
// GanZhiDingSi is a GanZhi of type DingSi.
GanZhiDingSi
// GanZhiWuWu is a GanZhi of type WuWu.
GanZhiWuWu
// GanZhiJiWei is a GanZhi of type JiWei.
GanZhiJiWei
// GanZhiGengShen is a GanZhi of type GengShen.
GanZhiGengShen
// GanZhiXinYou is a GanZhi of type XinYou.
GanZhiXinYou
// GanZhiRenXu is a GanZhi of type RenXu.
GanZhiRenXu
// GanZhiGuiHai is a GanZhi of type GuiHai.
GanZhiGuiHai
// GanZhiMax is a GanZhi of type Max.
GanZhiMax
)
func NianZhu
func NianZhu(t time.Time) GanZhi
NianZhu returns a GanZhi of year @param time.Time @return string
func ParseGanZhi
func ParseGanZhi(name string) (GanZhi, error)
ParseGanZhi attempts to convert a string to a GanZhi.
func RiZhu
func RiZhu(t time.Time) GanZhi
RiZhu returns a GanZhi of day @param time.Time @return GanZhi
func ShiZhu
func ShiZhu(t time.Time) GanZhi
ShiZhu returns a GanZhi of hour @param time.Time @return GanZhi @descriptions 子 丑 寅 卯 辰 己 23-01:01-03:03-05 :05-07:07-09:09-11 午 未 申 酉 戊 亥 11-13:13-15:15-17:17-19:19-21:21-23 `甲子`, `乙丑`, `丙寅`, `丁卯`, `戊辰`, `己巳`, `庚午`, `辛未`, `壬申`, `癸酉`, `甲戌`, `乙亥`, //甲或己日 `丙子`, `丁丑`, `戊寅`, `己卯`, `庚辰`, `辛巳`, `壬午`, `癸未`, `甲申`, `乙酉`, `丙戌`, `丁亥`, //乙或庚日 `戊子`, `己丑`, `庚寅`, `辛卯`, `壬辰`, `癸巳`, `甲午`, `乙未`, `丙申`, `丁酉`, `戊戌`, `己亥`, //丙或辛日 `庚子`, `辛丑`, `壬寅`, `癸卯`, `甲辰`, `乙巳`, `丙午`, `丁未`, `戊申`, `己酉`, `庚戌`, `辛亥`, //丁或壬日 `壬子`, `癸丑`, `甲寅`, `乙卯`, `丙辰`, `丁巳`, `戊午`, `己未`, `庚申`, `辛酉`, `壬戌`, `癸亥`, //戊或癸日
func YueZhu
func YueZhu(t time.Time) GanZhi
YueZhu returns a GanZhi of month @param time.Time @return GanZhi
func (GanZhi) Chinese
func (x GanZhi) Chinese() string
func (GanZhi) MarshalText
func (x GanZhi) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (GanZhi) String
func (x GanZhi) String() string
String implements the Stringer interface.
func (*GanZhi) UnmarshalText
func (x *GanZhi) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Lunar
Lunar returns the lunar time
type Lunar interface {
Year() int
Month() int
Day() int
Hour() int
LeapMonth() int
IsLeapMonth() bool
}
type LunarDate
type LunarDate struct {
Year int `json:"year"`
Month int `json:"month"`
Day int `json:"day"`
Hour int `json:"hour"`
IsLeapMonth bool `json:"is_leap_month"`
LeapMonth int `json:"leap_month"`
}
type Solar
Solar returns the solar time
type Solar interface {
Minute() int
Second() int
YearDay() int
IsLeapYear() bool
Year() int
Month() time.Month
Day() int
Hour() int
}
type SolarDate
type SolarDate struct {
Year int `json:"year"`
Month time.Month `json:"month"`
Day int `json:"day"`
Hour int `json:"hour"`
Minute int `json:"minute"`
Second int `json:"second"`
WeekDay time.Weekday `json:"week_day"`
}
type SolarTerm
SolarTerm ENUM(XiaoHan,DaHan,LiChun,YuShui,JingZhe,ChunFen,QingMing,GuYu,LiXia,XiaoMan,MangZhong,XiaZhi,XiaoShu,DaShu,LiQiu,ChuShu,BaiLu,QiuFen,HanLu,ShuangJiang,LiDong,XiaoXue,DaXue,DongZhi,Max)
type SolarTerm uint32
const (
// SolarTermXiaoHan is a SolarTerm of type XiaoHan.
SolarTermXiaoHan SolarTerm = iota
// SolarTermDaHan is a SolarTerm of type DaHan.
SolarTermDaHan
// SolarTermLiChun is a SolarTerm of type LiChun.
SolarTermLiChun
// SolarTermYuShui is a SolarTerm of type YuShui.
SolarTermYuShui
// SolarTermJingZhe is a SolarTerm of type JingZhe.
SolarTermJingZhe
// SolarTermChunFen is a SolarTerm of type ChunFen.
SolarTermChunFen
// SolarTermQingMing is a SolarTerm of type QingMing.
SolarTermQingMing
// SolarTermGuYu is a SolarTerm of type GuYu.
SolarTermGuYu
// SolarTermLiXia is a SolarTerm of type LiXia.
SolarTermLiXia
// SolarTermXiaoMan is a SolarTerm of type XiaoMan.
SolarTermXiaoMan
// SolarTermMangZhong is a SolarTerm of type MangZhong.
SolarTermMangZhong
// SolarTermXiaZhi is a SolarTerm of type XiaZhi.
SolarTermXiaZhi
// SolarTermXiaoShu is a SolarTerm of type XiaoShu.
SolarTermXiaoShu
// SolarTermDaShu is a SolarTerm of type DaShu.
SolarTermDaShu
// SolarTermLiQiu is a SolarTerm of type LiQiu.
SolarTermLiQiu
// SolarTermChuShu is a SolarTerm of type ChuShu.
SolarTermChuShu
// SolarTermBaiLu is a SolarTerm of type BaiLu.
SolarTermBaiLu
// SolarTermQiuFen is a SolarTerm of type QiuFen.
SolarTermQiuFen
// SolarTermHanLu is a SolarTerm of type HanLu.
SolarTermHanLu
// SolarTermShuangJiang is a SolarTerm of type ShuangJiang.
SolarTermShuangJiang
// SolarTermLiDong is a SolarTerm of type LiDong.
SolarTermLiDong
// SolarTermXiaoXue is a SolarTerm of type XiaoXue.
SolarTermXiaoXue
// SolarTermDaXue is a SolarTerm of type DaXue.
SolarTermDaXue
// SolarTermDongZhi is a SolarTerm of type DongZhi.
SolarTermDongZhi
// SolarTermMax is a SolarTerm of type Max.
SolarTermMax
)
func CheckSolarTermDay
func CheckSolarTermDay(t time.Time) (SolarTerm, bool)
func ParseSolarTerm
func ParseSolarTerm(name string) (SolarTerm, error)
ParseSolarTerm attempts to convert a string to a SolarTerm.
func (SolarTerm) Chinese
func (x SolarTerm) Chinese() string
func (SolarTerm) GetYearDate
func (x SolarTerm) GetYearDate(year int) (month time.Month, day int)
func (SolarTerm) String
func (x SolarTerm) String() string
String implements the Stringer interface.
type SolarTermDetail
SolarTermDetail 24节气表
type SolarTermDetail struct {
Index int `json:"index"`
SolarTerm SolarTerm `json:"solar_term"`
Time string `json:"time"`
SanHou string `json:"san_hou"`
Explanation string `json:"explanation"`
}
func YearSolarTermDetail
func YearSolarTermDetail(t time.Time, st SolarTerm) (SolarTermDetail, error)
YearSolarTermDetail get the details of year solar term @param time.Time @param SolarTerm @return SolarTermDetail @return error
type StemBranch
StemBranch is an alias name for GanZhi
type StemBranch = GanZhi
type TianGan
TianGan ENUM(Jia , Yi , Bing , Ding , Wu , Ji , Geng , Xin , Ren , Gui , Max)
type TianGan uint32
const (
// TianGanJia is a TianGan of type Jia.
TianGanJia TianGan = iota
// TianGanYi is a TianGan of type Yi.
TianGanYi
// TianGanBing is a TianGan of type Bing.
TianGanBing
// TianGanDing is a TianGan of type Ding.
TianGanDing
// TianGanWu is a TianGan of type Wu.
TianGanWu
// TianGanJi is a TianGan of type Ji.
TianGanJi
// TianGanGeng is a TianGan of type Geng.
TianGanGeng
// TianGanXin is a TianGan of type Xin.
TianGanXin
// TianGanRen is a TianGan of type Ren.
TianGanRen
// TianGanGui is a TianGan of type Gui.
TianGanGui
// TianGanMax is a TianGan of type Max.
TianGanMax
)
func ParseTianGan
func ParseTianGan(name string) (TianGan, error)
ParseTianGan attempts to convert a string to a TianGan.
func (TianGan) Chinese
func (x TianGan) Chinese() string
func (TianGan) MarshalText
func (x TianGan) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (TianGan) String
func (x TianGan) String() string
String implements the Stringer interface.
func (*TianGan) UnmarshalText
func (x *TianGan) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type Zodiac
Zodiac ENUM(Rat, Cow, Tiger, Rabbit, Dragon, Snake, Horse, Sheep, Monkey, Chicken, Dog, Pig, Max)
type Zodiac uint32
const (
// ZodiacRat is a Zodiac of type Rat.
ZodiacRat Zodiac = iota
// ZodiacCow is a Zodiac of type Cow.
ZodiacCow
// ZodiacTiger is a Zodiac of type Tiger.
ZodiacTiger
// ZodiacRabbit is a Zodiac of type Rabbit.
ZodiacRabbit
// ZodiacDragon is a Zodiac of type Dragon.
ZodiacDragon
// ZodiacSnake is a Zodiac of type Snake.
ZodiacSnake
// ZodiacHorse is a Zodiac of type Horse.
ZodiacHorse
// ZodiacSheep is a Zodiac of type Sheep.
ZodiacSheep
// ZodiacMonkey is a Zodiac of type Monkey.
ZodiacMonkey
// ZodiacChicken is a Zodiac of type Chicken.
ZodiacChicken
// ZodiacDog is a Zodiac of type Dog.
ZodiacDog
// ZodiacPig is a Zodiac of type Pig.
ZodiacPig
// ZodiacMax is a Zodiac of type Max.
ZodiacMax
)
func ParseZodiac
func ParseZodiac(name string) (Zodiac, error)
ParseZodiac attempts to convert a string to a Zodiac.
func YearZodiac
func YearZodiac(t time.Time) (Zodiac, error)
YearZodiac returns the zodiac of year.(pa: this will auto fix zodiac with LiChun check stopped at seconds) @param time.Time @return Zodiac @return error
func YearZodiacDay
func YearZodiacDay(t time.Time) (Zodiac, error)
YearZodiacDay returns the zodiac of year.(pa: this will auto fix zodiac with LiChun check stopped at day) @param time.Time @return Zodiac @return error
func YearZodiacNoFix
func YearZodiacNoFix(year int) Zodiac
YearZodiacNoFix returns the zodiac of year.(ps: this is not support LiChun day fix) @param int @return Zodiac
func (Zodiac) Chinese
func (x Zodiac) Chinese() string
func (Zodiac) MarshalText
func (x Zodiac) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (Zodiac) String
func (x Zodiac) String() string
String implements the Stringer interface.
func (*Zodiac) UnmarshalText
func (x *Zodiac) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
Generated by gomarkdoc