astro

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 23, 2023 License: MIT Imports: 8 Imported by: 0

README

astro

介绍

通过新历日期获取星座,农历以及生肖

安装教程

go get github.com/jageros/hawox

使用例子
package main

import (
	"fmt"
	"github.com/jageros/hawox/astro"
)

func main() {
	date := "1993-08-28"
	nDate := astro.Lunar(date)
	animal := astro.GetAnimal(date)
	constellation := astro.GetConstellation(date)

	fmt.Printf("新历:%s\n", date)
	fmt.Printf("农历:%s\n", nDate)
	fmt.Printf("生肖:%s\n", animal)
	fmt.Printf("星座:%s\n", constellation)
}
使用说明
  1. astro.Lunar("xxxx-xx-xx") 新历日期转农历
  2. astro.GetAnimal("xxxx-xx-xx") 新历日期获取生肖
  3. astro.GetConstellation("xxxx-xx-xx") 新历日期获取星座

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Combine1 added in v0.4.8

func Combine1(words1 []string) []string

func Combine2 added in v0.4.8

func Combine2(words1, words2 []string) bool

func GetConstellation

func GetConstellation(date string) string

func InitFromJsonFile added in v0.1.5

func InitFromJsonFile(path string) error

func InitFromUrl added in v0.1.5

func InitFromUrl(url string) error

Types

type Date added in v0.1.5

type Date struct {
	Year         int      `json:"year"`
	Month        int      `json:"month"`
	Day          int      `json:"day"`
	LunarMonth   string   `json:"lunar_month"`
	LunarDay     string   `json:"lunar_day"`
	Week         int      `json:"week"`
	IsLargeMonth bool     `json:"is_large_month"`
	Animal       string   `json:"animal"`
	YearGanZhi   string   `json:"year_gan_zhi"`
	MonthGanZhi  string   `json:"month_gan_zhi"`
	DayGanZhi    string   `json:"day_gan_zhi"`
	Festivals    []string `json:"festivals"`
	Suitable     []string `json:"suitable"`
	Avoid        []string `json:"avoid"`
}

func GetDate added in v0.1.5

func GetDate(date string) *Date

GetDate 根据日期获取黄历数据,参数date格式: 2006-01-02

func (*Date) Constellation added in v0.1.5

func (d *Date) Constellation() string

func (*Date) Key added in v0.1.5

func (d *Date) Key() string

func (*Date) Map added in v0.1.7

func (d *Date) Map(hour int) (map[string]interface{}, error)

func (*Date) NewEightWord added in v0.1.5

func (d *Date) NewEightWord(hour int) *EightWord

func (*Date) String added in v0.1.5

func (d *Date) String() string

func (*Date) WeekString added in v0.1.5

func (d *Date) WeekString() string

type EightWord added in v0.1.5

type EightWord struct {
	*Date
	// contains filtered or unexported fields
}

func (*EightWord) EWString added in v0.1.5

func (ew *EightWord) EWString() string

func (*EightWord) HourGanZhi added in v0.1.7

func (ew *EightWord) HourGanZhi() string

func (*EightWord) MissWuXingAttr added in v0.1.5

func (ew *EightWord) MissWuXingAttr() []string

func (*EightWord) Word added in v0.1.5

func (ew *EightWord) Word() string

func (*EightWord) Words added in v0.1.5

func (ew *EightWord) Words() []string

func (*EightWord) WuXingAttr added in v0.1.5

func (ew *EightWord) WuXingAttr() []string

Jump to

Keyboard shortcuts

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