Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
JST = time.FixedZone("JST", int(jstoffset)) // Japan standard Time
)
Functions ¶
func WithCalendarID ¶
func WithCalendarID(cid ...CalendarID) optFunc
WithCalendarID returns function for setting Reader
func WithEndDate ¶
func WithEndDate(end DateJp) optFunc
WithEndDate returns function for setting Reader
func WithStartDate ¶
func WithStartDate(start DateJp) optFunc
WithStartDate returns function for setting Reader
func WithTempDir ¶
func WithTempDir(dir string) optFunc
WithTempDir returns function for setting Reader
Types ¶
type CalendarID ¶
type CalendarID int
const ( Holiday CalendarID = iota + 1 //国民の祝日および休日 MoonPhase //朔弦望 SolarTerm //二十四節気・雑節 Eclipse //日食・月食・日面経過 Planet //惑星現象 )
type DateJp ¶
DateJp is wrapper class of time.Time
func (*DateJp) MarshalJSON ¶
MarshalJSON returns time string with RFC3339 format
func (*DateJp) UnmarshalJSON ¶
UnmarshalJSON returns result of Unmarshal for json.Unmarshal()
type Koyomi ¶
type Koyomi struct {
// contains filtered or unexported fields
}
Koyomi is array of Event
Example ¶
package main
import (
"bytes"
"fmt"
"io"
"os"
"time"
"github.com/goark/koyomi"
)
func main() {
start, _ := koyomi.DateFrom("2019-05-01")
end := koyomi.NewDate(time.Date(2019, time.May, 31, 0, 0, 0, 0, koyomi.JST))
k, err := koyomi.NewSource(
koyomi.WithCalendarID(koyomi.Holiday, koyomi.SolarTerm),
koyomi.WithStartDate(start),
koyomi.WithEndDate(end),
).Get()
if err != nil {
return
}
csv, err := k.EncodeCSV()
if err != nil {
return
}
if _, err := io.Copy(os.Stdout, bytes.NewReader(csv)); err != nil {
fmt.Fprintln(os.Stderr, err)
return
}
}
Output: "Date","Title" "2019-05-01","休日 (天皇の即位の日)" "2019-05-02","休日" "2019-05-02","八十八夜" "2019-05-03","憲法記念日" "2019-05-04","みどりの日" "2019-05-05","こどもの日" "2019-05-06","休日" "2019-05-06","立夏" "2019-05-21","小満"
func (*Koyomi) EncodeJSON ¶
Click to show internal directories.
Click to hide internal directories.
