util

package
v0.0.0-...-d1346dc Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JapanTime = time.FixedZone("UTC+9", +9*60*60)

Functions

func EnglishPriceHandler

func EnglishPriceHandler(p string) (price string)

func FindPrice

func FindPrice(arr []string) string

func FindTime

func FindTime(s string, prefix string) string

func GetDate

func GetDate(md []rune, sep rune) (month string, day string, err error)

func GetJSON

func GetJSON(url string, target interface{}) error

func GetRelevantYear

func GetRelevantYear(month int) int

GetRelevantYear gets the year for a given month. Some connectors have no way to get the year from DOM, so we make a basic set of assumptions:

1. If the month of the live is equal to or greater than the current month, assume the live is in the current year.

2. If the month of the live is less than the current month, assume the live is next year.

func GetTimeFromString

func GetTimeFromString(s string) (hour string, min string, nextDay bool)

func GetUniqueVenueIDs

func GetUniqueVenueIDs(a []LiveHouse) (b []string)

func GetYearMonth

func GetYearMonth(ym []rune, sep rune) (year string, month string, err error)

func GetYearMonthDay

func GetYearMonthDay(ymd []rune, sep1 rune, sep2 rune) (year string, month string, day string, err error)

func InsertShortYearMonth

func InsertShortYearMonth(s string) string

func InsertYearMonth

func InsertYearMonth(s string) string

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func ParseTime

func ParseTime(d string, t string) (res time.Time, err error)

func ProcessArtists

func ProcessArtists(a []string) (artists []string)

func SpacedPriceTimeFetcher

func SpacedPriceTimeFetcher(d string, s string) (price string, open time.Time, start time.Time, err error)

Types

type Area

type Area struct {
	ID         int    `db:"id"`
	Prefecture string `db:"prefecture"`
	Area       string `db:"area"`
}

type Live

type Live struct {
	Title        string
	Artists      []string
	OpenTime     time.Time
	StartTime    time.Time
	Price        string
	PriceEnglish string
	Venue        LiveHouse
	URL          string
}

type LiveHouse

type LiveHouse struct {
	ID          string `db:"id"`
	Url         string `db:"url"`
	Description string `db:"description"`
	Area        Area   `db:"areas_id"`
}

func GetUniqueVenues

func GetUniqueVenues(a []LiveHouse) (b []LiveHouse)

type PriceHandler

type PriceHandler func(p string) (price string, err error)

type TimeHandler

type TimeHandler func(d string, t string) (open int64, start int64, err error)

Jump to

Keyboard shortcuts

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